-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclock_divider.sv
37 lines (33 loc) · 882 Bytes
/
clock_divider.sv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Bilkent University
// Engineer: Usama Saqib
//
// Create Date: 11/27/2016 03:00:28 PM
// Design Name:
// Module Name: clock_divider
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module clock_divider_motors( input logic clk, output logic clk_en);
int count;
logic [19:0]speed = 20'b1100001101010000000;
always@( posedge clk) begin
count <= count + 1;
if ( count >= speed)
count <= 0;
if ( count == 0)
clk_en = 1'b1;
else
clk_en = 1'b0;
end
endmodule