Line 101... |
Line 101... |
}
|
}
|
return(list);
|
return(list);
|
}
|
}
|
|
|
PortNode *
|
PortNode *
|
InsertPort (PortNode * list, char *name, char *tipo, int size)
|
InsertPort (PortNode * list, char *name, char *tipo, int size, int pflag)
|
{
|
{
|
PortNode *pl;
|
PortNode *pl;
|
pl = (PortNode *) malloc (sizeof (PortNode));
|
pl = (PortNode *) malloc (sizeof (PortNode));
|
strcpy (pl->name, name);
|
strcpy (pl->name, name);
|
strcpy (pl->tipo, tipo);
|
strcpy (pl->tipo, tipo);
|
pl->size = size;
|
pl->size = size;
|
|
pl->pflag = pflag;
|
SGLIB_LIST_ADD (PortNode, list, pl, next);
|
SGLIB_LIST_ADD (PortNode, list, pl, next);
|
return (list);
|
return (list);
|
}
|
}
|
|
|
void
|
void
|
Line 121... |
Line 122... |
PortNode *pll;
|
PortNode *pll;
|
|
|
SGLIB_LIST_MAP_ON_ELEMENTS (PortNode, list, pll, next,
|
SGLIB_LIST_MAP_ON_ELEMENTS (PortNode, list, pll, next,
|
{
|
{
|
printf ("%s ", pll->tipo);
|
printf ("%s ", pll->tipo);
|
|
if (pll->pflag == 1) printf("signed ");
|
if (pll->size != 0 && pll->size != 1)
|
if (pll->size != 0 && pll->size != 1)
|
{
|
{
|
printf ("[%d:0] ", (-1 + pll->size));}
|
printf ("[%d:0] ", (-1 + pll->size));}
|
printf ("%s;\n", pll->name);
|
printf ("%s;\n", pll->name);
|
}
|
}
|
Line 140... |
Line 142... |
SGLIB_LIST_MAP_ON_ELEMENTS (PortNode, list, pll, next,
|
SGLIB_LIST_MAP_ON_ELEMENTS (PortNode, list, pll, next,
|
{
|
{
|
if (strcmp (pll->tipo, "output") == 0)
|
if (strcmp (pll->tipo, "output") == 0)
|
{
|
{
|
if(!IsWire(pll->name,instances)){
|
if(!IsWire(pll->name,instances)){
|
printf ("reg ");
|
if (pll->pflag == 1) printf("reg signed "); else printf ("reg ");
|
if (pll->size != 0 && pll->size != 1)
|
if (pll->size != 0 && pll->size != 1)
|
{
|
{
|
printf ("[%d:0] ", (-1 + pll->size));}
|
printf ("[%d:0] ", (-1 + pll->size));}
|
printf ("%s;\n", pll->name);}
|
printf ("%s;\n", pll->name);}
|
}
|
}
|
Line 171... |
Line 173... |
);
|
);
|
return;
|
return;
|
}
|
}
|
|
|
SignalNode *
|
SignalNode *
|
InsertSignal (SignalNode * list, char *name, int size, int arraysize)
|
InsertSignal (SignalNode * list, char *name, int size, int arraysize,int sflag)
|
{
|
{
|
SignalNode *sl;
|
SignalNode *sl;
|
|
|
sl = (SignalNode *) malloc (sizeof (SignalNode));
|
sl = (SignalNode *) malloc (sizeof (SignalNode));
|
strcpy (sl->name, name);
|
strcpy (sl->name, name);
|
sl->size = size;
|
sl->size = size;
|
sl->arraysize=arraysize;
|
sl->arraysize=arraysize;
|
|
sl->sflag=sflag;
|
SGLIB_LIST_ADD (SignalNode, list, sl, next);
|
SGLIB_LIST_ADD (SignalNode, list, sl, next);
|
return (list);
|
return (list);
|
|
|
}
|
}
|
|
|
Line 193... |
Line 196... |
SignalNode *sll;
|
SignalNode *sll;
|
SGLIB_LIST_MAP_ON_ELEMENTS (SignalNode, list, sll, next,
|
SGLIB_LIST_MAP_ON_ELEMENTS (SignalNode, list, sll, next,
|
{
|
{
|
if (IsWrite (writeslist, sll->name))
|
if (IsWrite (writeslist, sll->name))
|
{
|
{
|
printf ("reg ");
|
if (sll->sflag==1) printf("reg signed "); else printf ("reg ");
|
if (sll->size != 0 && sll->size != 1)
|
if (sll->size != 0 && sll->size != 1)
|
{
|
{
|
printf ("[%d:0] ", (-1 + sll->size));
|
printf ("[%d:0] ", (-1 + sll->size));
|
}
|
}
|
printf ("%s", sll->name);
|
printf ("%s", sll->name);
|
}
|
}
|
else
|
else
|
{
|
{
|
printf ("wire ");
|
if (sll->sflag==1) printf("wire signed "); else printf ("wire ");
|
if (sll->size != 0 && sll->size != 1)
|
if (sll->size != 0 && sll->size != 1)
|
{
|
{
|
printf ("[%d:0] ", (-1 + sll->size));
|
printf ("[%d:0] ", (-1 + sll->size));
|
}
|
}
|
printf ("%s", sll->name);
|
printf ("%s", sll->name);
|
Line 573... |
Line 576... |
return bits_i;
|
return bits_i;
|
|
|
}
|
}
|
|
|
/* Functions for functions inputs list*/
|
/* Functions for functions inputs list*/
|
FunctionInputNode *InsertFunctionInput (FunctionInputNode * list, char *name, int lenght){
|
FunctionInputNode *InsertFunctionInput (FunctionInputNode * list, char *name, int lenght, int flag){
|
FunctionInputNode *fl;
|
FunctionInputNode *fl;
|
fl = (FunctionInputNode *) malloc (sizeof (FunctionInputNode));
|
fl = (FunctionInputNode *) malloc (sizeof (FunctionInputNode));
|
strcpy (fl->name, name);
|
strcpy (fl->name, name);
|
fl->lenght=lenght;
|
fl->lenght=lenght;
|
|
fl->sgnflag=flag;
|
SGLIB_LIST_ADD (FunctionInputNode, list, fl, next);
|
SGLIB_LIST_ADD (FunctionInputNode, list, fl, next);
|
return (list);
|
return (list);
|
}
|
}
|
|
|
void ShowFunctionInputs (FunctionInputNode * list){
|
void ShowFunctionInputs (FunctionInputNode * list){
|
Line 590... |
Line 594... |
|
|
SGLIB_LIST_REVERSE(FunctionInputNode,list, next);
|
SGLIB_LIST_REVERSE(FunctionInputNode,list, next);
|
|
|
SGLIB_LIST_MAP_ON_ELEMENTS (FunctionInputNode,list, fll,next,
|
SGLIB_LIST_MAP_ON_ELEMENTS (FunctionInputNode,list, fll,next,
|
{
|
{
|
|
if(fll->sgnflag==0)
|
|
{
|
if(fll->lenght!=1)
|
if(fll->lenght!=1)
|
printf("input [%d:0] %s;\n",(fll->lenght)-1,fll->name);
|
printf("input [%d:0] %s;\n",(fll->lenght)-1,fll->name);
|
else
|
else
|
printf("input %s;\n",fll->name);
|
printf("input %s;\n",fll->name);
|
|
} else {
|
|
if(fll->lenght!=1)
|
|
printf("input signed [%d:0] %s;\n",(fll->lenght)-1,fll->name);
|
|
else
|
|
printf("input signed %s;\n",fll->name);
|
|
}
|
});
|
});
|
}
|
}
|
|
|
/* Functions for functions list*/
|
/* Functions for functions list*/
|
FunctionNode *InsertFunction (FunctionNode *list, char *name,FunctionInputNode *InputsList,int outputlenght){
|
FunctionNode *InsertFunction (FunctionNode *list, char *name,FunctionInputNode *InputsList,int outputlenght,int flag){
|
FunctionNode *fl;
|
FunctionNode *fl;
|
fl = (FunctionNode *) malloc (sizeof (FunctionNode));
|
fl = (FunctionNode *) malloc (sizeof (FunctionNode));
|
strcpy (fl->name, name);
|
strcpy (fl->name, name);
|
fl->outputlenght=outputlenght;
|
fl->outputlenght=outputlenght;
|
fl->list = InputsList;
|
fl->list = InputsList;
|
|
fl->sgnflag=flag;
|
SGLIB_LIST_ADD (FunctionNode, list, fl, next);
|
SGLIB_LIST_ADD (FunctionNode, list, fl, next);
|
return (list);
|
return (list);
|
}
|
}
|
|
|
void ShowFunctionCode (FunctionNode *list){
|
void ShowFunctionCode (FunctionNode *list){
|
Line 620... |
Line 633... |
|
|
FunctionNode *fll;
|
FunctionNode *fll;
|
|
|
SGLIB_LIST_MAP_ON_ELEMENTS (FunctionNode,list, fll,next,
|
SGLIB_LIST_MAP_ON_ELEMENTS (FunctionNode,list, fll,next,
|
{
|
{
|
|
if(fll->sgnflag==0)
|
|
{
|
if(fll->outputlenght!=1)
|
if(fll->outputlenght!=1)
|
printf("function [%d:0] %s;\n\n",(fll->outputlenght)-1,fll->name);
|
printf("function [%d:0] %s;\n\n",(fll->outputlenght)-1,fll->name);
|
else
|
else
|
printf("function %s;\n\n",fll->name);
|
printf("function %s;\n\n",fll->name);
|
|
} else {
|
|
if(fll->outputlenght!=1)
|
|
printf("function signed [%d:0] %s;\n\n",(fll->outputlenght)-1,fll->name);
|
|
else
|
|
printf("function signed %s;\n\n",fll->name);
|
|
}
|
|
|
ShowFunctionInputs(fll->list);
|
ShowFunctionInputs(fll->list);
|
|
|
//Show Registers
|
//Show Registers
|
filename =(char *) malloc (256 * sizeof (char));
|
filename =(char *) malloc (256 * sizeof (char));
|