inp001.c 2.49 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 vectors 
 */


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

  /*
   *      0     1      2      3      4      5      6      7
   *  +----#-+------+------+--@---+------+------+------+------+
   *  |      |     #|  @   |      |      |      |      |      |
   *  |      |  @   |     #|      |      |      |      |      |
   *  |  @   |      |      |     #|      |      |      |      |
   *  +------+------+------+------+------+------+------+------+
   *      0     1      2      3      4      5      6      7
   *
   *  @ - left edge
   *  # - right edge
   */

  x_major = 0x00;
  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 = 0x26;
  print_input_sigs();

  printf("# xm0\n"); 
  ew_cv_data = 0x06;
  print_input_sigs();

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

  printf("# xm1\n"); 
  ew_cv_data = 0x0e;
  print_input_sigs();

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

  printf("# xm2\n"); 
  ew_cv_data = 0x16;
  print_input_sigs();

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

  printf("# xm3\n"); 
  ew_cv_data = 0x1e;
  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 < 25; i++)
    print_input_sigs();
}