ew.h 5.36 KB
/*
 *  ew.h: edge walker header file
 *
 *
 */

#ifndef EDGE_WALKER_INCLD
#define EDGE_WALKER_INCLD

#include "ints.h"


/*
 *  Edge Walker Memory Structure
 */

typedef struct
{
  /* required by C-sim */
    char *label;  /* label must be first */
    int argc;
    char **argv;
    int gclk_old;

  /*    I n p u t      S i g n a l s    */

    int gclk;

    int64 cs_ew_d;		/* [63:0], data bus from CS */
    int cs_ew_newprim;
    int dxr;			/* [22:0], s,15.7 */
    int dxg;			/* [22:0], s,15.7 */
    int dxb;			/* [22:0], s,15.7 */
    int dxa;			/* [22:0], s,15.7 */
    int dxz;			/* [22:0], s,15.7 */
    int dxs;			/* [22:0], s,15.7 */
    int dxt;			/* [22:0], s,15.7 */
    int dxw;			/* [22:0], s,15.7 */
    int dyr;			/* [22:0], s,15.7 */
    int dyg;			/* [22:0], s,15.7 */
    int dyb;			/* [22:0], s,15.7 */
    int dya;			/* [22:0], s,15.7 */
    int dyz;			/* [22:0], s,15.7 */
    int dys;			/* [22:0], s,15.7 */
    int dyt;			/* [22:0], s,15.7 */
    int dyw;			/* [22:0], s,15.7 */
    int left_xmajor;		/* left major tri flag */
    int left_xminor;		/* left major tri flag */
    int left_offset;		/* left major tri flag */
    int sign_dxhdy_xmajor;
    int sign_dxhdy_offset;
    int width_cimage;		/* [9:0] */
    int width_timage;		/* [9:0] */
    int load_cmd_image;		/* flag  */
    int pixel_size;		/* [1:0] */
    int texel_size;		/* [1:0] */
    int cycle_type;		/* [1:0] */
    int scbox_xmax;		/* [11:0] */
    int scbox_xmin;		/* [11:0] */
    int scbox_ymax;		/* [11:0] */
    int scbox_ymin;		/* [11:0] */
    int load_cmd_scissor;		
    int load_cmd_ewstall;		
    int load_cmd_offset;		
    int sc_field;
    int odd_line;
    int reset_l;
    int flush;
    int load_cmd_tlut;

  /*    O u t p u t    S i g n a l s    */
   
    int ew_cs_busy;
    int ew_cv_d;		/* [12:0] */
    int ew_cv_newspan;
    int ew_cv_start_x;		/* [11:0] */
    int ew_ep_d;		/* [21:0] */
    int ew_ep_startspan;
    int ew_ms_length;		/* [11:0] */
    int ew_ms_addr;		/* [19:0] */
    int y_dither;		/* [1:0], 1 cycle before start_span */

  /*    I n t e r m e d i a t e     S i g n a l s    */

    /* edge walker control signals */
    unsigned int cnt_prim: 5;
    unsigned int cnt_span_x: 4;
    unsigned int cnt_span_attr: 4;
    unsigned int span_valid_x: 1;
    unsigned int new_span_x: 1;
    unsigned int clear_xminor: 1;
    unsigned int wa_addr_m: 4;
    unsigned int wa_addr_s: 4;
    unsigned int add_clear: 1;
    unsigned int add32b: 1;
    unsigned int shuffle_m: 1;
    unsigned int shuffle: 1;
    unsigned int noshuffle_m: 1;
    unsigned int noshuffle: 1;
    unsigned int sel_dydx_m: 4;
    unsigned int sel_dydx_mm: 4;
    unsigned int sel_dydx_mmm: 4;
    unsigned int sel_dydx: 4;
    unsigned int ld_x_frac_m: 1;
    unsigned int ld_x_frac_mm: 1;
    unsigned int ld_x_frac_mmm: 1;
    unsigned int ld_x_frac: 1;
    unsigned int get_new_stall: 1;
    unsigned int ew_stall_x: 1;
    unsigned int cnt_stall: 13;
    unsigned int ew_stall_attr: 1;
    unsigned int ew_stall_attr0d: 1;
    unsigned int ew_stall_attr1d: 1;
    unsigned int ew_stall_attr2d: 1;
    unsigned int ew_stall_attr3d: 1;
    unsigned int ew_stall_attr4d: 1;
    unsigned int ew_stall_attr5d: 1;
    unsigned int ew_stall_attr6d: 1;
    unsigned int ew_stall_attr7d: 1;
    unsigned int ew_stall_attr8d: 1;
    unsigned int sc_field_s: 1;
    unsigned int odd_line_s: 1;
    unsigned int ew_ep_startspan_m: 1;
    unsigned int sel_xval: 1;
    unsigned int y_invalid: 1;
    unsigned int end_ew: 1;
    unsigned int span_valid_s: 1;
    unsigned int span_valid_x_s: 1;
    unsigned int end_prim_state: 2;


    /* dither bits */
    unsigned int y_dither_m: 2;
 
    /* ew adders */
    unsigned int ms_co: 1;
    unsigned int ls_co: 1;
    unsigned int sum_att: 32;

    /* ew memory regs */
    unsigned int ra_data: 32;
    unsigned int rb_data: 32;

    /* ew shuffle regs */
    unsigned int inta_1delay: 16;
    unsigned int fraca_1delay: 16;
    unsigned int fraca_2delay: 16;
    unsigned int intd_1delay: 16;
    unsigned int fracd_1delay: 16;
    unsigned int fracd_2delay: 16;
    unsigned int att_out_s: 32;
             int att_out: 23;		/* s,15.7 */
    unsigned int dade_out_s: 32;
             int dade_out: 23;		/* s,15.7 */

    /* ew offset regs */
    unsigned int x_frac_s: 8;
    int att_d_out;

    /* ew_x_calc registers */
    unsigned int dxhdy: 27;
    unsigned int dxmdy: 27;
    unsigned int dxldy: 27;
    unsigned int xh: 27;	/* s,11.15 */
    unsigned int xm: 27;
    unsigned int xl: 27;
    unsigned int x_sticky: 1;

    /* ew scissor y registers */
    unsigned int ym: 14;    /* s,11.2 */
    unsigned int yh: 14;    /* s,11.2 */
    unsigned int yl: 14;    /* s,11.2 */
    unsigned int y_cur: 14; /* s,11.2 */
    unsigned int xval: 4;

    /* ew scissor x registers */
    unsigned int allxlmin: 1;
    unsigned int allxgemax: 1;
    unsigned int x_major_1d: 20;  	/* s,11.8 */
    unsigned int x_frac: 8;
    unsigned int x_frac_m: 8;
    unsigned int x_frac_mm: 8;
    unsigned int x_sc_max: 12;		/* s,11.0 */
    unsigned int x_sc_min: 12;		/* s,11.0 */
    unsigned int x_sc: 15;

    /* ew span address registers */
    unsigned int cnt_mult: 4;
    unsigned int cnt_addr: 2;
    unsigned int posy_state: 1;
    unsigned int addr_scanline: 20;
 
    unsigned int ld_dxhdy: 1; 

} ew_t;


/*
 *  P r o t o t y p e s
 */

void ew(ew_t **pp0, ew_t **pp1);
void ew_init(ew_t *p0, ew_t *p1);


#endif /* EDGE_WALKER_INCLD */