si_pchclk.v
1.9 KB
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
65
66
67
68
/**************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
*************************************************************************/
// $Id: si_pchclk.v,v 1.1.1.1 2002/05/17 06:14:58 blythe Exp $
module si_pchclk(clk, reset_l, pchclk, div_cnt);
input clk; // system clock
input reset_l; // system reset
output pchclk; // pchannel clock source
output [1:0] div_cnt ;
// output registers
reg pchclk;
reg [1:0] div_cnt;
wire ctr_clr_pulse;
// internal regs
reg reset_l_d1;
reg reset_l_d2;
always @( posedge clk) begin
reset_l_d1 <= reset_l;
reset_l_d2 <= reset_l_d1;
end
// reset must be brought hi for at least one clock
// to allow hi to low edge detect
assign ctr_clr_pulse = (~reset_l_d1 & reset_l_d2) ;
always @(posedge clk or posedge ctr_clr_pulse) begin
if (ctr_clr_pulse == 1'b1) begin
// clear cntr for consistent test vector operation
div_cnt <= 2'b00;
end
else begin
div_cnt <= (div_cnt + 1) ;
end
end // always
// create pchannel clock from decode of counter
always @(posedge clk ) begin
if ((div_cnt == 2'b11) | (div_cnt == 2'b0) ) begin
pchclk <= 1;
end
else begin
pchclk <= 0;
end
end // always
endmodule