inp005.c 6.44 KB
/*
 *  inp005.c: check load, shift_coord, level, and tile
 */
#include <stdio.h>

#include "ints.h"
#include "rdpcmd.h"



/*
 *  Signals
 */
int reset;
int cs_st_prim;
int cs_st_attr;
int cs_cmd;         /* [5:0] */
int64 cs_ew_d;      /* [63:0] */
int dv;		    /* data valid */



unsigned int count;         /* count clocks after start_span */



/*
 *  Prints header info for input signals, same for all dumps
 */
static void
  print_input_header( void )
{
  printf("# inp000.c: Check unsynced attributes\n");
  printf("gclk @C 1(8) 0(8)\n");
  printf("reset @I @E 0\n");
  printf("cs_st_prim @I @E 0\n");
  printf("cs_st_attr @I @E 0\n");
  printf("cs_cmd[5:0] @I @E 0\n");
  printf("cs_ew_d[63:0] @I @E 0\n");
  printf("dv @I @E 0\n");
  printf("count[31:0] @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 0x%0.2x 0x%0.8x%0.8x %d 0x%0.8x\n",
    reset,
    cs_st_prim,
    cs_st_attr,
    cs_cmd,
    cs_ew_d.word1,
    cs_ew_d.word0,
    dv,
    count);

/*  if(cs_st_prim)
    count = 0;
  else */
    count++;
}

/*
 *  reset_sig: reset for 60 clocks
 */
static void
  reset_sigs( void )
{
  int i;
  printf("# reset 60 clocks\n");
  reset = 0;
  print_input_sigs();
  reset = 1;
  for(i = 0; i < 60; i++)
    print_input_sigs();

  printf("# release reset\n");
  reset = 0;
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
}

/*
 *  Initialize every latch to zero so we don't get bad compares
 */
static void
  init_latches( void )
{
  int i;
  cs_st_attr = 1;
  cs_ew_d.word1 = 0x0;
  cs_ew_d.word0 = 0x0;
  printf("# SETCIMG\n");
  cs_cmd = SETCIMG;
  print_input_sigs();
  printf("# SETMIMG\n");
  cs_cmd = SETMIMG;
  print_input_sigs();
  printf("# SETTIMG\n");
  cs_cmd = SETTIMG;
  print_input_sigs();
  printf("# SETCOMBINE\n");
  cs_cmd = SETCOMBINE;
  print_input_sigs();
  printf("# SETENVCOLOR\n");
  cs_cmd = SETENVCOLOR;
  print_input_sigs();
  printf("# SETPRIMCOLOR\n");
  cs_cmd = SETPRIMCOLOR;
  print_input_sigs();
  printf("# SETBLENDCOLOR\n");
  cs_cmd = SETBLENDCOLOR;
  print_input_sigs();
  printf("# SETFOGCOLOR\n");
  cs_cmd = SETFOGCOLOR;
  print_input_sigs();
  printf("# SETFILLCOLOR\n");
  cs_cmd = SETFILLCOLOR;
  print_input_sigs();
  printf("# SETTILE\n");
  cs_cmd = SETTILE;
  print_input_sigs();
  printf("# SETTILESIZE\n");
  cs_cmd = SETTILESIZE;
  print_input_sigs();
  printf("# SETRDPOTHER\n");
  cs_cmd = SETRDPOTHER;
  print_input_sigs();
  printf("# SETPRIMDEPTH\n");
  cs_cmd = SETPRIMDEPTH;
  print_input_sigs();
  printf("# SETSCISSOR\n");
  cs_cmd = SETSCISSOR;
  print_input_sigs();
  printf("# SETCONVERT\n");
  cs_cmd = SETCONVERT;
  print_input_sigs();
  printf("# SETKEYR\n");
  cs_cmd = SETKEYR;
  print_input_sigs();
  printf("# SETKEYGB\n");
  cs_cmd = SETKEYGB;
  print_input_sigs();
  printf("# SETKEYGB\n");
  cs_cmd = SETKEYGB;
  print_input_sigs();

  printf("# TRIFILL\n");
  cs_cmd = TRIFILL;
  cs_st_prim = 1;
  print_input_sigs();
  cs_st_prim = 0;
  print_input_sigs();

  for(i = 0; i < 40; i++)
    print_input_sigs();

}



/*
 *   Generate test vcectors 
 */


main(int argc, char **argv)
{
  int i;


  print_input_header();
  reset_sigs();
  init_latches();
  dv = 1;

 

  printf("# set other modes = 0, tlut_en = 0\n"); 
  cs_st_attr = 1;
  cs_cmd = SETRDPOTHER;
  cs_ew_d.word1 = 0x0;     
  cs_ew_d.word0 = 0x0; 
  print_input_sigs();

  cs_st_attr = 0;
  cs_cmd = 0;
  print_input_sigs();

  printf("# LOADTILE, tile = 0x7\n"); 
  cs_st_prim = 1;
  cs_cmd = LOADTILE;
  cs_ew_d.word1 = 0xbadddeed;     
  cs_ew_d.word0 = 0x07000000; 
  print_input_sigs();

  cs_st_prim = 0;
  cs_cmd = 0;
  cs_ew_d.word1 = 0x0;     
  cs_ew_d.word0 = 0x0; 
  for(i = 0; i < 22; i++)
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();

  printf("# TEXRECT, tile = 4\n"); 
  cs_st_prim = 1;
  cs_cmd = TEXRECT;
  cs_ew_d.word1 = 0xdeaddead;     
  cs_ew_d.word0 = 0x04000000; 
  print_input_sigs();

  cs_st_prim = 0;
  cs_cmd = 0;
  cs_ew_d.word1 = 0x0;     
  cs_ew_d.word0 = 0x0; 
  for(i = 0; i < 22; i++)
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();

  printf("# LOADBLOCK, tile = 0x5\n"); 
  cs_st_prim = 1;
  cs_cmd = LOADBLOCK;
  cs_ew_d.word1 = 0xbadddeed;     
  cs_ew_d.word0 = 0x05000000; 
  print_input_sigs();

  cs_st_prim = 0;
  cs_cmd = 0;
  cs_ew_d.word1 = 0x0;     
  cs_ew_d.word0 = 0x0; 
  for(i = 0; i < 22; i++)
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();

  printf("# TEXRECTFLIP, tile = 3\n"); 
  cs_st_prim = 1;
  cs_cmd = TEXRECTFLIP;
  cs_ew_d.word1 = 0xdeaddead;     
  cs_ew_d.word0 = 0x03000000; 
  print_input_sigs();

  cs_st_prim = 0;
  cs_cmd = 0;
  cs_ew_d.word1 = 0x0;     
  cs_ew_d.word0 = 0x0; 
  for(i = 0; i < 22; i++)
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();

  printf("# LOADTLUT, tile = 0x6\n"); 
  cs_st_prim = 1;
  cs_cmd = LOADBLOCK;
  cs_ew_d.word1 = 0xbadddeed;     
  cs_ew_d.word0 = 0x06000000; 
  print_input_sigs();

  cs_st_prim = 0;
  cs_cmd = 0;
  cs_ew_d.word1 = 0x0;     
  cs_ew_d.word0 = 0x0; 
  for(i = 0; i < 22; i++)
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();


  printf("# TRIFILL, level = 1, tile = 7\n"); 
  cs_st_prim = 1;
  cs_cmd = TRIFILL;
  cs_ew_d.word1 = 0x000f0000;     
  cs_ew_d.word0 = 0xbeeffeed; 
  print_input_sigs();

  cs_st_prim = 0;
  cs_cmd = 0;
  cs_ew_d.word1 = 0x0;     
  cs_ew_d.word0 = 0x0; 
  for(i = 0; i < 22; i++)
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();

  printf("# TRISHADE, level = 1, tile = 1\n"); 
  cs_st_prim = 1;
  cs_cmd = TRISHADE;
  cs_ew_d.word1 = 0x00090000;     
  cs_ew_d.word0 = 0xdeadffff; 
  print_input_sigs();

  cs_st_prim = 0;
  cs_cmd = 0;
  cs_ew_d.word1 = 0x0;     
  cs_ew_d.word0 = 0x0; 
  for(i = 0; i < 22; i++)
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();


  printf("# do nothing 45 clocks\n"); 
  cs_ew_d.word1 = 0xdeaddead;      
  cs_ew_d.word0 = 0xdeaddead;      
  for(i = 0; i < 45; i++)
    print_input_sigs();


}