inp001.c 4.01 KB
/*
 *  inp001.c: check "left" signal delay
 */
#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 vectors 
 */


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("# set left flag\n"); 
  cs_st_prim = 1;
  cs_ew_d.word1 = 0x00800000;      
  cs_ew_d.word0 = 0xdeaddaff;      
  print_input_sigs();

  printf("# unset left flag\n"); 
  cs_st_prim = 0;
  cs_ew_d.word1 = 0x00000000;      
  cs_ew_d.word0 = 0xbeefface;      
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();
  print_input_sigs();

  cs_st_prim = 1;
  print_input_sigs();

  cs_st_prim = 0;
  print_input_sigs();

  printf("# wait 40 clocks\n"); 
  for(i = 0; i < 45; i++)
    print_input_sigs();

}