URL
https://opencores.org/ocsvn/sc2v/sc2v/trunk
Subversion Repositories sc2v
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 34 to Rev 35
- ↔ Reverse comparison
Rev 34 → Rev 35
/trunk/ChangeLog
1,101 → 1,106
10-10-2005 Version 0.5 |
|
Added support for structures as local variables |
View dummy2.cpp file for an example |
|
|
19-09-2005 Version 0.4.6 |
|
Fix bug when closing method with }; |
Ignore quotes in comments |
|
|
20-07-2005 Version 0.4.5 |
|
Fix bug in functions parameters |
Update sglib.h library |
|
|
20-05-2005 Version 0.4.4 |
|
Fix bug using comments with -- and ++ operators |
Fix bug inferring regs with arrays |
Fix bug when using defines inside case statements |
Fix bug using comments |
Fix bug when assigning defines to variables |
|
18-05-2005 Version 0.4.3 |
|
Fix bug using ? and _ in header file |
Fix bug using multiple pointer declarations in header file |
Added #ifndef to implementation file |
|
18-03-2005 Version 0.4.2 |
|
Fix bug in hexadecimal numbers in case statatements |
Fix bug in type conversions |
Fix bug in array length |
Fix bug in process without variables declaration |
|
15-03-2005 Version 0.4.1 |
|
Fix bug with <= comparation |
for loops with int type as index supported |
Support hex numbers in switchs |
Support sc_signals arrays |
Fix bug when connecting a output port to another |
Solved problem in type conversions |
Solved problem with enumeration list |
Solved bug in nested switch statements |
|
25-02-2005 Version 0.4 |
|
Added support for unsigned functions |
|
05-02-2005 Version 0.3.1 |
|
Contribution of Harald Devos: |
Line number in syntax error |
ShowSignalsList arguments Fix |
|
03-02-2005 Version 0.3 |
|
Lists implementation completely rewrited using sglib library |
|
26-01-2005 Version 0.2.5 |
|
Solved bug in nested switchs |
Uses non-blocking assignments in sequential processes |
Macros are correctly invoked inside and outside processes |
More support for preprocessor constructions |
|
|
23-01-2005 Version 0.2.4 |
|
Contribution of Harald Devos: |
Fix Memory allocation problems |
Fix return -1 in list.c |
|
20-01-2005 Version 0.2.3 |
|
Fix Memory allocation problems |
Ignore SystemC type conversions |
|
18-01-2005 Version 0.2.2 |
|
Contribution of Harald Devos: |
Fix bug when using keywords in comments |
Adding multilines with \ |
|
|
17-01-2005 Version 0.2.1 |
|
Fix bug in else if |
Translate true and false into 1 and 0 |
|
|
21-12-2004 Version 0.2 |
|
Added support for enumerate data types |
Added Directives |
Added new sensitive constructions |
19-03-2007 Version 0.6 |
|
Added support for signed intergers by Chris Stratford |
|
|
10-10-2005 Version 0.5 |
|
Added support for structures as local variables |
View dummy2.cpp file for an example |
|
|
19-09-2005 Version 0.4.6 |
|
Fix bug when closing method with }; |
Ignore quotes in comments |
|
|
20-07-2005 Version 0.4.5 |
|
Fix bug in functions parameters |
Update sglib.h library |
|
|
20-05-2005 Version 0.4.4 |
|
Fix bug using comments with -- and ++ operators |
Fix bug inferring regs with arrays |
Fix bug when using defines inside case statements |
Fix bug using comments |
Fix bug when assigning defines to variables |
|
18-05-2005 Version 0.4.3 |
|
Fix bug using ? and _ in header file |
Fix bug using multiple pointer declarations in header file |
Added #ifndef to implementation file |
|
18-03-2005 Version 0.4.2 |
|
Fix bug in hexadecimal numbers in case statatements |
Fix bug in type conversions |
Fix bug in array length |
Fix bug in process without variables declaration |
|
15-03-2005 Version 0.4.1 |
|
Fix bug with <= comparation |
for loops with int type as index supported |
Support hex numbers in switchs |
Support sc_signals arrays |
Fix bug when connecting a output port to another |
Solved problem in type conversions |
Solved problem with enumeration list |
Solved bug in nested switch statements |
|
25-02-2005 Version 0.4 |
|
Added support for unsigned functions |
|
05-02-2005 Version 0.3.1 |
|
Contribution of Harald Devos: |
Line number in syntax error |
ShowSignalsList arguments Fix |
|
03-02-2005 Version 0.3 |
|
Lists implementation completely rewrited using sglib library |
|
26-01-2005 Version 0.2.5 |
|
Solved bug in nested switchs |
Uses non-blocking assignments in sequential processes |
Macros are correctly invoked inside and outside processes |
More support for preprocessor constructions |
|
|
23-01-2005 Version 0.2.4 |
|
Contribution of Harald Devos: |
Fix Memory allocation problems |
Fix return -1 in list.c |
|
20-01-2005 Version 0.2.3 |
|
Fix Memory allocation problems |
Ignore SystemC type conversions |
|
18-01-2005 Version 0.2.2 |
|
Contribution of Harald Devos: |
Fix bug when using keywords in comments |
Adding multilines with \ |
|
|
17-01-2005 Version 0.2.1 |
|
Fix bug in else if |
Translate true and false into 1 and 0 |
|
|
21-12-2004 Version 0.2 |
|
Added support for enumerate data types |
Added Directives |
Added new sensitive constructions |
/trunk/src/sc2v_step1.y
38,6 → 38,7
int openedkeys = 0; |
int newline = 0; |
int reg_found = 0; |
int sigreg_found = 0; |
int reglenght = 0; |
int writelenght = 0; |
int array_size=0; |
91,9 → 92,9
structslist = NULL; |
structsreglist = NULL; |
|
fprintf (stderr, "\nSystemC to Verilog Translator v0.4"); |
fprintf (stderr, "\nSystemC to Verilog Translator v0.6"); |
fprintf (stderr, |
"\nProvided by URJC(Universidad Rey Juan Carlos)\nhttp://www.escet.urjc.es/~jmartine\n\n"); |
"\nProvided by URJC(Universidad Rey Juan Carlos)\nhttp://gdhwsw.escet.urjc.es\n\n"); |
fprintf (stderr, "Parsing implementation file.......\n\n"); |
|
processname = (char *) malloc (256 * sizeof (char)); |
129,7 → 130,7
|
%} |
|
%token NUMBER WORD SC_REG BOOL BIGGER LOWER OPENKEY CLOSEKEY WRITE WORD SYMBOL NEWLINE ENUM INCLUDE |
%token NUMBER WORD SC_REG SC_SIGREG BOOL BIGGER LOWER OPENKEY CLOSEKEY WRITE SYMBOL NEWLINE ENUM INCLUDE |
%token COLON SEMICOLON RANGE OPENPAR CLOSEPAR TWODOUBLEPOINTS OPENCORCH CLOSECORCH SWITCH CASE DEFAULT BREAK |
%token HEXA DEFINE READ TRANSLATEOFF TRANSLATEON VERILOGBEGIN VERILOGEND TAB DOLLAR MINEQ |
%token VOID TTRUE TFALSE ENDFUNC INC DEC INTEGER EQUALS |
155,6 → 156,8
| |
sc_reg |
| |
sc_sigreg |
| |
integer |
| |
number |
255,6 → 258,7
struct_access: |
WORD DOT WORD |
{ |
|
/*Struct access |
Check if it is a var acess or a reg*/ |
if (newline){ |
261,19 → 265,20
for (i = 0; i < openedkeys; i++) |
fprintf (file, " "); |
} |
|
strcpy(structname,(char *)$3); |
strcat(structname,(char *)$1); |
regname2 = IsReg (regslist, structname); |
if (regname2 == NULL) |
|
if (regname2 == NULL){ |
fprintf (file, "%s ", structname); |
else |
}else{ |
fprintf (file, "%s", regname2); |
|
} |
newline = 0; |
|
free(regname2); |
|
printf("Access to struct %s.%s\n",(char *)$1,(char *)$3); |
|
/*printf("Access to struct %s.%s\n",(char *)$1,(char *)$3);*/ |
} |
|
minorequal: |
452,6 → 457,21
} |
}; |
|
sc_sigreg: |
SC_SIGREG LOWER NUMBER BIGGER |
{ |
defineparenthesis = 0; |
if (translate == 1 && verilog == 0) |
{ |
if (processfound) |
{ |
writelenght=1; |
reglenght = $3; |
sigreg_found = 1; |
} |
} |
}; |
|
integer: |
INTEGER |
{ |
510,7 → 530,7
if (translate == 1 && verilog == 0) |
{ |
if (processfound) |
if(opencorchfound && reg_found) |
if(opencorchfound && (reg_found || sigreg_found)) |
fprintf (regs_file, "%d:0",$1-1); |
else |
fprintf (file, "%d", $1); |
608,20 → 628,27
free (regname2); |
structsreglist=NULL; |
reg_found=0; /*To avoid arrays in sructs the interpretation finish here*/ |
sigreg_found = 0; |
);} |
|
}else if(struct_found && reg_found){ |
}else if(struct_found && (reg_found || sigreg_found)){ |
structsreglist=InsertStructReg(structsreglist,(char *)$1,reglenght); |
|
}else if (reg_found){ |
}else if (reg_found || sigreg_found){ |
if(writelenght){ |
writelenght=0; |
if(reglenght==0) |
fprintf (regs_file, "reg "); |
if(sigreg_found) |
fprintf (regs_file, "reg signed"); |
else |
fprintf (regs_file, "reg "); |
else |
fprintf (regs_file, "reg[%d:0] ", (-1 +reglenght)); |
} |
|
if(sigreg_found) |
fprintf (regs_file, "reg signed [%d:0] ", (-1 +reglenght)); |
else |
fprintf (regs_file, "reg [%d:0] ", (-1 +reglenght)); |
} |
|
regname = (char *) malloc (sizeof (char) * (strlen ((char *) $1) + 1)); |
regname2 = (char *) malloc (sizeof (char) * (strlen ((char *) $1) + strlen (processname)) + 1); |
strcpy (regname, (char *) $1); |
701,7 → 728,7
{ |
if (processfound) |
{ |
if (reg_found) |
if (reg_found || sigreg_found) |
fprintf (regs_file, "%s", (char *) $1); |
else |
fprintf (file, "%s", (char *) $1); |
720,6 → 747,7
{ |
defineparenthesis = 0; |
reg_found=0; |
sigreg_found=0; |
if (translate == 1 && verilog == 0) |
{ |
if (processfound) |
764,7 → 792,7
writingvar=0; |
if (translate == 1 && verilog == 0) |
{ |
if (processfound & !reg_found & !openedcase) |
if (processfound & !reg_found & !openedcase & !sigreg_found) |
{ |
fprintf (file, "\n"); |
newline = 1; |
787,7 → 815,7
{ |
if (processfound) |
{ |
if (reg_found) |
if (reg_found || sigreg_found) |
{ |
fprintf (regs_file, ","); |
} |
811,10 → 839,11
{ |
if (processfound && !struct_found && !ignore_semicolon) |
{ |
if (reg_found) |
if (reg_found || sigreg_found) |
{ |
fprintf (regs_file, ";\n"); |
reg_found = 0; |
sigreg_found = 0; |
} |
else |
{ |
858,6 → 887,7
} |
//If par after a sc_reg declaration the declaration is a type cast |
reg_found=0; |
sigreg_found=0; |
} |
|
closepar: |
894,7 → 924,7
if (processfound) |
{ |
opencorchfound = 1; |
if (reg_found) |
if (reg_found || sigreg_found) |
{ |
fprintf (regs_file, "["); |
} |
920,7 → 950,7
if (processfound) |
{ |
opencorchfound = 0; |
if (reg_found) |
if (reg_found || sigreg_found) |
{ |
fprintf (regs_file, "]"); |
} |
/trunk/src/sc2v_step2.h
35,6 → 35,7
char tipo[MAX_NAME_LENGTH]; |
int size; |
struct _port_node *next; |
int pflag; |
} PortNode; |
|
typedef struct _signal_node |
43,6 → 44,7
int size; |
int arraysize; |
struct _signal_node *next; |
int sflag; |
} SignalNode; |
|
typedef struct _bind_node |
65,6 → 67,7
int lenght; |
char name[MAX_NAME_LENGTH]; |
struct _funcinput_node *next; |
int sgnflag; |
} FunctionInputNode; |
|
|
74,6 → 77,7
int outputlenght; |
FunctionInputNode *list; |
struct _function_node *next; |
int sgnflag; |
} FunctionNode; |
|
typedef struct _sensibility_node |
138,12 → 142,12
WriteNode *ReadWritesFile (WriteNode *list,char *name); |
|
/* Functions for ports list*/ |
PortNode *InsertPort (PortNode *list,char *name, char *tipo, int size); |
PortNode *InsertPort (PortNode *list,char *name, char *tipo, int size, int pflag); |
void ShowPortList (PortNode *list); |
void EnumeratePorts (PortNode *list); |
|
/* Functions for signals list*/ |
SignalNode *InsertSignal (SignalNode *list,char *name, int size,int arraysize); |
SignalNode *InsertSignal (SignalNode *list,char *name, int size,int arraysize,int sflag); |
void ShowSignalsList (SignalNode* list, WriteNode* writeslist); |
int IsWire (char *name, InstanceNode * list); |
|
172,9 → 176,9
int findEnumerateLength (EnumListNode * list, int offset); |
|
/* Functions for functions inputs list*/ |
FunctionInputNode *InsertFunctionInput (FunctionInputNode * list, char *name, int lenght); |
FunctionInputNode *InsertFunctionInput (FunctionInputNode * list, char *name, int lenght, int flag); |
void ShowFunctionInputs (FunctionInputNode * 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); |
void ShowFunctionCode (FunctionNode *list); |
/trunk/src/sc2v_step2.y
47,10 → 47,12
char *lastportkind; |
int lastportsize; |
int activeport = 0; // 1 -> reading port list |
int portsign ; |
|
/* Global var to store last signal type*/ |
int lastsignalsize; |
int signalactive = 0; |
int signalsign ; |
|
|
/* Global var to store last SC_METHOD found*/ |
66,6 → 68,7
/* Global var to store last function found*/ |
char *functionname; |
int outputlenght = 0; |
int fsgnflag = 0; |
|
int translate; |
|
97,7 → 100,7
|
translate = 1; |
|
fprintf (stderr, "\nSystemC to Verilog Translator v0.4\n\n"); |
fprintf (stderr, "\nSystemC to Verilog Translator v0.6\n\n"); |
fprintf (stderr, "Parsing header file.......\n\n"); |
|
FILE *yyin = stdin; |
139,8 → 142,8
|
%} |
|
%token NUMBER SC_MODULE WORD OPENPAR CLOSEPAR SC_IN SC_OUT SEMICOLON BOOL ENUM |
%token MENOR MAYOR SC_REG SC_METHOD SENSITIVE_POS SENSITIVE_NEG SENSITIVE |
%token NUMBER SC_MODULE WORD OPENPAR CLOSEPAR SC_IN SC_OUT BOOL ENUM |
%token MENOR MAYOR SC_REG SC_SGNREG SC_METHOD SENSITIVE_POS SENSITIVE_NEG SENSITIVE |
%token SENSIBLE CLOSEKEY OPENKEY SEMICOLON COLON SC_SIGNAL ARROW EQUALS NEW QUOTE |
%token SC_CTOR VOID ASTERISCO TRANSLATEON TRANSLATEOFF OPENCORCH CLOSECORCH |
|
154,10 → 157,14
| |
in_sc_reg |
| |
in_sc_reg_sgn |
| |
out_bool |
| |
out_sc_reg |
| |
out_sc_reg_sgn |
| |
sc_method |
| |
sensitive_pos |
190,6 → 197,8
| |
signal_reg |
| |
signal_reg_sgn |
| |
instantation |
| |
port_binding |
230,6 → 239,12
| |
finishfunctioninputs |
| |
function_sgn |
| |
functioninputs_sgn |
| |
finishfunctioninputs_sgn |
| |
boolfunction |
| |
boolfunctioninputs |
273,10 → 288,23
activeport = 1; |
lastportsize = $5; |
lastportkind = (char *) "input"; |
portsign = 0; |
} |
}; |
|
in_sc_reg_sgn: |
SC_IN MENOR SC_SGNREG MENOR NUMBER MAYOR MAYOR |
{ |
if (translate == 1) |
{ |
activeport = 1; |
lastportsize = $5; |
lastportkind = (char *) "input"; |
portsign = 1; |
} |
}; |
|
|
in_bool: |
SC_IN MENOR BOOL MAYOR |
{ |
285,6 → 313,7
activeport = 1; |
lastportsize = 0; |
lastportkind = (char *) "input"; |
portsign = 0; |
} |
}; |
|
307,9 → 336,21
{ |
signalactive = 1; |
lastsignalsize = $5; |
signalsign = 0; |
} |
}; |
|
signal_reg_sgn: |
SC_SIGNAL MENOR SC_SGNREG MENOR NUMBER MAYOR MAYOR |
{ |
if (translate == 1) |
{ |
signalactive = 1; |
lastsignalsize = $5; |
signalsign = 1; |
} |
}; |
|
out_bool: |
SC_OUT MENOR BOOL MAYOR |
{ |
318,6 → 359,7
activeport = 1; |
lastportsize = 0; |
lastportkind = (char *) "output"; |
portsign = 0; |
} |
}; |
|
329,11 → 371,25
activeport = 1; |
lastportsize = $5; |
lastportkind = (char *) "output"; |
portsign = 0; |
} |
|
}; |
|
out_sc_reg_sgn: |
SC_OUT MENOR SC_SGNREG MENOR NUMBER MAYOR MAYOR |
{ |
if (translate == 1) |
{ |
activeport = 1; |
lastportsize = $5; |
lastportkind = (char *) "output"; |
portsign = 1; |
} |
|
}; |
|
|
sc_method: |
SC_METHOD OPENPAR WORD CLOSEPAR SEMICOLON |
{ |
478,7 → 534,7
{ |
if (signalactive) |
{ |
signalslist = InsertSignal (signalslist, (char *) $1, lastsignalsize,$3); |
signalslist = InsertSignal (signalslist, (char *) $1, lastsignalsize,$3, signalsign); |
signalactive = 0; |
} |
} |
488,7 → 544,7
{ |
if (signalactive) |
{ |
signalslist = InsertSignal (signalslist, (char *) $1, lastsignalsize,$3); |
signalslist = InsertSignal (signalslist, (char *) $1, lastsignalsize,$3,signalsign); |
signalactive = 0; |
} |
} |
501,12 → 557,12
if (activeport) |
{ |
portlist = |
InsertPort (portlist, (char *) $1, lastportkind, lastportsize); |
InsertPort (portlist, (char *) $1, lastportkind, lastportsize,portsign); |
activeport = 0; |
} |
else if (signalactive) |
{ |
signalslist = InsertSignal (signalslist, (char *) $1, lastsignalsize,0); |
signalslist = InsertSignal (signalslist, (char *) $1, lastsignalsize,0,signalsign); |
signalactive = 0; |
} |
else if (multipledec) |
521,7 → 577,7
{ |
//Calculate the number of bits needed to represent the enumerate |
length = findEnumerateLength (enumlistlist, list_pos); |
signalslist = InsertSignal (signalslist, (char *) $1, length, 0); |
signalslist = InsertSignal (signalslist, (char *) $1, length, 0,0); |
writeslist = InsertWrite (writeslist, (char *) $1); |
free (storedtype); |
multipledec = 0; |
546,11 → 602,11
{ |
if (activeport) |
{ |
portlist = InsertPort (portlist, (char *) $1, lastportkind, lastportsize); |
portlist = InsertPort (portlist, (char *) $1, lastportkind, lastportsize, portsign); |
} |
else if (signalactive) |
{ |
signalslist = InsertSignal (signalslist, (char *) $1, lastsignalsize, 0); |
signalslist = InsertSignal (signalslist, (char *) $1, lastsignalsize, 0,signalsign); |
} |
else if (reading_enumerates) |
{ |
570,7 → 626,7
{ |
//Calculate the number of bits needed to represent the enumerate |
length = findEnumerateLength (enumlistlist, list_pos); |
signalslist = InsertSignal (signalslist, (char *) $1, length, 0); |
signalslist = InsertSignal (signalslist, (char *) $1, length, 0, 0); |
writeslist = InsertWrite (writeslist, (char *) $1); |
multipledec = 1; |
} |
788,7 → 844,7
{ |
//Calculate the number of bits needed to represent the enumerate |
length = findEnumerateLength (enumlistlist, list_pos); |
signalslist = InsertSignal (signalslist, (char *) $2, length, 0); |
signalslist = InsertSignal (signalslist, (char *) $2, length, 0,0); |
writeslist = InsertWrite (writeslist, (char *) $2); |
} |
else |
825,7 → 881,7
length = findEnumerateLength (enumlistlist, list_pos); |
|
|
signalslist = InsertSignal (signalslist, (char *) $5, length, 0); |
signalslist = InsertSignal (signalslist, (char *) $5, length, 0,signalsign); |
|
writeslist = InsertWrite (writeslist, (char *) $5); |
|
872,7 → 928,7
|
strcpy (storedtype, (char *) $1); |
|
signalslist = InsertSignal (signalslist, (char *) $2, length,0); |
signalslist = InsertSignal (signalslist, (char *) $2, length,0,0); |
|
writeslist = InsertWrite (writeslist, (char *) $2); |
|
910,7 → 966,7
length = findEnumerateLength (enumlistlist, list_pos); |
storedtype = (char *) malloc (sizeof (char) * strlen ((char *) $3)); |
strcpy (storedtype, (char *) $3); |
signalslist = InsertSignal (signalslist, (char *) $5, length, 0); |
signalslist = InsertSignal (signalslist, (char *) $5, length, 0,0); |
writeslist = InsertWrite (writeslist, (char *) $5); |
multipledec = 1; |
} |
949,23 → 1005,51
functionname = (char *) $5; |
outputlenght = $3; |
funcinputslist = NULL; |
fsgnflag = 0; |
}; |
|
function_sgn: |
SC_SGNREG MENOR NUMBER MAYOR WORD OPENPAR |
{ |
fprintf (stderr, "line: %d Found {signed} Function Declaration \n", lineno); |
/* New inputs list */ |
functionname = (char *) $5; |
outputlenght = $3; |
funcinputslist = NULL; |
fsgnflag = 1; |
|
}; |
|
functioninputs: |
SC_REG MENOR NUMBER MAYOR WORD COLON |
{ |
funcinputslist = InsertFunctionInput (funcinputslist, (char *) $5, $3); |
funcinputslist = InsertFunctionInput (funcinputslist, (char *) $5, $3,0); |
}; |
|
functioninputs_sgn: |
SC_SGNREG MENOR NUMBER MAYOR WORD COLON |
{ |
funcinputslist = InsertFunctionInput (funcinputslist, (char *) $5, $3,1); |
}; |
|
finishfunctioninputs: |
SC_REG MENOR NUMBER MAYOR WORD CLOSEPAR SEMICOLON |
{ |
funcinputslist = InsertFunctionInput (funcinputslist, (char *) $5, $3); |
funcinputslist = InsertFunctionInput (funcinputslist, (char *) $5, $3,0); |
functionslist = |
InsertFunction (functionslist, functionname, funcinputslist, |
outputlenght); |
outputlenght,fsgnflag); |
}; |
|
finishfunctioninputs_sgn: |
SC_SGNREG MENOR NUMBER MAYOR WORD CLOSEPAR SEMICOLON |
{ |
funcinputslist = InsertFunctionInput (funcinputslist, (char *) $5, $3, 1); |
functionslist = |
InsertFunction (functionslist, functionname, funcinputslist, |
outputlenght, fsgnflag); |
}; |
|
boolfunction: |
BOOL WORD OPENPAR |
{ |
979,14 → 1063,14
boolfunctioninputs: |
BOOL WORD COLON |
{ |
funcinputslist = InsertFunctionInput (funcinputslist, (char *) $2, 1); |
funcinputslist = InsertFunctionInput (funcinputslist, (char *) $2,1,0); |
}; |
|
boolfinishfunctioninputs: |
BOOL WORD CLOSEPAR SEMICOLON |
{ |
funcinputslist = InsertFunctionInput (funcinputslist, (char *) $2, 1); |
funcinputslist = InsertFunctionInput (funcinputslist, (char *) $2,1,0); |
functionslist = |
InsertFunction (functionslist, functionname, funcinputslist, |
outputlenght); |
outputlenght,0); |
}; |
/trunk/src/sc2v_step1.l
42,9 → 42,9
[0-9]+ yylval=atoi(yytext); return NUMBER; |
"::" if(!includefound & !linecomment & !multilinecomment) return TWODOUBLEPOINTS; else {yylval=(int)strdup(yytext);} return COMMENT; |
"int" if(!includefound & !linecomment & !multilinecomment) return INTEGER; else {yylval=(int)strdup(yytext);} return COMMENT; |
sc_int if(!includefound & !linecomment & !multilinecomment) return SC_REG; else {yylval=(int)strdup(yytext);} return COMMENT; |
sc_int if(!includefound & !linecomment & !multilinecomment) return SC_SIGREG; else {yylval=(int)strdup(yytext);} return COMMENT; |
sc_uint if(!includefound & !linecomment & !multilinecomment) return SC_REG; else {yylval=(int)strdup(yytext);} return COMMENT; |
sc_bigint if(!includefound & !linecomment & !multilinecomment) return SC_REG; else {yylval=(int)strdup(yytext);} return COMMENT; |
sc_bigint if(!includefound & !linecomment & !multilinecomment) return SC_SIGREG; else {yylval=(int)strdup(yytext);} return COMMENT; |
sc_biguint if(!includefound & !linecomment & !multilinecomment) return SC_REG; else {yylval=(int)strdup(yytext);} return COMMENT; |
bool if(!includefound & !linecomment & !multilinecomment) return BOOL; else {yylval=(int)strdup(yytext);} return COMMENT; |
">" if(!includefound & !linecomment & !multilinecomment) return BIGGER; else {yylval=(int)strdup(yytext);} return COMMENT; |
/trunk/src/sc2v_step2.l
43,7 → 43,7
} |
SC_MODULE if(!includefound & !linecomment & !multilinecomment) return SC_MODULE; |
SC_METHOD if(!includefound & !linecomment & !multilinecomment) return SC_METHOD; |
SC_CTOR if(!includefound & !linecomment & !multilinecomment) return SC_CTOR; |
SC_CTOR if(!includefound & !linecomment & !multilinecomment) return SC_CTOR; |
"void" if(!includefound & !linecomment & !multilinecomment) return VOID; |
sensitive_pos if(!includefound & !linecomment & !multilinecomment) return SENSITIVE_POS; |
sensitive_neg if(!includefound & !linecomment & !multilinecomment) return SENSITIVE_NEG; |
55,9 → 55,9
"bool" if(!includefound & !linecomment & !multilinecomment) return BOOL; |
"<" if(!includefound & !linecomment & !multilinecomment) return MENOR; |
">" if(!includefound & !linecomment & !multilinecomment) return MAYOR; |
sc_int if(!includefound & !linecomment & !multilinecomment) return SC_REG; |
sc_uint if(!includefound & !linecomment & !multilinecomment) return SC_REG; |
sc_bigint if(!includefound & !linecomment & !multilinecomment) return SC_REG; |
sc_int if(!includefound & !linecomment & !multilinecomment) return SC_SGNREG; |
sc_uint if(!includefound & !linecomment & !multilinecomment) return SC_REG; |
sc_bigint if(!includefound & !linecomment & !multilinecomment) return SC_SGNREG; |
sc_biguint if(!includefound & !linecomment & !multilinecomment) return SC_REG; |
\( if(!includefound & !linecomment & !multilinecomment) return OPENPAR; |
\) if(!includefound & !linecomment & !multilinecomment) return CLOSEPAR; |
/trunk/src/sc2v_step2.c
103,7 → 103,7
} |
|
PortNode * |
InsertPort (PortNode * list, char *name, char *tipo, int size) |
InsertPort (PortNode * list, char *name, char *tipo, int size, int pflag) |
{ |
PortNode *pl; |
pl = (PortNode *) malloc (sizeof (PortNode)); |
110,6 → 110,7
strcpy (pl->name, name); |
strcpy (pl->tipo, tipo); |
pl->size = size; |
pl->pflag = pflag; |
SGLIB_LIST_ADD (PortNode, list, pl, next); |
return (list); |
} |
123,10 → 124,11
SGLIB_LIST_MAP_ON_ELEMENTS (PortNode, list, pll, next, |
{ |
printf ("%s ", pll->tipo); |
if (pll->pflag == 1) printf("signed "); |
if (pll->size != 0 && pll->size != 1) |
{ |
printf ("[%d:0] ", (-1 + pll->size));} |
printf ("%s;\n", pll->name); |
printf ("%s;\n", pll->name); |
} |
); |
return; |
142,7 → 144,7
if (strcmp (pll->tipo, "output") == 0) |
{ |
if(!IsWire(pll->name,instances)){ |
printf ("reg "); |
if (pll->pflag == 1) printf("reg signed "); else printf ("reg "); |
if (pll->size != 0 && pll->size != 1) |
{ |
printf ("[%d:0] ", (-1 + pll->size));} |
173,7 → 175,7
} |
|
SignalNode * |
InsertSignal (SignalNode * list, char *name, int size, int arraysize) |
InsertSignal (SignalNode * list, char *name, int size, int arraysize,int sflag) |
{ |
SignalNode *sl; |
|
181,6 → 183,7
strcpy (sl->name, name); |
sl->size = size; |
sl->arraysize=arraysize; |
sl->sflag=sflag; |
SGLIB_LIST_ADD (SignalNode, list, sl, next); |
return (list); |
|
195,7 → 198,7
{ |
if (IsWrite (writeslist, sll->name)) |
{ |
printf ("reg "); |
if (sll->sflag==1) printf("reg signed "); else printf ("reg "); |
if (sll->size != 0 && sll->size != 1) |
{ |
printf ("[%d:0] ", (-1 + sll->size)); |
204,7 → 207,7
} |
else |
{ |
printf ("wire "); |
if (sll->sflag==1) printf("wire signed "); else printf ("wire "); |
if (sll->size != 0 && sll->size != 1) |
{ |
printf ("[%d:0] ", (-1 + sll->size)); |
575,11 → 578,12
} |
|
/* 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; |
fl = (FunctionInputNode *) malloc (sizeof (FunctionInputNode)); |
strcpy (fl->name, name); |
fl->lenght=lenght; |
fl->sgnflag=flag; |
SGLIB_LIST_ADD (FunctionInputNode, list, fl, next); |
return (list); |
} |
592,20 → 596,29
|
SGLIB_LIST_MAP_ON_ELEMENTS (FunctionInputNode,list, fll,next, |
{ |
if(fll->sgnflag==0) |
{ |
if(fll->lenght!=1) |
printf("input [%d:0] %s;\n",(fll->lenght)-1,fll->name); |
else |
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*/ |
FunctionNode *InsertFunction (FunctionNode *list, char *name,FunctionInputNode *InputsList,int outputlenght){ |
FunctionNode *InsertFunction (FunctionNode *list, char *name,FunctionInputNode *InputsList,int outputlenght,int flag){ |
FunctionNode *fl; |
fl = (FunctionNode *) malloc (sizeof (FunctionNode)); |
strcpy (fl->name, name); |
fl->outputlenght=outputlenght; |
fl->list = InputsList; |
fl->sgnflag=flag; |
SGLIB_LIST_ADD (FunctionNode, list, fl, next); |
return (list); |
} |
622,11 → 635,19
|
SGLIB_LIST_MAP_ON_ELEMENTS (FunctionNode,list, fll,next, |
{ |
if(fll->sgnflag==0) |
{ |
if(fll->outputlenght!=1) |
printf("function [%d:0] %s;\n\n",(fll->outputlenght)-1,fll->name); |
else |
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); |
|
//Show Registers |
/trunk/README
1,71 → 1,71
/* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* the Free Software Foundation; either version 2 of the License, or |
* (at your option) any later version. |
* |
* This program is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU Library General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with this program; if not, write to the Free Software |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
*/ |
|
Authors: |
|
Pablo Huerta (pablo.huerta@urjc.es) |
Javier Castillo (javier.castillo@urjc.es) |
|
Contributors: |
|
David Moloney |
Harald Devos |
|
|
|
INSTRUCTIONS OF USE: |
|
1- Compiling the sources: |
|
The sc2v translator is based on lex and yacc tools. You need lex and yacc |
installed before trying to compile sc2v. |
|
For compiling the sources just type "make" under the directory you unzipped the |
fonts. It will generate three executables: sc2v_step1 and sc2v_step2 sc2v_step3. |
|
|
2- Translating an SystemC module: |
|
To translate use sc2v.sh script in the /bin directory just writting sc2v.sh module_name |
|
3- Format and restrictions of the SystemC files: |
|
- Each module must have a .h file with the declarations of ports, |
signals, and processes, and there must exist a .cpp file with the code |
of the processes. |
|
- For writing to a port or a signal you must ALWAYS use the .write() |
method. |
|
-Macros not fully supported. |
|
-Only data types: bool, sc_int, sc_bigint, sc_uint and sc_biguint are |
supported. |
|
-No global variables supported. |
|
4- Known bugs |
|
-The usage of macros and defines may cause some errors. |
|
5- For testing the application we recommend to use the systemcdes,systecaes and |
systemcmd5 cores, available at www.opencores.org. |
|
|
TODO: |
|
- Repair all known bugs. |
- Make macros fully supported. |
/* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* the Free Software Foundation; either version 2 of the License, or |
* (at your option) any later version. |
* |
* This program is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU Library General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with this program; if not, write to the Free Software |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
*/ |
|
Authors: |
|
Pablo Huerta (pablo.huerta@urjc.es) |
Javier Castillo (javier.castillo@urjc.es) |
|
Contributors: |
|
David Moloney |
Harald Devos |
Chris Stratford |
|
|
INSTRUCTIONS OF USE: |
|
1- Compiling the sources: |
|
The sc2v translator is based on lex and yacc tools. You need lex and yacc |
installed before trying to compile sc2v. |
|
For compiling the sources just type "make" under the directory you unzipped the |
fonts. It will generate three executables: sc2v_step1 and sc2v_step2 sc2v_step3. |
|
|
2- Translating an SystemC module: |
|
To translate use sc2v.sh script in the /bin directory just writting sc2v.sh module_name |
|
3- Format and restrictions of the SystemC files: |
|
- Each module must have a .h file with the declarations of ports, |
signals, and processes, and there must exist a .cpp file with the code |
of the processes. |
|
- For writing to a port or a signal you must ALWAYS use the .write() |
method. |
|
-Macros not fully supported. |
|
-Only data types: bool, sc_int, sc_bigint, sc_uint and sc_biguint are |
supported. |
|
-No global variables supported. |
|
4- Known bugs |
|
-The usage of macros and defines may cause some errors. |
|
5- For testing the application we recommend to use the systemcdes,systecaes and |
systemcmd5 cores, available at www.opencores.org. |
|
|
TODO: |
|
- Repair all known bugs. |
- Make macros fully supported. |