Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/vhd2vl.l
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ int scan_int(char *s);
"in" { return IN; }
"inout" { return INOUT; }
"is" { return IS; }
"length" { return LENGTH; }
"library ".*\n { lineno++; }
"loop" { return LOOP; }
"map" { return MAP; }
Expand Down
18 changes: 17 additions & 1 deletion src/vhd2vl.y
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ slist *emit_io_list(slist *sl)
%token <txt> FOR LOOP GENERATE
%token <txt> AFTER AND OR NAND NOR XOR XNOR MOD RW_REM POW
%token <txt> LASTVALUE EVENT POSEDGE NEGEDGE
%token <txt> STRING NAME RANGE NULLV OPEN
%token <txt> STRING NAME RANGE LENGTH NULLV OPEN
%token <txt> CONVFUNC_1 CONVFUNC_2 BASED FLOAT LEFT
%token <txt> SCIENTIFIC REAL
%token <txt> ASSERT REPORT SEVERITY WARNING ERROR FAILURE NOTE
Expand Down Expand Up @@ -2465,6 +2465,22 @@ expr : signal {
/* two argument type conversion e.g. to_unsigned(x, 3) */
$$ = addnest($3);
}
| NAME '\'' LENGTH {
/* lookup NAME and copy its length */
sglist *sg = NULL;
if ((sg=lookup(io_list,$1))==NULL) {
sg=lookup(sig_list,$1);
}
if(sg) {
expdata *e=xmalloc(sizeof(expdata));
e->op='t'; /* Terminal symbol */
e->sl=addval(NULL,sg->range->sizeval);
$$ = e;
} else {
fprintf(stderr,"ERROR (line %d): undefined length \"%s'length\".\n", lineno, $1);
YYABORT;
}
}
| '(' expr ')' {
$$ = addnest($2);
}
Expand Down