inp000.c 2.02 KB
/*
 *  inp000.c: quick check of coverage unit
 */
#include <stdio.h>


/*
 *  Signals
 */
int ew_cv_data;             /* [12:0] */
int x_major;                /* [11:0] */
int cycle_type;             /* lsb of cycle type */
int ew_cv_newspan;          /* start span */
int left;                   /* left major flag */
int reset;
int dv;			    /* data valid */



/*
 *  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("ew_cv_data[12:0] @I @E 0\n");
  printf("x_major[11:0] @I @E 0\n");
  printf("cycle_type @I @E 0\n");
  printf("ew_cv_newspan @I @E 0\n");
  printf("left @I @E 0\n");
  printf("reset @I @E 0\n");
  printf("dv @I @E 0\n");
  printf("\n");
}


/*
 *  Prints signal values info for input signals, same for all dumps
 */
static void
  print_input_sigs( void )
{
  printf("0x%.4x 0x%0.3x %d %d %d %d %d\n",
    ew_cv_data,
    x_major,
    cycle_type,
    ew_cv_newspan,
    left,
    reset,
    dv);
}


/*
 *   Generate test vcectors 
 */


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

  x_major = 0xaa;
  cycle_type = 0;
  left = 1;

  print_input_header();
 
  printf("# reset 6 clocks\n"); 
  reset = 0;
  for(i = 0; i < 6; i++)
    print_input_sigs();

  reset = 1;
  printf("# xh0\n"); 
  ew_cv_data = 0xee;
  print_input_sigs();

  printf("# xm0\n"); 
  ew_cv_data = 0xdd << 3;
  print_input_sigs();

  printf("# xh1\n"); 
  ew_cv_data = 0xcc;
  print_input_sigs();

  printf("# xm1\n"); 
  ew_cv_data = 0xbb << 3;
  print_input_sigs();

  printf("# xh2\n"); 
  ew_cv_data = 0xaa;
  print_input_sigs();

  printf("# xm2\n"); 
  ew_cv_data = 0x99 << 3;
  print_input_sigs();

  printf("# xh3\n"); 
  ew_cv_data = 0x88;
  print_input_sigs();

  printf("# xm3\n"); 
  ew_cv_data = 0x77 << 3;
  print_input_sigs();

  printf("# xval, latch xm's, xh's\n"); 
  ew_cv_data = 0xf;
  ew_cv_newspan = 1; 
  print_input_sigs();

  dv = 1; /* one clock after new span, data should be valid */
  ew_cv_newspan = 0; 

  for(i = 0; i < 100; i++)
    print_input_sigs();
}