diff options
Diffstat (limited to 'mylib/counter_16.v')
-rwxr-xr-x | mylib/counter_16.v | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mylib/counter_16.v b/mylib/counter_16.v new file mode 100755 index 0000000..c0ec549 --- /dev/null +++ b/mylib/counter_16.v @@ -0,0 +1,21 @@ +`timescale 1ns / 100ps
+
+module counter_16(clock,enable,reset,count);
+
+ parameter BIT_SZ = 16;
+ input clock, enable, reset;
+ output [BIT_SZ-1:0] count;
+
+ reg [BIT_SZ-1:0] count;
+
+ initial count = 0;
+
+ always @ (posedge clock)
+ begin
+ if(enable == 1'b1)
+ count <= count + 1'b1;
+ if(reset == 1'b1)
+ count <= 16'b0;
+ end
+
+endmodule
\ No newline at end of file |