diff options
author | Flavian Kaufmann <flavian@flaviankaufmann.ch> | 2024-04-27 13:30:34 +0200 |
---|---|---|
committer | Flavian Kaufmann <flavian@flaviankaufmann.ch> | 2024-04-27 13:30:34 +0200 |
commit | e69f80a4e6fb0a52f25d323d25187be0f328edf7 (patch) | |
tree | 3fde80ea4a68849667e72c87c96d769899491b46 /src/top.v | |
download | riscv_cpu-e69f80a4e6fb0a52f25d323d25187be0f328edf7.tar.gz riscv_cpu-e69f80a4e6fb0a52f25d323d25187be0f328edf7.zip |
initial commit
Diffstat (limited to 'src/top.v')
-rw-r--r-- | src/top.v | 21 |
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 |