summaryrefslogtreecommitdiff
path: root/techlibs/xilinx7/counter.v
diff options
context:
space:
mode:
Diffstat (limited to 'techlibs/xilinx7/counter.v')
-rw-r--r--techlibs/xilinx7/counter.v12
1 files changed, 12 insertions, 0 deletions
diff --git a/techlibs/xilinx7/counter.v b/techlibs/xilinx7/counter.v
new file mode 100644
index 00000000..72208bd8
--- /dev/null
+++ b/techlibs/xilinx7/counter.v
@@ -0,0 +1,12 @@
+module counter (clk, rst, en, count);
+
+ input clk, rst, en;
+ output reg [3:0] count;
+
+ always @(posedge clk)
+ if (rst)
+ count <= 4'd0;
+ else if (en)
+ count <= count + 4'd1;
+
+endmodule