2021-10-29 10:04:59 +00:00
|
|
|
module CNT(
|
|
|
|
/* FSB clock and AS detection */
|
|
|
|
input FCLK, input CACT,
|
|
|
|
/* Timeout signals */
|
|
|
|
output reg TimeoutA, output reg TimeoutB);
|
|
|
|
|
|
|
|
/* Refresh counter */
|
|
|
|
reg [7:0] RefCnt = 0;
|
|
|
|
always @(posedge FCLK) begin
|
|
|
|
RefCnt <= RefCnt+1;
|
|
|
|
end
|
|
|
|
|
|
|
|
/* Timeout signals */
|
2022-01-16 15:56:37 +00:00
|
|
|
reg TimeoutBPre;
|
2021-10-29 10:04:59 +00:00
|
|
|
always @(posedge FCLK) begin
|
|
|
|
if (~CACT) begin
|
|
|
|
TimeoutA <= 0;
|
2022-01-16 15:56:37 +00:00
|
|
|
TimeoutBPre <= 0;
|
2021-10-29 10:04:59 +00:00
|
|
|
TimeoutB <= 0;
|
|
|
|
end else begin
|
2022-01-16 15:56:37 +00:00
|
|
|
if (RefCnt[6:0]==0) TimeoutA <= 1;
|
|
|
|
if (RefCnt==0) TimeoutBPre <= 1;
|
|
|
|
if (RefCnt==0 && TimeoutBPre) TimeoutB <= 1;
|
2021-10-29 10:04:59 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
endmodule
|