Small typo, large effect; wrong reference to ob1 (instead of ob2) in
flatten.c can cause a segfault when analyzing whether flattening cells generates a better circuit match.
This commit is contained in:
parent
8c7d2ae239
commit
7889e2ae73
|
|
@ -1919,7 +1919,7 @@ PrematchLists(char *name1, int file1, char *name2, int file2)
|
||||||
char *dstr = NULL;
|
char *dstr = NULL;
|
||||||
tc2 = LookupCellFile(ob2->model.class, ecomp0X->cell2->file);
|
tc2 = LookupCellFile(ob2->model.class, ecomp0X->cell2->file);
|
||||||
if (tc2->flags & CELL_DUPLICATE) {
|
if (tc2->flags & CELL_DUPLICATE) {
|
||||||
dstr = strstr(ob1->model.class, "[[");
|
dstr = strstr(ob2->model.class, "[[");
|
||||||
if (dstr) *dstr = '\0';
|
if (dstr) *dstr = '\0';
|
||||||
}
|
}
|
||||||
ncomp = (ECompare *)HashInt2Lookup(ob2->model.class,
|
ncomp = (ECompare *)HashInt2Lookup(ob2->model.class,
|
||||||
|
|
|
||||||
|
|
@ -1062,14 +1062,25 @@ skip_endmodule:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (match(nexttok, "wire")) { /* wire = node */
|
else if (match(nexttok, "wire") || match(nexttok, "assign")) { /* wire = node */
|
||||||
struct bus wb, *nb;
|
struct bus wb, *nb;
|
||||||
char nodename[128];
|
char nodename[128];
|
||||||
|
int is_assignment = FALSE;
|
||||||
|
struct objlist *lhs, *rhs;
|
||||||
|
|
||||||
|
// Several allowed uses of "assign":
|
||||||
|
// "assign a = b" joins two nets.
|
||||||
|
// "assign a = {b, c, ...}" creates a bus from components.
|
||||||
|
// "assign" using any boolean arithmetic is not structural verilog.
|
||||||
|
|
||||||
SkipTokNoNewline(VLOG_DELIMITERS);
|
SkipTokNoNewline(VLOG_DELIMITERS);
|
||||||
if (match(nexttok, "real")) SkipTokNoNewline(VLOG_DELIMITERS);
|
if (match(nexttok, "real")) SkipTokNoNewline(VLOG_DELIMITERS);
|
||||||
while (nexttok != NULL) {
|
while (nexttok != NULL) {
|
||||||
/* Handle bus notation */
|
if (match(nexttok, "=")) {
|
||||||
if (GetBusTok(&wb) == 0) {
|
is_assignment = TRUE;
|
||||||
|
}
|
||||||
|
else if (GetBusTok(&wb) == 0) {
|
||||||
|
/* Handle bus notation */
|
||||||
SkipTokNoNewline(VLOG_DELIMITERS);
|
SkipTokNoNewline(VLOG_DELIMITERS);
|
||||||
if (wb.start > wb.end) {
|
if (wb.start > wb.end) {
|
||||||
for (i = wb.end; i <= wb.start; i++) {
|
for (i = wb.end; i <= wb.start; i++) {
|
||||||
|
|
@ -1091,8 +1102,24 @@ skip_endmodule:
|
||||||
HashPtrInstall(nexttok, nb, &buses);
|
HashPtrInstall(nexttok, nb, &buses);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (LookupObject(nexttok, CurrentCell) == NULL)
|
if (is_assignment) {
|
||||||
|
/* Handle assignment statements */
|
||||||
|
/* To be done: Handle where both are bus names, and */
|
||||||
|
/* where lhs is a bus name and rhs is a list of nets */
|
||||||
|
if ((rhs = LookupObject(nexttok, CurrentCell)) != NULL) {
|
||||||
|
join(lhs->name, rhs->name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Printf("Module '%s' is not structural verilog, "
|
||||||
|
"making black-box.\n", model);
|
||||||
|
SetClass(CLASS_MODULE);
|
||||||
|
goto skip_endmodule;
|
||||||
|
}
|
||||||
|
is_assignment = FALSE;
|
||||||
|
}
|
||||||
|
else if (LookupObject(nexttok, CurrentCell) == NULL)
|
||||||
Node(nexttok);
|
Node(nexttok);
|
||||||
|
lhs = LookupObject(nexttok, CurrentCell);
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
SkipTokNoNewline(VLOG_DELIMITERS);
|
SkipTokNoNewline(VLOG_DELIMITERS);
|
||||||
|
|
@ -1108,8 +1135,7 @@ skip_endmodule:
|
||||||
// Ignore any other directive starting with a backtick
|
// Ignore any other directive starting with a backtick
|
||||||
SkipNewLine(VLOG_DELIMITERS);
|
SkipNewLine(VLOG_DELIMITERS);
|
||||||
}
|
}
|
||||||
else if (match(nexttok, "reg") || match(nexttok, "assign")
|
else if (match(nexttok, "reg") || match(nexttok, "always")) {
|
||||||
|| match(nexttok, "always")) {
|
|
||||||
Printf("Module '%s' is not structural verilog, making black-box.\n", model);
|
Printf("Module '%s' is not structural verilog, making black-box.\n", model);
|
||||||
// To be done: Remove any contents (but may not be necessary)
|
// To be done: Remove any contents (but may not be necessary)
|
||||||
// Recast as module
|
// Recast as module
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue