summaryrefslogtreecommitdiff
path: root/part_3/mylib/divider_5000.v
diff options
context:
space:
mode:
authorVasil Zlatanov <v@skozl.com>2016-12-12 21:51:10 +0000
committerVasil Zlatanov <v@skozl.com>2016-12-12 21:51:10 +0000
commit4b6e0102d20d9ab060ce930e4b846c8be446bb06 (patch)
treee475eab3716738f2928f0b2063956e9b155f94ab /part_3/mylib/divider_5000.v
downloade2-verilab-4b6e0102d20d9ab060ce930e4b846c8be446bb06.tar.gz
e2-verilab-4b6e0102d20d9ab060ce930e4b846c8be446bb06.tar.bz2
e2-verilab-4b6e0102d20d9ab060ce930e4b846c8be446bb06.zip
public push
Diffstat (limited to 'part_3/mylib/divider_5000.v')
-rw-r--r--part_3/mylib/divider_5000.v31
1 files changed, 31 insertions, 0 deletions
diff --git a/part_3/mylib/divider_5000.v b/part_3/mylib/divider_5000.v
new file mode 100644
index 0000000..2e5e20e
--- /dev/null
+++ b/part_3/mylib/divider_5000.v
@@ -0,0 +1,31 @@
+`timescale 1ns / 100ps
+
+
+module divider_5000 (
+ clock,
+ out
+ );
+
+ parameter BIT_SZ = 16;
+ input clock;
+ reg [BIT_SZ-1:0] count;
+
+ initial count = 0;
+
+ output reg out;
+
+
+ always @ (posedge clock)
+ begin
+ if (count < 16'd5000)
+ begin
+ count <= count + 1'b1;
+ out <= 1'b0;
+ end
+ else
+ begin
+ out <= 1'b1;
+ count <= 1'b0;
+ end
+ end
+endmodule