-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDUTY_CALC.sv
executable file
·49 lines (47 loc) · 1008 Bytes
/
DUTY_CALC.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
38
39
40
41
42
43
44
45
46
47
48
49
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03/12/2019 08:51:57 PM
// Design Name:
// Module Name: DUTY_CALC
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module DUTY_CALC(
input logic CLK,
input logic[7:0] SW,
output logic SIGNAL
);
int maxCount = 256;
int count = 0;
always_ff@(posedge CLK)
begin
if(count < maxCount)
begin
if(count < SW)
begin
SIGNAL = 0;
end
else
begin
SIGNAL = 1;
end
count = count + 1;
end
else
begin
count = 0;
end
end
endmodule