Corrected a major error with the verilog parser. The verilog

parser was not assigning the correct file number for the first
input file, which resulted in the effect that if the first
file read sets definitions for the netlist, then those definitions
are wiped out on the following file read.  There has been a workaround
to read from /dev/null on the first file read so that the file number
is set on all subsequent reads.  This fix avoids the need for the
workaround.
This commit is contained in:
R. Timothy Edwards 2025-12-08 16:45:27 -05:00
parent 8a20b90074
commit c0c9993980
1 changed files with 14 additions and 6 deletions

View File

@ -76,7 +76,8 @@ struct hashdict verilogparams;
// Global storage for verilog definitions
struct hashdict verilogdefs;
// Record file pointer that is associated with the hash tables
int hashfile = -1;
int hashfilep = -1; /* for parameters */
int hashfiled = -1; /* for definitions */
// Global storage for wire buses
struct hashdict buses;
@ -2999,18 +3000,25 @@ char *ReadVerilogTop(char *fname, int *fnum, int blackbox)
hashfunc = hashcase;
}
if ((hashfile != -1) && (hashfile != *fnum)) {
/* Started a new file, so remove all the parameters and definitions */
if ((hashfilep != -1) && (hashfilep != *fnum)) {
/* Started a new file, so remove all the parameters */
RecurseHashTable(&verilogparams, freeprop);
HashKill(&verilogparams);
hashfilep = -1;
}
if ((hashfiled != -1) && (hashfiled != *fnum)) {
/* Started a new file, so remove all the definitions */
RecurseHashTable(&verilogdefs, freeprop);
HashKill(&verilogdefs);
hashfile = -1;
hashfiled = -1;
}
if (hashfile == -1) {
if (hashfilep == -1) {
InitializeHashTable(&verilogparams, OBJHASHSIZE);
hashfilep = filenum;
}
if (hashfiled == -1) {
InitializeHashTable(&verilogdefs, OBJHASHSIZE);
hashfile = *fnum;
hashfiled = filenum;
}
definitions = &verilogdefs;