aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlavian Kaufmann <flavian@flaviankaufmann.ch>2024-04-27 13:30:34 +0200
committerFlavian Kaufmann <flavian@flaviankaufmann.ch>2024-04-27 13:30:34 +0200
commite69f80a4e6fb0a52f25d323d25187be0f328edf7 (patch)
tree3fde80ea4a68849667e72c87c96d769899491b46 /src
downloadriscv_cpu-e69f80a4e6fb0a52f25d323d25187be0f328edf7.tar.gz
riscv_cpu-e69f80a4e6fb0a52f25d323d25187be0f328edf7.zip
initial commit
Diffstat (limited to 'src')
-rw-r--r--src/top.v21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/top.v b/src/top.v
new file mode 100644
index 0000000..8dc9684
--- /dev/null
+++ b/src/top.v
@@ -0,0 +1,21 @@
+module top (
+ input clk,
+ input key,
+ output [5:0] led
+);
+
+reg [25:0] ctr_q;
+wire [25:0] ctr_d;
+
+// Sequential code (flip-flop)
+always @(posedge clk) begin
+ if (key) begin
+ ctr_q <= ctr_d;
+ end
+end
+
+// Combinational code (boolean logic)
+assign ctr_d = ctr_q + 1'b1;
+assign led = ctr_q[25:20];
+
+endmodule