at.v 10.6 KB
/**************************************************************************
 *                                                                        *
 *               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.1.1.1 2002/05/17 06:14:57 blythe 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, 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 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 (	.gclk(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 (	.gclk(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 (	.gclk(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 (	.gclk(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), .gclk(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