ew.v 9.44 KB
/**************************************************************************
 *                                                                        *
 *               Copyright (C) 1994, Silicon Graphi, 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: ew.v,v 1.2 2002/11/22 00:34:20 rws Exp $

   /////////////////////////////////////////////////////////////////////////
   //
   // Project Reality
   //
   // module:      ew
   // description: Edge walker top leve module
   //   
   //
   // designer:    Mike M. Cai   6/23/94
   //
   /////////////////////////////////////////////////////////////////////////
`timescale 100 ps / 100 ps
module ew(     ew_cs_busy,
      	       ew_cv_d, ew_cv_newspan, 
      	       ew_cv_start_x, ew_ms_length,
      	       ew_ep_d, ew_ep_startspan,
	       ew_ms_addr,
	       y_dither,
	       cs_ew_d, cs_ew_newprim, 
	       dxr, dxg, dxb, dxa, dxz, dxs, dxt, dxw, // dxl,
	       dyr, dyg, dyb, dya, dyz, dys, dyt, dyw, // dyl,
	       left_xmajor, left_xminor, left_offset, 
	       sign_dxhdy_xmajor, sign_dxhdy_offset,
	       width_cimage, width_timage,
	       load_cmd_image,
	       pixel_size, texel_size, cycle_type,
	       scbox_xmax, scbox_xmin,
	       scbox_ymax, scbox_ymin,
	       load_cmd_scissor, load_cmd_ewstall, load_cmd_offset,
	       load_cmd_tlut,
	       sc_field, odd_line, flush,
	       reset_l, start_gclk, clk
	       );
output	       ew_cs_busy;
output [12:0]  ew_cv_d;
output	       ew_cv_newspan;
output [11:0]  ew_cv_start_x, ew_ms_length;
output [21:0]  ew_ep_d;
output	       ew_ep_startspan;
output [19:0]  ew_ms_addr;
output [1:0]   y_dither;
// output	       end_prim, cancel_span;
input [63:0]   cs_ew_d;
input 	       cs_ew_newprim;
input [22:0]   dxr, dxg, dxb, dxa, dxz, dxs, dxt, dxw, // dxl,
	       dyr, dyg, dyb, dya, dyz, dys, dyt, dyw; // dyl;
input 	       left_xmajor, left_xminor, left_offset;
input 	       sign_dxhdy_xmajor, sign_dxhdy_offset;
input [9:0]    width_cimage, width_timage;
input 	       load_cmd_image;
input [1:0]    pixel_size, texel_size, cycle_type;
input [11:0]   scbox_xmax, scbox_xmin,
	       scbox_ymax, scbox_ymin;
input 	       load_cmd_scissor, load_cmd_ewstall, load_cmd_offset; 
input 	       load_cmd_tlut;
input 	       sc_field, odd_line, flush;
input 	       reset_l, start_gclk, clk;


// ewatt output
wire [21:0]    ew_ep_d;

// ewras outputs
wire [12:0]    ew_cv_d;
wire [11:0]    x_major, x_minor, x_sc_major;
wire [11:0]    x_sc_max, x_sc_min;
wire [7:0]     x_frac;
wire	       allxlmin, allxgemax;
wire	       equal_ym, end_prim_y;
wire 	       allx_invalid;
wire [11:0]    yh;
wire	       y_cur_lsb;
wire [1:0]     y_dither;

// ewaddr outputs
wire [19:0]    ew_ms_addr;

//ewctr output
wire 	       	  ew_cs_busy;
wire	       	  ew_cv_newspan;
wire [11:0]  	  ew_ms_length;
wire	       	  ew_ep_startspan;
wire		  ld_xmh, ld_dxmdy, ld_dxhdy, ld_dxldy;
wire		  switch_xl, ld_y, count_y, shift_xval;
wire		  sel_xval;
wire		  ld_xmajor;
wire		  clear_allxgemax;
wire		  clear_xminor;
wire		  ld_a;
wire [3:0]	  ra_addr, rb_addr;
wire [3:0]	  wa_addr, wde_addr;
wire	       	  wen_a, wen_de;
wire		  add_clear, add32b;
wire		  shuffle, noshuffle;
wire [3:0]	  sel_dydx;
wire		  ld_x_frac;
wire		  ew_stall_attr, ew_stall_x;
wire  	       	  start_mult, addr_newspan;
wire  	       	  cmp_cross_valid;

ewatt walkatt( // outputs
      	       .ew_ep_d(ew_ep_d), 
	       // inputs
      	       .cs_ew_data(cs_ew_d[63:32]),
      	       .dxr(dxr), .dxg(dxg), .dxb(dxb), .dxa(dxa), .dxz(dxz),
	       .dxs(dxs), .dxt(dxt), .dxw(dxw), // .dxl(dxl),
	       .dyr(dyr), .dyg(dyg), .dyb(dyb), .dya(dya), .dyz(dyz),
	       .dys(dys), .dyt(dyt), .dyw(dyw), // .dyl(dyl),
	       .x_frac(x_frac), .ld_x_frac(ld_x_frac),
	       .wa_addr(wa_addr), .wen_a(wen_a), 
	       .wde_addr(wde_addr), .wen_de(wen_de),
	       .ra_addr(ra_addr), .rb_addr(rb_addr), 
	       .add32b(add32b), .add_clear(add_clear), .ld_a(ld_a),
	       .shuffle(shuffle), .noshuffle(noshuffle),
	       .seldy(sel_dydx), .ew_stall_attr(ew_stall_attr),
	       .left(left_offset), .sign_dxdy(sign_dxhdy_offset), 
	       .cycle_type(cycle_type), .load_cmd(load_cmd_offset),
 	       .clk(clk), .start_gclk(start_gclk)
	       );


ewras rasterizer( // outputs
      	       	  .ew_cv_d(ew_cv_d), 
		  .x_major(x_major), .x_frac(x_frac),
		  .x_minor(x_minor), .x_sc_major(x_sc_major), 
		  .x_sc_max(x_sc_max), .x_sc_min(x_sc_min), 
		  .allxlmin(allxlmin), .allxgemax(allxgemax),
		  .equal_ym(equal_ym),
		  .end_prim_y(end_prim_y),
		  .allx_invalid(allx_invalid),
		  .yh(yh), .y_cur_lsb(y_cur_lsb),
		  .y_dither(y_dither),
		  // inputs
		  .cs_ew_d(cs_ew_d), .switch_xl(switch_xl),
      	       	  .ld_xmh(ld_xmh), .ld_dxmdy(ld_dxmdy), 
		  .ld_dxldy(ld_dxldy), .ld_dxhdy(ld_dxhdy),
		  .scbox_xmax(scbox_xmax), .scbox_xmin(scbox_xmin),
		  .scbox_ymax(scbox_ymax), .scbox_ymin(scbox_ymin),
		  .sel_xval(sel_xval),
		  .ld_xmajor(ld_xmajor), 
		  .clear_allxgemax(clear_allxgemax),
		  .clear_xminor(clear_xminor),
		  .load_cmd_scissor(load_cmd_scissor), .left_xminor(left_xminor),
		  .ew_stall_x(ew_stall_x),
      	       	  .ld_y(ld_y),
		  .count_y(count_y), .shift_xval(shift_xval),
		  .flush(flush), 
		  .left_xmajor(left_xmajor), .cmp_cross_valid(cmp_cross_valid),
		  .sc_field(sc_field),
		  .reset_l(reset_l),
		  .clk(clk), .start_gclk(start_gclk)
		    );


/*
ewx   computex(	  // outputs
      	       	  .x(x_unsc), .x_sticky(x_sticky),
		  //inputs
      	       	  .cs_ew_d(cs_ew_d), .switch_xl(switch_xl),
      	       	  .ld_xmh(ld_xmh), .ld_dxmdy(ld_dxmdy), 
		  .ld_dxldy(ld_dxldy), .ld_dxhdy(ld_dxhdy),
		  .clk(clk), .start_gclk(start_gclk));

ewscx scissorx(	  // outputs
      	       	  .x_sc(ew_cv_d), 
		  .x_major(x_major), .x_frac(x_frac),
		  .x_minor(x_minor), .x_sc_major(x_sc_major), 
		  .allxlmin(allxlmin), .allxgemax(allxgemax),
		  // inputs
      	       	  .x_unsc(x_unsc), .x_sticky(x_sticky),
		  .xval(xval), .sel_xval(sel_xval),
		  .scbox_xmax(scbox_xmax), .scbox_xmin(scbox_xmin),
      	       	  .ld_xmajor(ld_xmajor), 
		  .clear_allxgemax(clear_allxgemax),
		  .clear_xminor(clear_xminor),
		  .y_invalid(y_invalid),
		  .load_cmd(load_cmd_scissor), .left(left_xminor),
		  .ew_stall_x(ew_stall_x), .reset_l(reset_l), .clk(clk), .start_gclk(start_gclk) );

ewscy scissory(	  // outputs
      	       	  .equal_ym(equal_ym),
		  .end_prim_y(end_prim_y),
		  .xval(xval), .allx_invalid(allx_invalid),
		  .y_invalid(y_invalid),
		  .yh_2ms(yh), .y_cur_lsb(y_cur_lsb),
		  // inputs
		  .cs_ew_d(cs_ew_d), 
		  .ld_y(ld_y),
		  .scbox_ymax(scbox_ymax), .scbox_ymin(scbox_ymin),
		  .count_y(count_y), .shift_xval(shift_xval),
		  .load_cmd(load_cmd_scissor), .flush(flush), .clk(clk), .start_gclk(start_gclk));
*/
ewaddr address(	  // outputs
      	       	  .ew_ms_addr(ew_ms_addr), 
      	       	  // inputs
      	       	  .width_cimage(width_cimage), 
		  .width_timage(width_timage),
		  .load_cmd_image(load_cmd_image),
		  .x_sc_major(x_sc_major),
		  .x_minor(x_minor),
		  .yh(yh),
      	       	  .start_mult(start_mult),
		  .addr_newspan(addr_newspan),
		  .reset_l(reset_l),
		 .clk(clk), .start_gclk(start_gclk)
			);

ewctr control( // outputs
      	       .prim_busy(ew_cs_busy),
	       .ew_cv_newspan(ew_cv_newspan),
	       .ew_ms_length(ew_ms_length),
	       .ew_ep_startspan(ew_ep_startspan),
      	       .ld_xmh(ld_xmh), 
	       .ld_dxmdy(ld_dxmdy),
      	       .ld_dxldy(ld_dxldy), 
	       .ld_dxhdy(ld_dxhdy), 
	       .switch_xl(switch_xl),
	       .ld_y(ld_y), .count_y(count_y), .shift_xval(shift_xval),
	       .sel_xval(sel_xval),
	       .ld_xmajor(ld_xmajor),
	       .clear_allxgemax(clear_allxgemax),
	       .clear_xminor(clear_xminor),
	       .ld_a(ld_a),
	       .ra_addr(ra_addr), .rb_addr(rb_addr),
	       .wa_addr(wa_addr), .wde_addr(wde_addr),
	       .wen_a(wen_a), .wen_de(wen_de),
	       .add_clear(add_clear), .add32b(add32b),
	       .shuffle(shuffle), .noshuffle(noshuffle),
	       .sel_dydx(sel_dydx), 
	       .ld_x_frac(ld_x_frac),
	       .ew_stall_attr(ew_stall_attr), .ew_stall_x(ew_stall_x),
	       .start_mult(start_mult), .addr_newspan(addr_newspan),
	       .cmp_cross_valid(cmp_cross_valid),
	       // input
	       .x_major(x_major), 
	       .x_sc_max(x_sc_max), .x_sc_min(x_sc_min),
	       .allxlmin(allxlmin), .allxgemax(allxgemax),
	       .end_prim_y(end_prim_y), .equal_ym(equal_ym),
	       .allx_invalid(allx_invalid), 
	       .left_xmajor(left_xmajor), .left_xminor(left_xminor), 
	       .sign_dxhdy(sign_dxhdy_xmajor),
	       .cs_ew_newprim(cs_ew_newprim), 
	       .load_cmd(load_cmd_ewstall), 
	       .load_cmd_scissor(load_cmd_scissor), 
	       .load_cmd_tlut(load_cmd_tlut),
	       .cycle_type(cycle_type), 
	       .texel_size(texel_size),
	       .pixel_size(pixel_size),
	       .sc_field(sc_field), .odd_line(odd_line), 
	       .y_cur_lsb(y_cur_lsb), .flush(flush),
	       .reset_l(reset_l),
		 .clk(clk), .start_gclk(start_gclk)
		);

assign  ew_cv_start_x = x_major;	       
	       
endmodule  //  ew