driver.h 5.32 KB
/*
 *  driver.h, memory structure for BL driver
 *
 *
 *
 */

#ifndef DRIVER_INCLUDE
#define DRIVER_INCLUDE

#define DELAY_ONE		1
#define DELAY_TWO		2
#define DELAY_THREE		3
#define DELAY_FOUR		4
#define DELAY_FIVE		5

/*
 *  Memory structure for driver
 */

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

  /* input */
  int gclk;

  /* output */
    int st_span;
    int ncyc;

    int blend_mask;                     /* [7:0] */
    int z_source_select;
    int antialias_enable;
    int z_compare_enable;
    int z_update_enable;
    int z_mode;                         /* [1:0] */
    int cvg_dest;                       /* [1:0] */
    int color_on_cvg;
    int force_blend;
    int mask15b;

    int bl_p_sel_0_r;                   /* [1:0] */
    int bl_m_sel_0_r;                   /* [1:0] */
    int bl_a_sel_0_r;                   /* [1:0] */
    int bl_b_sel_0_r;                   /* [1:0] */
    int bl_p_sel_1_r;                   /* [1:0] */
    int bl_m_sel_1_r;                   /* [1:0] */
    int bl_a_sel_1_r;                   /* [1:0] */
    int bl_b_sel_1_r;                   /* [1:0] */

    int blend_r;                        /* [7:0] */
    int blend_g;                        /* [7:0] */
    int blend_b;                        /* [7:0] */

    int fog_r;                          /* [7:0] */
    int fog_g;                          /* [7:0] */
    int fog_b;                          /* [7:0] */
    int fog_a;                          /* [7:0] */

    int pixel_r;                        /* [7:0] */
    int pixel_g;                        /* [7:0] */
    int pixel_b;                        /* [7:0] */
    int pixel_a;                        /* [8:0] */

    int pixel_cvg;                      /* [3:0], 1.3 */

    int shade_a;                        /* [7:0] */

    int st_z;                           /* [17:0], 15.3 */

    int dzdx;                           /* [15:0], s0.15 */
    int dzdy;                           /* [15:0], s0.15 */

    int prim_z;                         /* [15:0] */
    int prim_delta_z;                   /* [15:0] */

    int mem_r;                          /* [7:0] */
    int mem_g;                          /* [7:0] */
    int mem_b;                          /* [7:0] */
    int mem_a;                          /* [2:0] */
    int mem_z;                          /* [17:0], float format:
                                           [17:15] exponent, [14:4] mantissa,
                                           [3:0] delta_z
                                        */

    int dv;				/* for validating output, not in Verilog */

    /* delay registers */

    int blend_mask_dly[DELAY_FOUR];                     /* [7:0] */
    int z_source_select_dly[DELAY_ONE];
    int antialias_enable_dly[DELAY_THREE];
    int z_compare_enable_dly[DELAY_THREE];
    int z_update_enable_dly[DELAY_THREE];
    int z_mode_dly[DELAY_THREE];                         /* [1:0] */
    int cvg_dest_dly[DELAY_FOUR];                       /* [1:0] */
    int color_on_cvg_dly[DELAY_FOUR];
    int force_blend_dly[DELAY_THREE];
    int mask15b_dly[DELAY_THREE];

    int bl_p_sel_0_r_dly[DELAY_ONE];                   /* [1:0] */
    int bl_m_sel_0_r_dly[DELAY_ONE];                   /* [1:0] */
    int bl_a_sel_0_r_dly[DELAY_ONE];                   /* [1:0] */
    int bl_b_sel_0_r_dly[DELAY_ONE];                   /* [1:0] */
    int bl_p_sel_1_r_dly[DELAY_ONE];                   /* [1:0] */
    int bl_m_sel_1_r_dly[DELAY_ONE];                   /* [1:0] */
    int bl_a_sel_1_r_dly[DELAY_ONE];                   /* [1:0] */
    int bl_b_sel_1_r_dly[DELAY_ONE];                   /* [1:0] */

    int blend_r_dly[DELAY_TWO];                        /* [7:0] */
    int blend_g_dly[DELAY_TWO];                        /* [7:0] */
    int blend_b_dly[DELAY_TWO];                        /* [7:0] */

    int fog_r_dly[DELAY_TWO];                          /* [7:0] */
    int fog_g_dly[DELAY_TWO];                          /* [7:0] */
    int fog_b_dly[DELAY_TWO];                          /* [7:0] */
    int fog_a_dly[DELAY_TWO];                          /* [7:0] */

    int pixel_r_dly[DELAY_TWO];                        /* [7:0] */
    int pixel_g_dly[DELAY_TWO];                        /* [7:0] */
    int pixel_b_dly[DELAY_TWO];                        /* [7:0] */
    int pixel_a_dly[DELAY_TWO];                        /* [8:0] */

    int pixel_cvg_dly[DELAY_TWO];                      /* [3:0], 1.3 */

    int shade_a_dly[DELAY_TWO];                        /* [7:0] */

    int st_z_dly[DELAY_TWO];                           /* [17:0], 15.3 */

    int dzdx_dly[DELAY_ONE];                           /* [15:0], s0.15 */
    int dzdy_dly[DELAY_ONE];                           /* [15:0], s0.15 */

    int prim_z_dly[DELAY_TWO];                         /* [15:0] */
    int prim_delta_z_dly[DELAY_ONE];                   /* [15:0] */

    int mem_r_dly[DELAY_TWO];                          /* [7:0] */
    int mem_g_dly[DELAY_TWO];                          /* [7:0] */
    int mem_b_dly[DELAY_TWO];                          /* [7:0] */
    int mem_a_dly[DELAY_TWO];                          /* [2:0] */
    int mem_z_dly[DELAY_ONE];

    int dv_dly[DELAY_FIVE];
} driver_t;


/*
 *  Prototypes
 */
void driver(driver_t **pp0, driver_t **pp1);
void driver_init(driver_t *p0, driver_t *p1);

#endif /* DRIVER_INCLUDE */