From e69f80a4e6fb0a52f25d323d25187be0f328edf7 Mon Sep 17 00:00:00 2001 From: Flavian Kaufmann Date: Sat, 27 Apr 2024 13:30:34 +0200 Subject: initial commit --- src/top.v | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/top.v (limited to 'src') 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 -- cgit v1.2.3