Skip to content

Update the vqm2blif parser to add support for Stratix 10 and Agliex vqm files #1936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Dec 17, 2021
6 changes: 4 additions & 2 deletions libs/libvqm/vqm_parser.l
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@

%%
^[ \t]*\/\/[^\n\r]*(\n|\r\n) /* skip one-line comments */
^[ \t]*\(\*[^\n\r]*\*\) /* skip synthesis attributes and directives */
[ \t]+ /* skip white spaces */
! /* skip the logical operator ! applied on the input ports of the lut - this results in lut mask not being valid anoymore */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably want to explain this means inversion in the vqm netlist, but we are ignoring it (hence the LUTmask won't be correct).

(\n|\r\n) /* skip empty lines */
module return TOKEN_MODULE;
endmodule return TOKEN_ENDMODULE;
Expand All @@ -60,7 +62,7 @@ assign return TOKEN_ASSIGN;
yylval.value = atoi(yytext);
return TOKEN_INTCONSTANT;
}
\\[^ ^\t]+ {
\\[^ ^\t^;]+ {
yylval.string = (char *)malloc(yyleng);
strcpy(yylval.string, yytext+1);
return TOKEN_ESCAPEDID;
Expand All @@ -71,7 +73,7 @@ assign return TOKEN_ASSIGN;
yylval.string[yyleng-2] = 0;
return TOKEN_STRING;
}
[1-9][0-9]*'b[0-9]+ {
[1-9][0-9]*'[b|h][0-9|A-F]+ { /* bit strings can be in binary or hexadecimal format */
yylval.string = (char *)malloc(yyleng+1);
strcpy(yylval.string, yytext);
return TOKEN_BITSTRING;
Expand Down
27 changes: 20 additions & 7 deletions libs/libvqm/vqm_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ modules: /* Empty */ {}
| modules module {}
;

module: header declarations statements footer
module: header body footer
{
if(parse_info->pass_type == COUNT_PASS) {
parse_info->number_of_modules++;
Expand Down Expand Up @@ -126,11 +126,17 @@ header: TOKEN_MODULE TOKEN_REGULARID '(' IdentifierList ')' ';'
}
;

body: /* Empty */ {}
| body declaration_statement {} /* the body consists of a mix of declarations and statements */
;


declarations: /* Empty */ {}
| declarations declaration {}
declaration_statement: declaration
|
statement
;


declaration: PinType IdentifierList ';'
{
if(parse_info->pass_type == COUNT_PASS) {
Expand Down Expand Up @@ -158,9 +164,7 @@ declaration: PinType IdentifierList ';'
footer: TOKEN_ENDMODULE {}
;

statements: /* Empty */ {}
| statements statement {}
;


statement: AssignStatement {}
| TriStatement {}
Expand Down Expand Up @@ -673,7 +677,16 @@ IdentifierList: Identifier
}
;

Identifier: TOKEN_ESCAPEDID
Identifier: TOKEN_ESCAPEDID '[' TOKEN_INTCONSTANT ']'
{
if(parse_info->pass_type == COUNT_PASS) {
//pass
} else {
/* Allocate space for an identifier. Specify index used */
$$ = (uintptr_t) allocate_identifier($1, T_TRUE, $3);
}
}
| TOKEN_ESCAPEDID
{
if(parse_info->pass_type == COUNT_PASS) {
//pass
Expand Down
4 changes: 3 additions & 1 deletion utils/vqm2blif/src/base/vqm2blif_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ extern t_boolean buffd_outs; //user-set flag that regulates whether to keep buff
*/
const map<std::string, DeviceInfo> device_parameter_database {
// stratix 4 device
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a more descriptive comment here (device family, combinational cell name, output name, 1?, dff name, dff output name).

{"stratixiv", {"stratixiv_lcell_comb", "combout", 1, "dffeas", "q" }}
{"stratixiv", {"stratixiv_lcell_comb", "combout", 1, "dffeas", "q" }},
{"stratix10", {"fourteennm_lcell_comb", "combout", 1, "fourteennm_ff", "q" }},
{"agilex", {"tennm_lcell_comb", "combout", 1, "tennm_ff", "q" }}
};

#endif
Expand Down