parser refactoring
[sv2nmigen.git] / examples / counter.sv
diff --git a/examples/counter.sv b/examples/counter.sv
new file mode 100644 (file)
index 0000000..b455ad7
--- /dev/null
@@ -0,0 +1,15 @@
+module up_counter(input logic clk,
+                  input logic reset, 
+                  output[3:0] counter
+                 );
+   reg [3:0] counter_up;
+   // up counter
+   always @(posedge clk or posedge reset)
+     begin
+       if(reset)
+         counter_up <= 4'd0;
+       else
+         counter_up <= counter_up + 4'd1;
+     end 
+   assign counter = counter_up;
+endmodule