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