ADDER X-SC Manual de usuario Pagina 42

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 87
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 41
42 CHAPTER 1. INTRODUCTION TO THE ALLIANCE TOOLS
Table 1.14: Options Available for the GENPAT Tool.
Option Description
-v
Verbose mode.
-k
Keeps the executable and the compilation Makefile after completion.
for our multiplexer circuit using the following muxgp.c file.
#include <stdio.h>
#include <genpat.h>
/*Define the number of test patterns */
#define MAXCYCLE 8
/* Function to allocate a memory buf fer, convert the first parameter into a string
and return the pointer to it.*/
char *inttostr (int integer, int len)
{
char *str;
str = (char *)mbkalloc(len*sizeof(char)+1);
sprintf(str, "%.32d", integer);
return(&str[32-len]);
}
/* Apply power to the circuit */
void power (void)
{
AFFECT (inttostr (0, 32), "Vdd", "0b1");
AFFECT (inttostr (0, 32), "Vss", "0b0");
}
/*Generate the patterns for the mux */
void patterns (void)
{
int i,a,b,c,q;
for (i=0; i<MAXCYCLE; i++)
{
LABEL ( "pat" );
if (i%8 < 4) c = 0; else c = 1;
AFFECT(inttostr(i, 32), "c", inttostr(c,32));
if (i%4 < 2) a = 0; else a = 1;
AFFECT(inttostr(i, 32), "a", inttostr(a,32));
if(i%2 == 0) b = 0; else b = 1;
AFFECT(inttostr(i, 32), "b", inttostr(b, 32));
if(c == 1) q = a; else q = b;
AFFECT(inttostr(i, 32), "q", inttostr(q, 32));
}
}
int main(void)
{
/* Declares the name of the pattern file */
DEF_GENPAT ("muxgp_in");
/* Declare the name, format and type of each of the inputs/outputs */
DECLAR ( "Vdd", ":0", "B", IN, "", "");
DECLAR ( "Vss", ":5", "B", IN, "", "");
DECLAR ( "a", ":2", "B", IN, "", "");
DECLAR ( "b", ":2", "B", IN, "", "");
DECLAR ( "c", ":2", "B", IN, "", "");
DECLAR ( "q", ":2", "B", OUT, "", "");
/* Generate the patterns */
power();
patterns();
/* Save the pattern file */
SAV_GENPAT();
/* Return success code */
return(0);
}
Vista de pagina 41
1 2 ... 37 38 39 40 41 42 43 44 45 46 47 ... 86 87

Comentarios a estos manuales

Sin comentarios