inp000.c 4.66 KB
/*
 *  inp000.c: quick check of texture filter
 */
#include <stdio.h>


/*
 *  Signals
 */
int st_span;        /* start of span */
int ncyc;           /* number of cycles per pixel */
int bilerp0m;       /* cycle 0 mode bit */
int bilerp1m;       /* cycle 1 mode bit */
int convert_one;    /* loopback mode */
int mid_texel;      /* mid mode (for 4 texel avg) */

int k0_coeff;       /* [8:0], color convert coeffs */
int k1_coeff;       /* [8:0], color convert coeffs */
int k2_coeff;       /* [8:0], color convert coeffs */
int k3_coeff;       /* [8:0], color convert coeffs */

int lod_frac;       /* [8:0], s,8.0, pipe through to CCU */
int lge1;           /* lod >= 1.0 */

int sfrac_rg;       /* [7:0], 0.8, bilerp alphas */
int tfrac_rg;       /* [7:0], 0.8, bilerp alphas */
int sfrac_ba;       /* [7:0], 0.8, bilerp alphas */
int tfrac_ba;       /* [7:0], 0.8, bilerp alphas */

int tm_ra;          /* [8:0], s,8.0, texel A */
int tm_ga;
int tm_ba;
int tm_aa;

int tm_rb;          /* [8:0], s,8.0, texel B */
int tm_gb;
int tm_bb;
int tm_ab;

int tm_rc;          /* [8:0], s,8.0, texel C */
int tm_gc;
int tm_bc;
int tm_ac;

int tm_rd;          /* [8:0], s,8.0, texel D */
int tm_gd;
int tm_bd;
int tm_ad;

int dv;


/*
 *  Prints header info for input signals, same for all dumps
 */
static void
  print_input_header( void )
{
  printf("gclk @C 1(8) 0(8)\n");
  printf("st_span @I @E 0\n");
  printf("ncyc @I @E 0\n");
  printf("bilerp0m @I @E 0\n");
  printf("bilerp1m @I @E 0\n");
  printf("convert_one @I @E 0\n");
  printf("mid_texel @I @E 0\n");
  printf("k0_coeff[8:0] @I @E 0\n");
  printf("k1_coeff[8:0] @I @E 0\n");
  printf("k2_coeff[8:0] @I @E 0\n");
  printf("k3_coeff[8:0] @I @E 0\n");
  printf("lod_frac[8:0] @I @E 0\n");
  printf("lge1 @I @E 0\n");
  printf("sfrac_rg[7:0] @I @E 0\n");
  printf("tfrac_rg[7:0] @I @E 0\n");
  printf("sfrac_ba[7:0] @I @E 0\n");
  printf("tfrac_ba[7:0] @I @E 0\n");
  printf("tm_ra[8:0] @I @E 0\n");
  printf("tm_ga[8:0] @I @E 0\n");
  printf("tm_ba[8:0] @I @E 0\n");
  printf("tm_aa[8:0] @I @E 0\n");
  printf("tm_rb[8:0] @I @E 0\n");
  printf("tm_gb[8:0] @I @E 0\n");
  printf("tm_bb[8:0] @I @E 0\n");
  printf("tm_ab[8:0] @I @E 0\n");
  printf("tm_rc[8:0] @I @E 0\n");
  printf("tm_gc[8:0] @I @E 0\n");
  printf("tm_bc[8:0] @I @E 0\n");
  printf("tm_ac[8:0] @I @E 0\n");
  printf("tm_rd[8:0] @I @E 0\n");
  printf("tm_gd[8:0] @I @E 0\n");
  printf("tm_bd[8:0] @I @E 0\n");
  printf("tm_ad[8:0] @I @E 0\n");
  printf("dv @I @E 0\n");
  printf("\n");  /* required newline */
}


/*
 *  Prints signal values info for input signals, same for all dumps
 */
static void
  print_input_sigs( void )
{
  printf("%d %d %d %d %d %d ",
    st_span,
    ncyc,
    bilerp0m,
    bilerp1m,
    convert_one,
    mid_texel);

  printf("0x%.3x 0x%.3x 0x%.3x 0x%.3x ",
    k0_coeff,
    k1_coeff,
    k2_coeff,
    k3_coeff);

  printf("0x%.3x %d 0x%.2x 0x%.2x 0x%.2x 0x%.2x ",
    lod_frac,
    lge1,
    sfrac_rg,
    tfrac_rg,
    sfrac_ba,
    tfrac_ba);

  printf("0x%0.3x 0x%0.3x 0x%0.3x 0x%0.3x ",
    tm_ra,
    tm_ga,
    tm_ba,
    tm_aa);

  printf("0x%0.3x 0x%0.3x 0x%0.3x 0x%0.3x ",
    tm_rb,
    tm_gb,
    tm_bb,
    tm_ab);

  printf("0x%0.3x 0x%0.3x 0x%0.3x 0x%0.3x ",
    tm_rc,
    tm_gc,
    tm_bc,
    tm_ac);

  printf("0x%0.3x 0x%0.3x 0x%0.3x 0x%0.3x ",
    tm_rd,
    tm_gd,
    tm_bd,
    tm_ad);

  printf("%d\n", dv);
}


/*
 *   Generate test vcectors 
 */


main(int argc, char **argv)
{

  print_input_header();

  print_input_sigs();
  print_input_sigs();

  printf("# select A texel\n");
  bilerp0m = 1;
  bilerp1m = 1;
  lod_frac = 0x1aa; /* see if it gets through */
  lge1 = 1; /* see if it gets through */
  tm_ra = 0xff;
  tm_ga = 0xee;
  tm_ba = 0xdd;
  tm_aa = 0xcc;
  tm_rb = 0xbb;
  tm_gb = 0xaa;
  tm_bb = 0x99;
  tm_ab = 0x88;
  tm_rc = 0x77;
  tm_gc = 0x66;
  tm_bc = 0x55;
  tm_ac = 0x44;
  tm_rc = 0x33;
  tm_gc = 0x22;
  tm_bc = 0x11;
  tm_ac = 0x00;
  print_input_sigs();
  dv = 1;
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();

  printf("# select B texel\n");
  sfrac_rg = 0xff;
  sfrac_ba = 0xff;
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();

  printf("# select C texel\n");
  sfrac_rg = 0x00;
  sfrac_ba = 0x00;
  tfrac_rg = 0xff;
  tfrac_ba = 0xff;
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();

  printf("# select D texel\n");
  sfrac_rg = 0xff;
  sfrac_ba = 0xff;
  tfrac_rg = 0xff;
  tfrac_ba = 0xff;
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();

}