Skip to content

Commit 36cc78f

Browse files
authored
Merge pull request #1936 from verilog-to-routing/S10_vqm2blif_fixes
Update the vqm2blif parser to add support for Stratix 10 and Agliex vqm files
2 parents 6aa5209 + fc53f08 commit 36cc78f

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

libs/libvqm/vqm_parser.l

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838

3939
%%
4040
^[ \t]*\/\/[^\n\r]*(\n|\r\n) /* skip one-line comments */
41+
^[ \t]*\(\*[^\n\r]*\*\) /* skip synthesis attributes and directives */
4142
[ \t]+ /* skip white spaces */
43+
! /* skip the logical operator ! applied on the input ports of the lut - this results in lut mask not being valid anoymore */
4244
(\n|\r\n) /* skip empty lines */
4345
module return TOKEN_MODULE;
4446
endmodule return TOKEN_ENDMODULE;
@@ -60,7 +62,7 @@ assign return TOKEN_ASSIGN;
6062
yylval.value = atoi(yytext);
6163
return TOKEN_INTCONSTANT;
6264
}
63-
\\[^ ^\t]+ {
65+
\\[^ ^\t^;]+ {
6466
yylval.string = (char *)malloc(yyleng);
6567
strcpy(yylval.string, yytext+1);
6668
return TOKEN_ESCAPEDID;
@@ -71,7 +73,7 @@ assign return TOKEN_ASSIGN;
7173
yylval.string[yyleng-2] = 0;
7274
return TOKEN_STRING;
7375
}
74-
[1-9][0-9]*'b[0-9]+ {
76+
[1-9][0-9]*'[b|h][0-9|A-F]+ { /* bit strings can be in binary or hexadecimal format */
7577
yylval.string = (char *)malloc(yyleng+1);
7678
strcpy(yylval.string, yytext);
7779
return TOKEN_BITSTRING;

libs/libvqm/vqm_parser.y

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ modules: /* Empty */ {}
8484
| modules module {}
8585
;
8686

87-
module: header declarations statements footer
87+
module: header body footer
8888
{
8989
if(parse_info->pass_type == COUNT_PASS) {
9090
parse_info->number_of_modules++;
@@ -126,11 +126,17 @@ header: TOKEN_MODULE TOKEN_REGULARID '(' IdentifierList ')' ';'
126126
}
127127
;
128128

129+
body: /* Empty */ {}
130+
| body declaration_statement {} /* the body consists of a mix of declarations and statements */
131+
;
132+
129133

130-
declarations: /* Empty */ {}
131-
| declarations declaration {}
134+
declaration_statement: declaration
135+
|
136+
statement
132137
;
133138

139+
134140
declaration: PinType IdentifierList ';'
135141
{
136142
if(parse_info->pass_type == COUNT_PASS) {
@@ -158,9 +164,7 @@ declaration: PinType IdentifierList ';'
158164
footer: TOKEN_ENDMODULE {}
159165
;
160166

161-
statements: /* Empty */ {}
162-
| statements statement {}
163-
;
167+
164168

165169
statement: AssignStatement {}
166170
| TriStatement {}
@@ -673,7 +677,16 @@ IdentifierList: Identifier
673677
}
674678
;
675679

676-
Identifier: TOKEN_ESCAPEDID
680+
Identifier: TOKEN_ESCAPEDID '[' TOKEN_INTCONSTANT ']'
681+
{
682+
if(parse_info->pass_type == COUNT_PASS) {
683+
//pass
684+
} else {
685+
/* Allocate space for an identifier. Specify index used */
686+
$$ = (uintptr_t) allocate_identifier($1, T_TRUE, $3);
687+
}
688+
}
689+
| TOKEN_ESCAPEDID
677690
{
678691
if(parse_info->pass_type == COUNT_PASS) {
679692
//pass

utils/vqm2blif/src/base/vqm2blif_util.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ extern t_boolean buffd_outs; //user-set flag that regulates whether to keep buff
197197
*/
198198
const map<std::string, DeviceInfo> device_parameter_database {
199199
// stratix 4 device
200-
{"stratixiv", {"stratixiv_lcell_comb", "combout", 1, "dffeas", "q" }}
200+
{"stratixiv", {"stratixiv_lcell_comb", "combout", 1, "dffeas", "q" }},
201+
{"stratix10", {"fourteennm_lcell_comb", "combout", 1, "fourteennm_ff", "q" }},
202+
{"agilex", {"tennm_lcell_comb", "combout", 1, "tennm_ff", "q" }}
201203
};
202204

203205
#endif

0 commit comments

Comments
 (0)