aboutsummaryrefslogtreecommitdiffstats
path: root/fpga_interchange/examples/counter/counter.v
diff options
context:
space:
mode:
authorKeith Rothman <537074+litghost@users.noreply.github.com>2021-02-25 09:11:32 -0800
committerKeith Rothman <537074+litghost@users.noreply.github.com>2021-02-26 11:01:22 -0800
commit9cbfd0b967f5804472afbb91d8df92e69dffe659 (patch)
tree80f1052bb588b0e3ff133ab99658cd7a0b06936e /fpga_interchange/examples/counter/counter.v
parentc65ba121e00a17c344f154e0335d1c2358a1393d (diff)
downloadnextpnr-9cbfd0b967f5804472afbb91d8df92e69dffe659.tar.gz
nextpnr-9cbfd0b967f5804472afbb91d8df92e69dffe659.tar.bz2
nextpnr-9cbfd0b967f5804472afbb91d8df92e69dffe659.zip
Add counter test.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
Diffstat (limited to 'fpga_interchange/examples/counter/counter.v')
-rw-r--r--fpga_interchange/examples/counter/counter.v15
1 files changed, 15 insertions, 0 deletions
diff --git a/fpga_interchange/examples/counter/counter.v b/fpga_interchange/examples/counter/counter.v
new file mode 100644
index 00000000..00f52a20
--- /dev/null
+++ b/fpga_interchange/examples/counter/counter.v
@@ -0,0 +1,15 @@
+module top(input clk, input rst, output [7:4] io_led);
+
+reg [31:0] counter = 32'b0;
+
+assign io_led = counter >> 22;
+
+always @(posedge clk)
+begin
+ if(rst)
+ counter <= 32'b0;
+ else
+ counter <= counter + 1;
+end
+
+endmodule