From 4b6e0102d20d9ab060ce930e4b846c8be446bb06 Mon Sep 17 00:00:00 2001 From: Vasil Zlatanov Date: Mon, 12 Dec 2016 21:51:10 +0000 Subject: public push --- part_2/ex9/divider_2500.v | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 part_2/ex9/divider_2500.v (limited to 'part_2/ex9/divider_2500.v') diff --git a/part_2/ex9/divider_2500.v b/part_2/ex9/divider_2500.v new file mode 100644 index 0000000..305b2b6 --- /dev/null +++ b/part_2/ex9/divider_2500.v @@ -0,0 +1,36 @@ +`timescale 1ns / 100ps + + +module divider_2500 ( + clock, + clock_ms, + out + ); + + parameter BIT_SZ = 12; + input clock; + input clock_ms; + reg [BIT_SZ-1:0] count; + + initial count = 0; + + output reg out; + + + always @ (posedge clock) + begin + if (clock_ms) + begin + if (count < 12'd499) + begin + count <= count + 1'b1; + out <= 1'b0; + end + else + begin + out <= 1'b1; + count <= 1'b0; + end + end + end +endmodule -- cgit v1.2.3-54-g00ecf