inp003.c 7.89 KB
/*
 *  inp003.c - run a few simple tests to see if comp_new_x registers
 *  are being set correctly
 */
#include <stdio.h>
#include <stdlib.h>

/*
 *  G l o b a l s
 */

int startspan_r;         /* */
int startspan_g;         /* */
int startspan_b;         /* */
int startspan_a;         /* */
int startspan_z;         /* */
int startspan_s;         /* */
int startspan_t;         /* */
int startspan_w;         /* */
int startspan_l;         /* */

int ep_st_r;        /* [15:0], initial r  10.6 */
int ep_st_g;        /* [15:0], initial g  10.6 */
int ep_st_b;        /* [15:0], initial b  10.6 */
int ep_st_a;        /* [15:0], initial a  10.6 */
int ep_st_z;        /* [21:0], initial z s15.6 */
int ep_st_s;        /* [21:0], initial s s15.6 */
int ep_st_t;        /* [21:0], initial t s15.6 */
int ep_st_w;        /* [21:0], initial w s15.6 */
int ep_st_l;        /* [21:0], initial l s15.6 */

int at_st_dxr;      /* [21:0], change in x, s,10.11 */
int at_st_dxg;      /* [21:0], change in x, s,10.11 */
int at_st_dxb;      /* [21:0], change in x, s,10.11 */
int at_st_dxa;      /* [21:0], change in x, s,10.11 */
int at_st_dxz;      /* [31:0], change in x, s,15.16 */
int at_st_dxs;      /* [26:0], change in x, s,15.16 */
int at_st_dxt;      /* [26:0], change in x, s,15.16 */
int at_st_dxw;      /* [26:0], change in x, s,15.16 */
int at_st_dxl;      /* [26:0], change in x, s,15.16 */

int at_st_dyr;      /* [12:0], change in y, s,10.2 */
int at_st_dyg;      /* [12:0], change in y, s,10.2 */
int at_st_dyb;      /* [12:0], change in y, s,10.2 */
int at_st_dya;      /* [12:0], change in y, s,10.2 */
int at_st_dyz;      /* [21:0], change in y, s,10.11 */

int x_offsetr;      /* [1:0], subpixel offset in x, 0.2 */
int x_offsetg;      /* [1:0], subpixel offset in x, 0.2 */
int x_offsetb;      /* [1:0], subpixel offset in x, 0.2 */
int x_offseta;      /* [1:0], subpixel offset in x, 0.2 */
int x_offsetz;      /* [1:0], subpixel offset in x, 0.2 */

int y_offsetr;      /* [1:0], subpixel offset in y, 0.2 */
int y_offsetg;      /* [1:0], subpixel offset in y, 0.2 */
int y_offsetb;      /* [1:0], subpixel offset in y, 0.2 */
int y_offseta;      /* [1:0], subpixel offset in y, 0.2 */
int y_offsetz;      /* [1:0], subpixel offset in y, 0.2 */

int ncyc_r;         /* */
int ncyc_g;         /* */
int ncyc_b;         /* */
int ncyc_a;         /* */
int ncyc_z;         /* */
int ncyc_s;         /* */
int ncyc_t;         /* */
int ncyc_w;         /* */
int ncyc_l;         /* */

int left_r;         /* */
int left_g;         /* */
int left_b;         /* */
int left_a;         /* */
int left_z;         /* */
int left_s;         /* */
int left_t;         /* */
int left_w;         /* */
int left_l;         /* */

int dv;
int exit1;

static void
  print_vectors( char *prog_name )
{
  static int first_time = 1;
  if(first_time)
  {
    first_time = 0;
    printf("#\n");
    printf("#   created by %s.c\n", prog_name);
    printf("#\n");
    printf("gclk @C 1(8) 0(8)\n");
    printf("startspan_r @I @E 0\n");
    printf("startspan_g @I @E 0\n");
    printf("startspan_b @I @E 0\n");
    printf("startspan_a @I @E 0\n");
    printf("startspan_z @I @E 0\n");
    printf("startspan_s @I @E 0\n");
    printf("startspan_t @I @E 0\n");
    printf("startspan_w @I @E 0\n");
    printf("startspan_l @I @E 0\n");
    printf("ep_st_r[15:0] @I @E 0\n");
    printf("ep_st_g[15:0] @I @E 0\n");
    printf("ep_st_b[15:0] @I @E 0\n");
    printf("ep_st_a[15:0] @I @E 0\n");
    printf("ep_st_z[21:0] @I @E 0\n");
    printf("ep_st_s[21:0] @I @E 0\n");
    printf("ep_st_t[21:0] @I @E 0\n");
    printf("ep_st_w[21:0] @I @E 0\n");
    printf("ep_st_l[21:0] @I @E 0\n");
    printf("at_st_dxr[21:0] @I @E 0\n");
    printf("at_st_dxg[21:0] @I @E 0\n");
    printf("at_st_dxb[21:0] @I @E 0\n");
    printf("at_st_dxa[21:0] @I @E 0\n");
    printf("at_st_dxz[31:0] @I @E 0\n");
    printf("at_st_dxs[26:0] @I @E 0\n");
    printf("at_st_dxt[26:0] @I @E 0\n");
    printf("at_st_dxw[26:0] @I @E 0\n");
    printf("at_st_dxl[26:0] @I @E 0\n");
    printf("at_st_dyr[12:0] @I @E 0\n");
    printf("at_st_dyg[12:0] @I @E 0\n");
    printf("at_st_dyb[12:0] @I @E 0\n");
    printf("at_st_dya[12:0] @I @E 0\n");
    printf("at_st_dyz[21:0] @I @E 0\n");
    printf("x_offsetr[1:0] @I @E 0\n");
    printf("x_offsetg[1:0] @I @E 0\n");
    printf("x_offsetb[1:0] @I @E 0\n");
    printf("x_offseta[1:0] @I @E 0\n");
    printf("x_offsetz[1:0] @I @E 0\n");
    printf("y_offsetr[1:0] @I @E 0\n");
    printf("y_offsetg[1:0] @I @E 0\n");
    printf("y_offsetb[1:0] @I @E 0\n");
    printf("y_offseta[1:0] @I @E 0\n");
    printf("y_offsetz[1:0] @I @E 0\n");
    printf("ncyc_r @I @E 0\n");
    printf("ncyc_g @I @E 0\n");
    printf("ncyc_b @I @E 0\n");
    printf("ncyc_a @I @E 0\n");
    printf("ncyc_z @I @E 0\n");
    printf("ncyc_s @I @E 0\n");
    printf("ncyc_t @I @E 0\n");
    printf("ncyc_w @I @E 0\n");
    printf("ncyc_l @I @E 0\n");
    printf("left_r @I @E 0\n");
    printf("left_g @I @E 0\n");
    printf("left_b @I @E 0\n");
    printf("left_a @I @E 0\n");
    printf("left_z @I @E 0\n");
    printf("left_s @I @E 0\n");
    printf("left_t @I @E 0\n");
    printf("left_w @I @E 0\n");
    printf("left_l @I @E 0\n");
    printf("dv     @I @E 0\n");
    printf("exit   @I @E 0\n");
    printf("\n"); /* required newline */

    printf("# Initial test of the comp_new intermediate signal calculations \n");
  }
  /*
   *  print input signals
   */
  printf("%d %d %d %d %d %d %d %d %d ",
        startspan_r,
        startspan_g,
        startspan_b,
        startspan_a,
        startspan_z,
        startspan_s,
        startspan_t,
        startspan_w,
        startspan_l );

  printf(" 0x%.4x 0x%.4x 0x%.4x 0x%.4x 0x%.6x 0x%.6x 0x%.6x 0x%.6x 0x%.6x ",
    ep_st_r,
    ep_st_g,
    ep_st_b,
    ep_st_a,
    ep_st_z,
    ep_st_s,
    ep_st_t,
    ep_st_w,
    ep_st_l );

  printf(" 0x%.6x 0x%.6x 0x%.6x 0x%.6x 0x%.8x 0x%.7x 0x%.7x 0x%.7x 0x%.7x ",
    at_st_dxr,
    at_st_dxg,
    at_st_dxb,
    at_st_dxa,
    at_st_dxz,
    at_st_dxs,
    at_st_dxt,
    at_st_dxw,
    at_st_dxl );

  printf(" 0x%.4x 0x%.4x 0x%.4x 0x%.4x 0x%.6x ",
    at_st_dyr,
    at_st_dyg,
    at_st_dyb,
    at_st_dya,
    at_st_dyz );

  printf(" 0x%.1x 0x%.1x 0x%.1x 0x%.1x 0x%.1x ",
    x_offsetr,
    x_offsetg,
    x_offsetb,
    x_offseta,
    x_offsetz );

  printf(" 0x%.1x 0x%.1x 0x%.1x 0x%.1x 0x%.1x ",
    y_offsetr,
    y_offsetg,
    y_offsetb,
    y_offseta,
    y_offsetz);

  printf(" %d %d %d %d %d %d %d %d %d ",
    ncyc_r,
    ncyc_g,
    ncyc_b,
    ncyc_a,
    ncyc_z,
    ncyc_s,
    ncyc_t,
    ncyc_w,
    ncyc_l);

  printf(" %d %d %d %d %d %d %d %d %d ",
    left_r,
    left_g,
    left_b,
    left_a,
    left_z,
    left_s,
    left_t,
    left_w,
    left_l);

  printf(" %d %d\n", dv, exit1);
}

int
  main(int argc, char **argv)
{
  int st_pt, dx, dy, ox, oy;

  /* print header */    
  print_vectors(argv[0]);

  startspan_r = 1;
  startspan_g = 1;
  startspan_b = 1;
  startspan_a = 1;
  startspan_z = 1;
  startspan_s = 1;
  startspan_t = 1;
  startspan_w = 1;
  startspan_l = 1;
  print_vectors(argv[0]);

  startspan_r = 0;
  startspan_g = 0;
  startspan_b = 0;
  startspan_a = 0;
  startspan_z = 0;
  startspan_s = 0;
  startspan_t = 0;
  startspan_w = 0;
  startspan_l = 0;
  print_vectors(argv[0]);
  print_vectors(argv[0]);
  print_vectors(argv[0]);

  ncyc_r = 1;
  ncyc_g = 1;
  ncyc_b = 1;
  ncyc_a = 1;
  ncyc_z = 1;
  ncyc_s = 1;
  ncyc_t = 1;
  ncyc_w = 1;
  ncyc_l = 1;
  print_vectors(argv[0]);
  print_vectors(argv[0]);
  print_vectors(argv[0]);

  startspan_r = 1;
  startspan_g = 1;
  startspan_b = 1;
  startspan_a = 1;
  startspan_z = 1;
  startspan_s = 1;
  startspan_t = 1;
  startspan_w = 1;
  startspan_l = 1;
  print_vectors(argv[0]);

  startspan_r = 0;
  startspan_g = 0;
  startspan_b = 0;
  startspan_a = 0;
  startspan_z = 0;
  startspan_s = 0;
  startspan_t = 0;
  startspan_w = 0;
  startspan_l = 0;
  print_vectors(argv[0]);
  print_vectors(argv[0]);
  print_vectors(argv[0]);

  exit1 = 1;
  print_vectors(argv[0]);
}