at_ms.v
4.14 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/**************************************************************************
* *
* 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: at_ms.v,v 1.1.1.1 2002/05/17 06:07:44 blythe Exp $
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: at_ms
// description: Attribute buffers for memspan unit. Unlike the other
// attribute buffers, this is a true fifo of data sampled
// during ew_ep_startspan, when the end address is on
// the ew_addr bus. The start address and count are piped
// one stage to line up with end. The other inputs are
// piped 4 stages in the edge walker to avoid overwriting
// the last span of the previous primitive, and are sampled
// with the other bits. The spanbufrd input pops the fifo.
// The spanbufmt output is true if either the fifo is
// truely empty, or of a span address overlap is detected,
// in which case a delay is inserted before letting the
// memspan have the span request packet, to allow time for
// the offending span to be physically written to memory
// before the colliding span is read into the spanbuf.
//
// designer: Phil Gossett
// date: 11/18/94
//
////////////////////////////////////////////////////////////////////////
module at_ms (clk, gclk, reset_l, ew_ep_startspan,
ew_addr, ew_length, ew_load, ew_load_tlut, ew_left, spanbufrd,
ms_xi, ms_xf, ms_count, ms_load, ms_load_tlut, ms_xdec, spanbufmt);
input clk;
input gclk;
input reset_l;
input ew_ep_startspan;
input [19:0] ew_addr;
input [11:0] ew_length;
input ew_load;
input ew_load_tlut;
input ew_left;
input spanbufrd;
output [19:0] ms_xi; // from ew (fifo)
output [11:0] ms_xf; // from ew (fifo)
output [11:0] ms_count; // from ew (fifo)
output ms_load; // tile(34),block(33),tlut(30) (pipe, fifo)
output ms_load_tlut; // tlut(30) (pipe, fifo)
output ms_xdec; // primitives (36,24,25,0f-08) (pipe, fifo)
output spanbufmt;
reg [11:0] reg_count;
reg [19:0] reg_xi;
wire [63:0] d_lat; // delayed latched input
wire [1:0] span_wrp; // write pointer
wire span_a_g;
wire span_b_g;
wire span_c_g;
wire span_d_g;
wire [55:0] span_a; // latch outputs
wire [55:0] span_b;
wire [55:0] span_c;
wire [55:0] span_d;
wire [1:0] span_sel; // read counter select
wire reset;
// invert reset (this week)
assign reset = ~reset_l;
// delay start and count to line up with end and startspan
always @(posedge gclk)
begin
reg_xi <= ew_addr;
reg_count <= ew_length;
end
// generate latch enable for fifo
at_ctw4 ctspang (.clk(gclk), .rst(reset), .enb(ew_ep_startspan), .z(span_wrp),
.a(span_a_g), .b(span_b_g), .c(span_c_g), .d(span_d_g));
// instanciated latches
at_latch64 dlat (.clkn( gclk),
.i({17'b0,~ew_left,ew_load,ew_load_tlut,reg_count,reg_xi,ew_addr[11:0]}),
.z(d_lat));
at_latch56 spana (.clk(gclk), .g(span_a_g), .i(d_lat[55:0]), .z(span_a));
at_latch56 spanb (.clk(gclk), .g(span_b_g), .i(d_lat[55:0]), .z(span_b));
at_latch56 spanc (.clk(gclk), .g(span_c_g), .i(d_lat[55:0]), .z(span_c));
at_latch56 spand (.clk(gclk), .g(span_d_g), .i(d_lat[55:0]), .z(span_d));
// generate read pointer for fifo
at_ctr4 ctspans (.clk(clk), .rst(reset), .enb(spanbufrd), .z(span_sel));
// read latches with bit assignments and padding (unused latches eaten)
assign {ms_xdec,ms_load,ms_load_tlut,ms_count,ms_xi,ms_xf} =
span_sel[1] ?
(span_sel[0] ? span_d[54:0] : span_c[54:0]) :
(span_sel[0] ? span_b[54:0] : span_a[54:0]);
assign spanbufmt = (span_wrp == span_sel);
endmodule // at_ms