csclk.v
2.66 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**************************************************************************
* *
* 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: csclk.v,v 1.1.1.1 2002/05/17 06:07:45 blythe Exp $
/////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: csclk
// description: contains fifo write pointer and fifo status which are
// computed every clk instead of every gclk
//
// designer: Mike M. Cai 8/11/94
//
/////////////////////////////////////////////////////////////////////////
module csclk( // outputs
wr_adrs,
cs_xbus_req,
empty, cmd_busy,
words_fifo,
// inputs
xbus_valid,
read_adrs,
clk, reset_l
);
output [4:0] wr_adrs;
output cs_xbus_req, empty;
output cmd_busy;
output [5:0] words_fifo;
input xbus_valid;
input [5:0] read_adrs;
input clk, reset_l;
reg [5:0] w_addr_in;
wire [4:0] wr_adrs;
reg cs_xbus_req;
wire empty, unrap;
reg cmd_busy;
wire [5:0] words_fifo;
wire wen;
/*`ifdef jeff_smith_wants_it
always @(w_addr_in)
begin
$display(" %h written into CDBUF", reality.rcp_0.xbus_data);
end
`endif
*/
assign #1 wen = xbus_valid;
always @(posedge clk or negedge reset_l) // things sync with clk
if (reset_l == 1'h0) // write pointer
w_addr_in <= 6'h0;
else
begin
w_addr_in <= wen ? (w_addr_in + 1) : w_addr_in;
// cs_xbus_req <= (words_fifo <= 6'h16);
// cmd_busy <= ~empty;
end
always @(posedge clk)
begin
cs_xbus_req <= (words_fifo <= 6'h16);
cmd_busy <= ~empty;
end
assign wr_adrs = w_addr_in[4:0];
assign empty = words_fifo == 6'h0;
assign unrap = ~w_addr_in[5] & read_adrs[5];
assign words_fifo = {(unrap ^ w_addr_in[5]), w_addr_in[4:0]} -
{(unrap ^ read_adrs[5]), read_adrs[4:0]};
endmodule // csclk