Blame view

hw/chip/bcp/at/src/at.v 10.7 KB
root committed
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 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
/**************************************************************************
 *                                                                        *
 *               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.v,v 1.2 2002/11/22 00:34:19 rws Exp $

////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module:      at
// description: Top level for attribute buffers. Primitives data updates
//		the cycle before it is needed (via mux), but is only used
//		the following cycle. Hardware synchronized attribute data
//		is updated the cycle of the attribute (via mux), but is
//		only used the following cycle, which lines up with the
//		first cycle of a following primitive. QTV will barf on
//		this, since it will see the update cycle as not making
//		timing, while only the following cycle really matters.
//		Unsynchronized attributes update immediately, producing
//		trash for one cycle, followed by good data the next cycle.
//		The csim should generate garbage (0xDEADBEEF, for example)
//		during this trashed update cycle. Some logically synced
//		data require no special buffering because the timing
//		just works out (scissor, the EW dx's and dy's). Unsynced
//		attributes must be maintained by software, using the
//		sync_tile and sync_pipe commands after the last primitive
//		before any unsynced attribute update commands if necessary.
//
// designer:    Phil Gossett
// date:        6/7/95
//
////////////////////////////////////////////////////////////////////////

module at (clk, start_gclk, reset_l, ew_ep_startspan,
	cs_st_prim, cs_st_attr, cs_cmd, cs_ew_d, ew_cs_busy,
	ew_addr, ew_length, spanbufrd,
	ew_dxr, ew_dxg, ew_dxb, ew_dxa,
	ew_dxz, ew_dxs, ew_dxt, ew_dxw,
	ew_dyr, ew_dyg, ew_dyb, ew_dya,
	ew_dyz, ew_dys, ew_dyt, ew_dyw,
	st_dxr, st_dxg, st_dxb, st_dxa,
	st_dxz, st_dxs, st_dxt, st_dxw,
	st_dyr, st_dyg, st_dyb, st_dya,
	st_dyz, st_dys, st_dyt, st_dyw,
	st_ncyc, color_image, z_image, tex_image, combine_mode,
	env_color, prim_color, blend_color, fog_color, fill_color,
	other_modes, prim_depth, scissor, convert, key_r, key_gb,
	noise, strobe_sync_full,
	rel_sync_tile, rel_sync_pipe, rel_sync_load,
	ew_image_load, ew_scissor_load, ew_stall_load, ew_offset_load,
	tc_load, shift_coord, level, tile, ew_major_sign, ew_offset_sign,
	ew_major_left, ew_minor_left, ew_offset_left, cv_left,
	st_r_left, st_g_left, st_b_left, st_a_left, st_z_left,
	st_s_left, st_t_left, st_w_left,
	ms_xi, ms_xf, ms_count, ms_load, ms_load_tlut, ms_xdec, spanbufmt,
	ew_stall_tlut, at_cs_busy);


input clk;
input start_gclk;
input reset_l;
input ew_ep_startspan;
input cs_st_prim;
input cs_st_attr;
input [5:0] cs_cmd;
input [63:0] cs_ew_d;
input ew_cs_busy;
input [19:0] ew_addr;
input [11:0] ew_length;
input spanbufrd;

output [22:0] ew_dxr;		// s15.7  (single buffer)
output [22:0] ew_dxg;		// s15.7  (single buffer)
output [22:0] ew_dxb;		// s15.7  (single buffer)
output [22:0] ew_dxa;		// s15.7  (single buffer)
output [22:0] ew_dxz;		// s15.7  (single buffer)
output [22:0] ew_dxs;		// s15.7  (single buffer)
output [22:0] ew_dxt;		// s15.7  (single buffer)
output [22:0] ew_dxw;		// s15.7  (single buffer)
output [22:0] ew_dyr;		// s15.7  (single buffer)
output [22:0] ew_dyg;		// s15.7  (single buffer)
output [22:0] ew_dyb;		// s15.7  (single buffer)
output [22:0] ew_dya;		// s15.7  (single buffer)
output [22:0] ew_dyz;		// s15.7  (single buffer)
output [22:0] ew_dys;		// s15.7  (single buffer)
output [22:0] ew_dyt;		// s15.7  (single buffer)
output [22:0] ew_dyw;		// s15.7  (single buffer)
output [21:0] st_dxr;		// s10.11 (quad buffer)
output [21:0] st_dxg;		// s10.11 (quad buffer)
output [21:0] st_dxb;		// s10.11 (quad buffer)
output [21:0] st_dxa;		// s10.11 (quad buffer)
output [31:0] st_dxz;		// s15.16 (quad buffer)
output [26:0] st_dxs;		// s15.11 (double buffer)
output [26:0] st_dxt;		// s15.11 (double buffer)
output [26:0] st_dxw;		// s15.11 (double buffer)
output [12:0] st_dyr;		// s10.2  (triple buffer)
output [12:0] st_dyg;		// s10.2  (triple buffer)
output [12:0] st_dyb;		// s10.2  (triple buffer)
output [12:0] st_dya;		// s10.2  (triple buffer)
output [21:0] st_dyz;		// s15.6  (triple buffer)
output [16:0] st_dys;		// s15.1  (single buffer)
output [16:0] st_dyt;		// s15.1  (single buffer)
output [16:0] st_dyw;		// s15.1  (single buffer)
output st_ncyc;			// ncyc for s,t steppers (load overrides)
output [55:0] color_image;	// 3f 55:51, 43:32, 25:0 (unsynced)
output [55:0] z_image;		// 3e               25:0 (unsynced)
output [55:0] tex_image;	// 3d 55:51, 43:32, 25:0 (unsynced)
output [55:0] combine_mode;	// 3c 55:0		 (unsynced)
output [55:0] env_color;	// 3b 31:0		 (unsynced)
output [55:0] prim_color;	// 3a 47:40, 39:0	 (quad buffer)
output [55:0] blend_color;	// 39 31:0		 (unsynced)
output [55:0] fog_color;	// 38 31:0		 (unsynced)
output [55:0] fill_color;	// 37 31:0		 (unsynced)
output [55:0] other_modes;	// 2f 53:0		 (unsynced)
output [55:0] prim_depth;	// 2e 31:16, 15:0	 (quad buffer)
output [55:0] scissor;		// 2d 55:32, 25:0	 (single buffer)
output [55:0] convert;		// 2c 53:0		 (unsynced)
output [55:0] key_r;		// 2b 27:0		 (unsynced)
output [55:0] key_gb;		// 2a 55:0		 (unsynced)
output [8:0] noise;		// pseudo-random noise	 (shift registers)
output strobe_sync_full;	// 29			 (counter)
output rel_sync_tile;		// 28			 (counter)
output rel_sync_pipe;		// 27			 (counter)
output rel_sync_load;		// 31			 (counter)
output ew_image_load;		// tile(34),block(33),tlut(30) (pipe)
output ew_scissor_load;		// tile(34),block(33),tlut(30) (pipe)
output ew_stall_load;		// tile(34),block(33),tlut(30) (pipe)
output ew_offset_load;		// tile(34),block(33),tlut(30) (pipe)
output tc_load;			// tile(34),block(33),tlut(30) (pipe)
output shift_coord;		// load_block(33),tlut(34)     (quad buffer)
output [2:0] level;		// primitives (36,24,25,0f-08) (quad buffer)
output [2:0] tile;		// primitives (36,24,25,0f-08) (quad buffer)
output ew_major_sign;		// primitives (36,24,25,0f-08) (pipe)
output ew_offset_sign;		// primitives (36,24,25,0f-08) (pipe)
output ew_major_left;		// primitives (36,24,25,0f-08) (pipe)
output ew_minor_left;		// primitives (36,24,25,0f-08) (pipe)
output ew_offset_left;		// primitives (36,24,25,0f-08) (pipe)
output cv_left;			// primitives (36,24,25,0f-08) (pipe)
output st_r_left;		// primitives (36,24,25,0f-08) (pipe)
output st_g_left;		// primitives (36,24,25,0f-08) (pipe)
output st_b_left;		// primitives (36,24,25,0f-08) (pipe)
output st_a_left;		// primitives (36,24,25,0f-08) (pipe)
output st_z_left;		// primitives (36,24,25,0f-08) (pipe)
output st_s_left;		// primitives (36,24,25,0f-08) (pipe)
output st_t_left;		// primitives (36,24,25,0f-08) (pipe)
output st_w_left;		// primitives (36,24,25,0f-08) (pipe)
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;		// span fifo empty
output ew_stall_tlut;		// tlut(30)                    (pipe, fifo)
output at_cs_busy;		// extended version of ew_cs_busy (counter)

wire ew_scissor_tlut;		// tlut(30)                    (pipe)

at_ew atew (	.clk(clk), .start_gclk(start_gclk),
		.reset_l(reset_l), .ncyc(other_modes[52]),
		.atomic(other_modes[55]), .ew_ep_startspan(ew_ep_startspan),
		.cs_st_prim(cs_st_prim), .cs_st_attr(cs_st_attr),
		.cs_cmd(cs_cmd), .cs_ew_d(cs_ew_d), .ew_cs_busy(ew_cs_busy),
		.ew_dxr(ew_dxr), .ew_dxg(ew_dxg),
		.ew_dxb(ew_dxb), .ew_dxa(ew_dxa), .ew_dxz(ew_dxz),
		.ew_dxs(ew_dxs), .ew_dxt(ew_dxt),
		.ew_dxw(ew_dxw),
		.ew_dyr(ew_dyr), .ew_dyg(ew_dyg),
		.ew_dyb(ew_dyb), .ew_dya(ew_dya), .ew_dyz(ew_dyz),
		.ew_dys(ew_dys), .ew_dyt(ew_dyt),
		.ew_dyw(ew_dyw),
		.scissor(scissor), .strobe_sync_full(strobe_sync_full),
		.rel_sync_tile(rel_sync_tile), .rel_sync_pipe(rel_sync_pipe),
		.rel_sync_load(rel_sync_load),
		.ew_image_load(ew_image_load),
		.ew_scissor_load(ew_scissor_load),
		.ew_stall_load(ew_stall_load),
		.ew_offset_load(ew_offset_load),
		.tc_load(tc_load), .st_ncyc(st_ncyc),
		.ew_major_sign(ew_major_sign), .ew_offset_sign(ew_offset_sign),
		.ew_major_left(ew_major_left), .ew_minor_left(ew_minor_left),
		.ew_offset_left(ew_offset_left), .cv_left(cv_left),
	        .st_r_left(st_r_left), .st_g_left(st_g_left),
		.st_b_left(st_b_left), .st_a_left(st_a_left),
		.st_z_left(st_z_left),
	        .st_s_left(st_s_left), .st_t_left(st_t_left),
		.st_w_left(st_w_left),
		.ew_scissor_tlut(ew_scissor_tlut),
		.ew_stall_tlut(ew_stall_tlut),
		.at_cs_busy(at_cs_busy));

assign st_dys = ew_dys[22:6];
assign st_dyt = ew_dyt[22:6];
assign st_dyw = ew_dyw[22:6];

at_tc attc (	.clk(clk), .start_gclk(start_gclk), .reset_l(reset_l),
		.cs_st_prim(cs_st_prim), .cs_st_attr(cs_st_attr),
		.cs_cmd(cs_cmd), .cs_ew_d(cs_ew_d),
		.st_dxs(st_dxs), .st_dxt(st_dxt),
		.st_dxw(st_dxw),
		.shift_coord(shift_coord), .level(level), .tile(tile));

at_cc atcc (	.clk(clk), .start_gclk(start_gclk), .reset_l(reset_l),
		.cs_st_prim(cs_st_prim), .cs_st_attr(cs_st_attr),
		.cs_cmd(cs_cmd), .cs_ew_d(cs_ew_d),
		.st_dxr(st_dxr), .st_dxg(st_dxg),
		.st_dxb(st_dxb), .st_dxa(st_dxa),
		.st_dyr(st_dyr), .st_dyg(st_dyg),
		.st_dyb(st_dyb), .st_dya(st_dya),
		.combine_mode(combine_mode), .env_color(env_color),
		.prim_color(prim_color), .convert(convert),
		.key_r(key_r), .key_gb(key_gb), .noise(noise));

at_bl atbl (	.clk(clk), .start_gclk(start_gclk), .reset_l(reset_l),
		.cs_st_prim(cs_st_prim), .cs_st_attr(cs_st_attr),
		.cs_cmd(cs_cmd), .cs_ew_d(cs_ew_d),
		.st_dxz(st_dxz), .st_dyz(st_dyz),
		.color_image(color_image), .z_image(z_image),
		.tex_image(tex_image), .blend_color(blend_color),
		.fog_color(fog_color), .fill_color(fill_color),
		.other_modes(other_modes), .prim_depth(prim_depth));

at_ms atms (	.clk(clk), .start_gclk(start_gclk), .reset_l(reset_l),
		.ew_ep_startspan(ew_ep_startspan),
		.ew_addr(ew_addr), .ew_length(ew_length),
		.ew_load(ew_scissor_load), .ew_load_tlut(ew_scissor_tlut),
		.ew_left(ew_major_left), .spanbufrd(spanbufrd),
		.ms_xi(ms_xi), .ms_xf(ms_xf), .ms_count(ms_count),
		.ms_load(ms_load), .ms_load_tlut(ms_load_tlut),
		.ms_xdec(ms_xdec), .spanbufmt(spanbufmt));

endmodule // at