aboutsummaryrefslogtreecommitdiffstats
path: root/fpga_interchange/examples/counter/counter.v
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-03-03 07:06:07 +0000
committerGitHub <noreply@github.com>2021-03-03 07:06:07 +0000
commit6e38e236f88db749788fb74a6fa8ac0c80b6035b (patch)
treedfab73bc8afa157ebf323a8f6c9b54d0998392f0 /fpga_interchange/examples/counter/counter.v
parent27fbee523301be074abd06a3568dc9591d98e0fa (diff)
parent71b92cb8139c63a7936fa05f2a47739b0c115b01 (diff)
downloadnextpnr-6e38e236f88db749788fb74a6fa8ac0c80b6035b.tar.gz
nextpnr-6e38e236f88db749788fb74a6fa8ac0c80b6035b.tar.bz2
nextpnr-6e38e236f88db749788fb74a6fa8ac0c80b6035b.zip
Merge pull request #604 from litghost/add_counter_test
Add counter test for FPGA interchange
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