-
Notifications
You must be signed in to change notification settings - Fork 0
/
PN_MultClkGen.v
64 lines (55 loc) · 1.53 KB
/
PN_MultClkGen.v
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: JPLathuile
// Engineer: xynium
//
// Create Date: 08.02.2019 08:04:40
// Design Name:
// Module Name: PN_MultClkGen
// Lengthen clock pulse and combine them for Adder
//
//////////////////////////////////////////////////////////////////////////////////
module PN_MultClkGen(
input Clk1,
input Clk2,
input Clk,
output ClkOut
);
parameter PulsLeng = 4000;
wire rClk1,rClk2;
integer Cpt;
reg One=1'b1;
reg CLR;
assign ClkOut = rClk1 & rClk2;
initial begin
Cpt=0;
end
FDCE #(
.INIT(1'b0) // Initial value of register (1'b0 or 1'b1)
) FClk1 (
.Q(rClk1), // 1-bit Data output
.C(Clk1), // 1-bit Clock input
.CE(One), // 1-bit Clock enable input
.CLR(CLR), // 1-bit Asynchronous clear input
.D(One) // 1-bit Data input
);
FDCE #(
.INIT(1'b0) // Initial value of register (1'b0 or 1'b1)
) FClk2 (
.Q(rClk2), // 1-bit Data output
.C(Clk2), // 1-bit Clock input
.CE(One), // 1-bit Clock enable input
.CLR(CLR), // 1-bit Asynchronous clear input
.D(One) // 1-bit Data input
);
always@(posedge Clk) begin
if (rClk1 || rClk2)
Cpt = Cpt + 1;
if (Cpt > PulsLeng) begin
CLR<=1'b1;
Cpt=0;
end
else
CLR<=1'b0;
end
endmodule