inp000.c 5.42 KB
/*
 *  inp000.c: Check unsynced attributes
 */
#include <stdio.h>

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


#define SET_COMMAND(cmd)	(cs_ew_d.word1 = cmd << 24)

/*
 *  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("# try setting unsynced attributes\n"); 
  printf("# SETCIMG\n"); 
  cs_cmd = SETCIMG;
  cs_st_attr = 1;
  cs_ew_d.word1 = 0x34fedcba;      
  cs_ew_d.word0 = 0x87654321;      
  print_input_sigs();

  printf("# SETMIMG\n"); 
  cs_cmd = SETMIMG;
  cs_st_attr = 1;
  cs_ew_d.word1 = 0xbeeffeed;      
  cs_ew_d.word0 = 0xfadfaded;      
  print_input_sigs();

  printf("# SETTIMG\n"); 
  cs_cmd = SETTIMG;
  cs_st_attr = 1;
  cs_ew_d.word1 = 0xfedcba34;      
  cs_ew_d.word0 = 0x65432187;      
  print_input_sigs();

  printf("# SETCOMBINE\n"); 
  cs_cmd = SETCOMBINE;
  cs_st_attr = 1;
  cs_ew_d.word1 = 0xedcba34f;      
  cs_ew_d.word0 = 0x54321876;      
  print_input_sigs();

  printf("# SETENVCOLOR\n"); 
  cs_cmd = SETENVCOLOR;
  cs_st_attr = 1;
  cs_ew_d.word1 = 0xdcba34fe;      
  cs_ew_d.word0 = 0x43218765;      
  print_input_sigs();

  printf("# SETBLENDCOLOR\n"); 
  cs_cmd = SETBLENDCOLOR;
  cs_st_attr = 1;
  cs_ew_d.word1 = 0xcba34fed;      
  cs_ew_d.word0 = 0x32187654;      
  print_input_sigs();

  printf("# SETFOGCOLOR\n"); 
  cs_cmd = SETFOGCOLOR;
  cs_st_attr = 1;
  cs_ew_d.word1 = 0xba34fedc;      
  cs_ew_d.word0 = 0x21876543;      
  print_input_sigs();

  printf("# SETFILLCOLOR\n"); 
  cs_cmd = SETFILLCOLOR;
  cs_st_attr = 1;
  cs_ew_d.word1 = 0xa34fedcb;      
  cs_ew_d.word0 = 0x18765432;      
  print_input_sigs();

  printf("# SETRDPOTHER\n"); 
  cs_cmd = SETRDPOTHER;
  cs_st_attr = 1;
  cs_ew_d.word1 = 0x34fedcba;      
  cs_ew_d.word0 = 0x87654321;      
  print_input_sigs();

  printf("# SETCONVERT\n"); 
  cs_cmd = SETCONVERT;
  cs_st_attr = 1;
  cs_ew_d.word1 = 0x87654321;      
  cs_ew_d.word0 = 0x34fedcba;      
  print_input_sigs();

  printf("# SETKEYR\n"); 
  cs_cmd = SETKEYR;
  cs_st_attr = 1;
  cs_ew_d.word1 = 0x76543218;      
  cs_ew_d.word0 = 0x4fedcba3;      
  print_input_sigs();

  printf("# SETKEYGB\n"); 
  cs_cmd = SETKEYGB;
  cs_st_attr = 1;
  cs_ew_d.word1 = 0x65432187;      
  cs_ew_d.word0 = 0xfedcba34;      
  print_input_sigs();

  cs_st_attr = 0;
  print_input_sigs();


  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
}