Internals: Fix many clang-tidy issues. No functional change intended.
This commit is contained in:
parent
5ae1ce90ad
commit
304a24d03a
|
|
@ -0,0 +1,9 @@
|
||||||
|
Checks: 'clang-diagnostic-*,clang-analyzer-*,*,-modernize*,-hicpp*,-android-cloexec-fopen,-cert-dcl50-cpp,-cert-env33-c,-cert-err34-c,-cert-err58-cpp,-clang-analyzer-core.UndefinedBinaryOperatorResult,-clang-analyzer-security*,-cppcoreguidelines-no-malloc,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-special-member-functions,-fuchsia-default-arguments,-fuchsia-overloaded-operator,-google-default-arguments,-google-readability-todo,-google-runtime-references,-llvm-header-guard,-llvm-include-order,-misc-string-integer-assignment,-misc-string-literal-with-embedded-nul,-readability-braces-around-statements,-readability-container-size-empty,-readability-delete-null-pointer,-readability-else-after-return,-readability-implicit-bool-conversion,-readability-named-parameter,-readability-static-accessed-through-instance'
|
||||||
|
WarningsAsErrors: ''
|
||||||
|
HeaderFilterRegex: ''
|
||||||
|
FormatStyle: none
|
||||||
|
CheckOptions:
|
||||||
|
- key: google-readability-braces-around-statements.ShortStatementLines
|
||||||
|
value: '2'
|
||||||
|
- key: google-readability-namespace-comments.SpacesBeforeComments
|
||||||
|
value: '2'
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
\#*
|
\#*
|
||||||
.#*
|
.#*
|
||||||
*~
|
*~
|
||||||
|
*.tidy
|
||||||
*.old
|
*.old
|
||||||
*.gz
|
*.gz
|
||||||
*.gz.uu
|
*.gz.uu
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
^CVS/
|
\.clang-tidy
|
||||||
/CVS/
|
|
||||||
\.git/
|
\.git/
|
||||||
\.svn/
|
\.svn/
|
||||||
\.(bak|old)/
|
\.(bak|old)/
|
||||||
|
|
@ -9,6 +8,7 @@
|
||||||
.*\.log
|
.*\.log
|
||||||
\..*\.swp
|
\..*\.swp
|
||||||
.*\.tmp
|
.*\.tmp
|
||||||
|
.*\.tidy
|
||||||
.*\.tex
|
.*\.tex
|
||||||
.*\.key
|
.*\.key
|
||||||
.*\.vcd
|
.*\.vcd
|
||||||
|
|
|
||||||
21
Makefile.in
21
Makefile.in
|
|
@ -427,14 +427,16 @@ endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Use --xml flag to see the cppcheck code to use for suppression
|
# Use --xml flag to see the cppcheck code to use for suppression
|
||||||
|
CPPCHECK_CPP = $(wildcard \
|
||||||
|
$(srcdir)/include/*.cpp \
|
||||||
|
$(srcdir)/src/*.cpp )
|
||||||
|
CPPCHECK_H = $(wildcard \
|
||||||
|
$(srcdir)/include/*.h \
|
||||||
|
$(srcdir)/src/*.h )
|
||||||
CPPCHECK = src/cppcheck_filtered
|
CPPCHECK = src/cppcheck_filtered
|
||||||
CPPCHECK_FLAGS = --enable=all --inline-suppr \
|
CPPCHECK_FLAGS = --enable=all --inline-suppr \
|
||||||
--suppress=unusedScopedObject --suppress=cstyleCast --suppress=useInitializationList
|
--suppress=unusedScopedObject --suppress=cstyleCast --suppress=useInitializationList
|
||||||
CPPCHECK_FLAGS += --xml
|
CPPCHECK_FLAGS += --xml
|
||||||
CPPCHECK_CPP = $(wildcard \
|
|
||||||
$(srcdir)/include/*.cpp \
|
|
||||||
$(srcdir)/include/gtkwave/*.cpp \
|
|
||||||
$(srcdir)/src/*.cpp)
|
|
||||||
CPPCHECK_DEP = $(subst .cpp,.cppcheck,$(CPPCHECK_CPP))
|
CPPCHECK_DEP = $(subst .cpp,.cppcheck,$(CPPCHECK_CPP))
|
||||||
CPPCHECK_INC = -I$(srcdir)/include -I$(srcdir)/src/obj_dbg -I$(srcdir)/src
|
CPPCHECK_INC = -I$(srcdir)/include -I$(srcdir)/src/obj_dbg -I$(srcdir)/src
|
||||||
|
|
||||||
|
|
@ -442,6 +444,17 @@ cppcheck: $(CPPCHECK_DEP)
|
||||||
%.cppcheck: %.cpp
|
%.cppcheck: %.cpp
|
||||||
$(CPPCHECK) $(CPPCHECK_FLAGS) -DVL_DEBUG=1 -DVL_CPPCHECK=1 $(CPPCHECK_INC) $<
|
$(CPPCHECK) $(CPPCHECK_FLAGS) -DVL_DEBUG=1 -DVL_CPPCHECK=1 $(CPPCHECK_INC) $<
|
||||||
|
|
||||||
|
CLANGTIDY = clang-tidy
|
||||||
|
CLANGTIDY_FLAGS = -config=''
|
||||||
|
CLANGTIDY_DEP = $(subst .h,.h.tidy,$(CPPCHECK_H)) \
|
||||||
|
$(subst .cpp,.cpp.tidy,$(CPPCHECK_CPP))
|
||||||
|
|
||||||
|
clangtidy: $(CLANGTIDY_DEP)
|
||||||
|
%.cpp.tidy: %.cpp
|
||||||
|
$(CLANGTIDY) $(CLANGTIDY_FLAGS) $< -- -DVL_DEBUG=1 -DVL_CPPCHECK=1 $(CPPCHECK_INC) | 2>&1 tee $@
|
||||||
|
%.h.tidy: %.h
|
||||||
|
$(CLANGTIDY) $(CLANGTIDY_FLAGS) $< -- -DVL_DEBUG=1 -DVL_CPPCHECK=1 $(CPPCHECK_INC) | 2>&1 tee $@
|
||||||
|
|
||||||
analyzer-src:
|
analyzer-src:
|
||||||
-rm -rf src/obj_dbg
|
-rm -rf src/obj_dbg
|
||||||
scan-build $(MAKE) -k verilator_coverage_bin_dbg verilator_bin_dbg
|
scan-build $(MAKE) -k verilator_coverage_bin_dbg verilator_bin_dbg
|
||||||
|
|
|
||||||
|
|
@ -135,13 +135,11 @@ std::string _vl_string_vprintf(const char* formatp, va_list ap) VL_MT_SAFE {
|
||||||
int len = VL_VSNPRINTF(NULL, 0, formatp, aq);
|
int len = VL_VSNPRINTF(NULL, 0, formatp, aq);
|
||||||
va_end(aq);
|
va_end(aq);
|
||||||
if (VL_UNLIKELY(len < 1)) {
|
if (VL_UNLIKELY(len < 1)) {
|
||||||
va_end(ap);
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
char* bufp = new char[len+1];
|
char* bufp = new char[len+1];
|
||||||
VL_VSNPRINTF(bufp, len+1, formatp, ap);
|
VL_VSNPRINTF(bufp, len+1, formatp, ap);
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
std::string out = std::string(bufp, len);
|
std::string out = std::string(bufp, len);
|
||||||
delete[] bufp;
|
delete[] bufp;
|
||||||
|
|
@ -240,10 +238,10 @@ vluint64_t vl_rand64() VL_MT_SAFE {
|
||||||
t_seeded = true;
|
t_seeded = true;
|
||||||
{
|
{
|
||||||
VerilatedLockGuard lock(s_mutex);
|
VerilatedLockGuard lock(s_mutex);
|
||||||
t_state[0] = (((vluint64_t)vl_sys_rand32())<<32
|
t_state[0] = ((static_cast<vluint64_t>(vl_sys_rand32()) << 32)
|
||||||
^ ((vluint64_t)vl_sys_rand32()));
|
^ (static_cast<vluint64_t>(vl_sys_rand32())));
|
||||||
t_state[1] = (((vluint64_t)vl_sys_rand32())<<32
|
t_state[1] = ((static_cast<vluint64_t>(vl_sys_rand32()) << 32)
|
||||||
^ ((vluint64_t)vl_sys_rand32()));
|
^ (static_cast<vluint64_t>(vl_sys_rand32())));
|
||||||
// Fix state as algorithm is slow to randomize if many zeros
|
// Fix state as algorithm is slow to randomize if many zeros
|
||||||
// This causes a loss of ~ 1 bit of seed entropy, no big deal
|
// This causes a loss of ~ 1 bit of seed entropy, no big deal
|
||||||
if (VL_COUNTONES_I(t_state[0]) < 10) t_state[0] = ~t_state[0];
|
if (VL_COUNTONES_I(t_state[0]) < 10) t_state[0] = ~t_state[0];
|
||||||
|
|
@ -1245,19 +1243,19 @@ IData VL_SSCANF_INX(int, const std::string& ld, const char* formatp, ...) VL_MT_
|
||||||
}
|
}
|
||||||
|
|
||||||
void VL_WRITEMEM_Q(bool hex, int width, int depth, int array_lsb, int,
|
void VL_WRITEMEM_Q(bool hex, int width, int depth, int array_lsb, int,
|
||||||
QData ofilename, const void* memp, IData start,
|
QData filename, const void* memp, IData start,
|
||||||
IData end) VL_MT_SAFE {
|
IData end) VL_MT_SAFE {
|
||||||
WData fnw[2]; VL_SET_WQ(fnw, ofilename);
|
WData fnw[2]; VL_SET_WQ(fnw, filename);
|
||||||
return VL_WRITEMEM_W(hex, width,depth,array_lsb,2,fnw,memp,start,end);
|
return VL_WRITEMEM_W(hex, width, depth, array_lsb,2, fnw, memp, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VL_WRITEMEM_W(bool hex, int width, int depth, int array_lsb, int fnwords,
|
void VL_WRITEMEM_W(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
WDataInP ofilenamep, const void* memp, IData start,
|
WDataInP filenamep, const void* memp, IData start,
|
||||||
IData end) VL_MT_SAFE {
|
IData end) VL_MT_SAFE {
|
||||||
char ofilenamez[VL_TO_STRING_MAX_WORDS*VL_WORDSIZE+1];
|
char filenamez[VL_TO_STRING_MAX_WORDS*VL_WORDSIZE+1];
|
||||||
_VL_VINT_TO_STRING(fnwords*VL_WORDSIZE, ofilenamez, ofilenamep);
|
_VL_VINT_TO_STRING(fnwords*VL_WORDSIZE, filenamez, filenamep);
|
||||||
std::string ofilenames(ofilenamez);
|
std::string filenames(filenamez);
|
||||||
return VL_WRITEMEM_N(hex, width,depth,array_lsb,ofilenames,memp,start,end);
|
return VL_WRITEMEM_N(hex, width, depth, array_lsb, filenames, memp, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* memhFormat(int nBits) {
|
const char* memhFormat(int nBits) {
|
||||||
|
|
@ -1284,19 +1282,19 @@ void VL_WRITEMEM_N(
|
||||||
int depth, // Number of rows
|
int depth, // Number of rows
|
||||||
int array_lsb, // Index of first row. Valid row addresses
|
int array_lsb, // Index of first row. Valid row addresses
|
||||||
// // range from array_lsb up to (array_lsb + depth - 1)
|
// // range from array_lsb up to (array_lsb + depth - 1)
|
||||||
const std::string& ofilenamep, // Output file name
|
const std::string& filename, // Output file name
|
||||||
const void* memp, // Array state
|
const void* memp, // Array state
|
||||||
IData start, // First array row address to write
|
IData start, // First array row address to write
|
||||||
IData end // Last address to write
|
IData end // Last address to write
|
||||||
) VL_MT_SAFE {
|
) VL_MT_SAFE {
|
||||||
if (VL_UNLIKELY(!hex)) {
|
if (VL_UNLIKELY(!hex)) {
|
||||||
VL_FATAL_MT(ofilenamep.c_str(), 0, "",
|
VL_FATAL_MT(filename.c_str(), 0, "",
|
||||||
"VL_WRITEMEM_N only supports hex format for now, sorry!");
|
"VL_WRITEMEM_N only supports hex format for now, sorry!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FILE* fp = fopen(ofilenamep.c_str(), "w");
|
FILE* fp = fopen(filename.c_str(), "w");
|
||||||
if (VL_UNLIKELY(!fp)) {
|
if (VL_UNLIKELY(!fp)) {
|
||||||
VL_FATAL_MT(ofilenamep.c_str(), 0, "", "$writemem file not found");
|
VL_FATAL_MT(filename.c_str(), 0, "", "$writemem file not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1305,7 +1303,7 @@ void VL_WRITEMEM_N(
|
||||||
|| (row_addr > array_lsb + depth - 1)) {
|
|| (row_addr > array_lsb + depth - 1)) {
|
||||||
vluint32_t endmax = ~0;
|
vluint32_t endmax = ~0;
|
||||||
if (end != endmax) {
|
if (end != endmax) {
|
||||||
VL_FATAL_MT(ofilenamep.c_str(), 0, "",
|
VL_FATAL_MT(filename.c_str(), 0, "",
|
||||||
"$writemem specified address out-of-bounds");
|
"$writemem specified address out-of-bounds");
|
||||||
}
|
}
|
||||||
// else, it's not an error to overflow due to end == endmax,
|
// else, it's not an error to overflow due to end == endmax,
|
||||||
|
|
@ -1369,17 +1367,17 @@ void VL_WRITEMEM_N(
|
||||||
}
|
}
|
||||||
|
|
||||||
void VL_READMEM_Q(bool hex, int width, int depth, int array_lsb, int,
|
void VL_READMEM_Q(bool hex, int width, int depth, int array_lsb, int,
|
||||||
QData ofilename, void* memp, IData start, IData end) VL_MT_SAFE {
|
QData filename, void* memp, IData start, IData end) VL_MT_SAFE {
|
||||||
WData fnw[2]; VL_SET_WQ(fnw, ofilename);
|
WData fnw[2]; VL_SET_WQ(fnw, filename);
|
||||||
return VL_READMEM_W(hex,width,depth,array_lsb,2,fnw,memp,start,end);
|
return VL_READMEM_W(hex, width, depth, array_lsb, 2, fnw, memp, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VL_READMEM_W(bool hex, int width, int depth, int array_lsb, int fnwords,
|
void VL_READMEM_W(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
WDataInP ofilenamep, void* memp, IData start, IData end) VL_MT_SAFE {
|
WDataInP filenamep, void* memp, IData start, IData end) VL_MT_SAFE {
|
||||||
char ofilenamez[VL_TO_STRING_MAX_WORDS*VL_WORDSIZE+1];
|
char filenamez[VL_TO_STRING_MAX_WORDS*VL_WORDSIZE+1];
|
||||||
_VL_VINT_TO_STRING(fnwords*VL_WORDSIZE, ofilenamez, ofilenamep);
|
_VL_VINT_TO_STRING(fnwords*VL_WORDSIZE, filenamez, filenamep);
|
||||||
std::string ofilenames(ofilenamez);
|
std::string filenames(filenamez);
|
||||||
return VL_READMEM_N(hex,width,depth,array_lsb,ofilenames,memp,start,end);
|
return VL_READMEM_N(hex, width, depth, array_lsb, filenames, memp, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VL_READMEM_N(
|
void VL_READMEM_N(
|
||||||
|
|
@ -1388,15 +1386,15 @@ void VL_READMEM_N(
|
||||||
int depth, // Number of rows
|
int depth, // Number of rows
|
||||||
int array_lsb, // Index of first row. Valid row addresses
|
int array_lsb, // Index of first row. Valid row addresses
|
||||||
// // range from array_lsb up to (array_lsb + depth - 1)
|
// // range from array_lsb up to (array_lsb + depth - 1)
|
||||||
const std::string& ofilenamep, // Input file name
|
const std::string& filename, // Input file name
|
||||||
void* memp, // Array state
|
void* memp, // Array state
|
||||||
IData start, // First array row address to read
|
IData start, // First array row address to read
|
||||||
IData end // Last row address to read
|
IData end // Last row address to read
|
||||||
) VL_MT_SAFE {
|
) VL_MT_SAFE {
|
||||||
FILE* fp = fopen(ofilenamep.c_str(), "r");
|
FILE* fp = fopen(filename.c_str(), "r");
|
||||||
if (VL_UNLIKELY(!fp)) {
|
if (VL_UNLIKELY(!fp)) {
|
||||||
// We don't report the Verilog source filename as it slow to have to pass it down
|
// We don't report the Verilog source filename as it slow to have to pass it down
|
||||||
VL_FATAL_MT(ofilenamep.c_str(), 0, "", "$readmem file not found");
|
VL_FATAL_MT(filename.c_str(), 0, "", "$readmem file not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Prep for reading
|
// Prep for reading
|
||||||
|
|
@ -1443,7 +1441,7 @@ void VL_READMEM_N(
|
||||||
//printf(" Value width=%d @%x = %c\n", width, addr, c);
|
//printf(" Value width=%d @%x = %c\n", width, addr, c);
|
||||||
if (VL_UNLIKELY(addr >= static_cast<IData>(depth+array_lsb)
|
if (VL_UNLIKELY(addr >= static_cast<IData>(depth+array_lsb)
|
||||||
|| addr < static_cast<IData>(array_lsb))) {
|
|| addr < static_cast<IData>(array_lsb))) {
|
||||||
VL_FATAL_MT(ofilenamep.c_str(), linenum, "",
|
VL_FATAL_MT(filename.c_str(), linenum, "",
|
||||||
"$readmem file address beyond bounds of array");
|
"$readmem file address beyond bounds of array");
|
||||||
} else {
|
} else {
|
||||||
int entry = addr - array_lsb;
|
int entry = addr - array_lsb;
|
||||||
|
|
@ -1473,7 +1471,7 @@ void VL_READMEM_N(
|
||||||
datap[0] |= value;
|
datap[0] |= value;
|
||||||
}
|
}
|
||||||
if (VL_UNLIKELY(value>=(1<<shift))) {
|
if (VL_UNLIKELY(value>=(1<<shift))) {
|
||||||
VL_FATAL_MT(ofilenamep.c_str(), linenum, "",
|
VL_FATAL_MT(filename.c_str(), linenum, "",
|
||||||
"$readmemb (binary) file contains hex characters");
|
"$readmemb (binary) file contains hex characters");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1481,7 +1479,7 @@ void VL_READMEM_N(
|
||||||
innum = true;
|
innum = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
VL_FATAL_MT(ofilenamep.c_str(), linenum, "", "$readmem file syntax error");
|
VL_FATAL_MT(filename.c_str(), linenum, "", "$readmem file syntax error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastc = c;
|
lastc = c;
|
||||||
|
|
@ -1491,7 +1489,8 @@ void VL_READMEM_N(
|
||||||
// Final checks
|
// Final checks
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
if (VL_UNLIKELY(end != VL_UL(0xffffffff) && addr != (end+1))) {
|
if (VL_UNLIKELY(end != VL_UL(0xffffffff) && addr != (end+1))) {
|
||||||
VL_FATAL_MT(ofilenamep.c_str(), linenum, "", "$readmem file ended before specified ending-address");
|
VL_FATAL_MT(filename.c_str(), linenum, "",
|
||||||
|
"$readmem file ended before specified ending-address");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1499,16 +1498,16 @@ IData VL_SYSTEM_IQ(QData lhs) VL_MT_SAFE {
|
||||||
WData lhsw[2]; VL_SET_WQ(lhsw, lhs);
|
WData lhsw[2]; VL_SET_WQ(lhsw, lhs);
|
||||||
return VL_SYSTEM_IW(2, lhsw);
|
return VL_SYSTEM_IW(2, lhsw);
|
||||||
}
|
}
|
||||||
IData VL_SYSTEM_IW(int lhswords, WDataInP filenamep) VL_MT_SAFE {
|
IData VL_SYSTEM_IW(int lhswords, WDataInP lhsp) VL_MT_SAFE {
|
||||||
char filenamez[VL_TO_STRING_MAX_WORDS*VL_WORDSIZE+1];
|
char filenamez[VL_TO_STRING_MAX_WORDS*VL_WORDSIZE+1];
|
||||||
_VL_VINT_TO_STRING(lhswords*VL_WORDSIZE, filenamez, filenamep);
|
_VL_VINT_TO_STRING(lhswords*VL_WORDSIZE, filenamez, lhsp);
|
||||||
int code = system(filenamez); // Yes, system() is threadsafe
|
int code = system(filenamez); // Yes, system() is threadsafe
|
||||||
return code >> 8; // Want exit status
|
return code >> 8; // Want exit status
|
||||||
}
|
}
|
||||||
|
|
||||||
IData VL_TESTPLUSARGS_I(const char* formatp) VL_MT_SAFE {
|
IData VL_TESTPLUSARGS_I(const char* formatp) VL_MT_SAFE {
|
||||||
const std::string& match = VerilatedImp::argPlusMatch(formatp);
|
const std::string& match = VerilatedImp::argPlusMatch(formatp);
|
||||||
if (match == "") return 0;
|
if (match.empty()) return 0;
|
||||||
else return 1;
|
else return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1538,7 +1537,7 @@ IData VL_VALUEPLUSARGS_INW(int rbits, const std::string& ld, WDataOutP rwp) VL_M
|
||||||
|
|
||||||
const std::string& match = VerilatedImp::argPlusMatch(prefix.c_str());
|
const std::string& match = VerilatedImp::argPlusMatch(prefix.c_str());
|
||||||
const char* dp = match.c_str() + 1 /*leading + */ + prefix.length();
|
const char* dp = match.c_str() + 1 /*leading + */ + prefix.length();
|
||||||
if (match == "") return 0;
|
if (match.empty()) return 0;
|
||||||
|
|
||||||
VL_ZERO_RESET_W(rbits, rwp);
|
VL_ZERO_RESET_W(rbits, rwp);
|
||||||
switch (tolower(fmt)) {
|
switch (tolower(fmt)) {
|
||||||
|
|
@ -1594,7 +1593,7 @@ IData VL_VALUEPLUSARGS_INN(int, const std::string& ld, std::string& rdr) VL_MT_S
|
||||||
}
|
}
|
||||||
const std::string& match = VerilatedImp::argPlusMatch(prefix.c_str());
|
const std::string& match = VerilatedImp::argPlusMatch(prefix.c_str());
|
||||||
const char* dp = match.c_str() + 1 /*leading + */ + prefix.length();
|
const char* dp = match.c_str() + 1 /*leading + */ + prefix.length();
|
||||||
if (match == "") return 0;
|
if (match.empty()) return 0;
|
||||||
rdr = std::string(dp);
|
rdr = std::string(dp);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -1602,7 +1601,7 @@ IData VL_VALUEPLUSARGS_INN(int, const std::string& ld, std::string& rdr) VL_MT_S
|
||||||
const char* vl_mc_scan_plusargs(const char* prefixp) VL_MT_SAFE {
|
const char* vl_mc_scan_plusargs(const char* prefixp) VL_MT_SAFE {
|
||||||
const std::string& match = VerilatedImp::argPlusMatch(prefixp);
|
const std::string& match = VerilatedImp::argPlusMatch(prefixp);
|
||||||
static VL_THREAD_LOCAL char outstr[VL_VALUE_STRING_MAX_WIDTH];
|
static VL_THREAD_LOCAL char outstr[VL_VALUE_STRING_MAX_WIDTH];
|
||||||
if (match == "") return NULL;
|
if (match.empty()) return NULL;
|
||||||
strncpy(outstr, match.c_str()+strlen(prefixp)+1, // +1 to skip the "+"
|
strncpy(outstr, match.c_str()+strlen(prefixp)+1, // +1 to skip the "+"
|
||||||
VL_VALUE_STRING_MAX_WIDTH);
|
VL_VALUE_STRING_MAX_WIDTH);
|
||||||
outstr[VL_VALUE_STRING_MAX_WIDTH-1] = '\0';
|
outstr[VL_VALUE_STRING_MAX_WIDTH-1] = '\0';
|
||||||
|
|
@ -1646,10 +1645,10 @@ Verilated::ThreadLocal::ThreadLocal()
|
||||||
Verilated::ThreadLocal::~ThreadLocal() {
|
Verilated::ThreadLocal::~ThreadLocal() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Verilated::debug(int val) VL_MT_SAFE {
|
void Verilated::debug(int level) VL_MT_SAFE {
|
||||||
VerilatedLockGuard lock(m_mutex);
|
VerilatedLockGuard lock(m_mutex);
|
||||||
s_s.s_debug = val;
|
s_s.s_debug = level;
|
||||||
if (val) {
|
if (level) {
|
||||||
#ifdef VL_DEBUG
|
#ifdef VL_DEBUG
|
||||||
VL_DEBUG_IF(VL_DBG_MSGF("- Verilated::debug is on. Message prefix indicates {<thread>,<sequence_number>}.\n"););
|
VL_DEBUG_IF(VL_DBG_MSGF("- Verilated::debug is on. Message prefix indicates {<thread>,<sequence_number>}.\n"););
|
||||||
#else
|
#else
|
||||||
|
|
@ -1743,7 +1742,7 @@ void Verilated::commandArgs(int argc, const char** argv) VL_MT_SAFE {
|
||||||
const char* Verilated::commandArgsPlusMatch(const char* prefixp) VL_MT_SAFE {
|
const char* Verilated::commandArgsPlusMatch(const char* prefixp) VL_MT_SAFE {
|
||||||
const std::string& match = VerilatedImp::argPlusMatch(prefixp);
|
const std::string& match = VerilatedImp::argPlusMatch(prefixp);
|
||||||
static VL_THREAD_LOCAL char outstr[VL_VALUE_STRING_MAX_WIDTH];
|
static VL_THREAD_LOCAL char outstr[VL_VALUE_STRING_MAX_WIDTH];
|
||||||
if (match == "") return "";
|
if (match.empty()) return "";
|
||||||
strncpy(outstr, match.c_str(), VL_VALUE_STRING_MAX_WIDTH);
|
strncpy(outstr, match.c_str(), VL_VALUE_STRING_MAX_WIDTH);
|
||||||
outstr[VL_VALUE_STRING_MAX_WIDTH-1] = '\0';
|
outstr[VL_VALUE_STRING_MAX_WIDTH-1] = '\0';
|
||||||
return outstr;
|
return outstr;
|
||||||
|
|
@ -1917,7 +1916,8 @@ VerilatedModule::VerilatedModule(const char* namep)
|
||||||
|
|
||||||
VerilatedModule::~VerilatedModule() {
|
VerilatedModule::~VerilatedModule() {
|
||||||
// Memory cleanup - not called during normal operation
|
// Memory cleanup - not called during normal operation
|
||||||
if (m_namep) { free((void*)m_namep); m_namep=NULL; }
|
// NOLINTNEXTLINE(google-readability-casting)
|
||||||
|
if (m_namep) { free((void*)(m_namep)); m_namep=NULL; }
|
||||||
}
|
}
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
|
|
@ -2017,7 +2017,7 @@ void VerilatedScope::varInsert(int finalize, const char* namep, void* datap,
|
||||||
if (!finalize) return;
|
if (!finalize) return;
|
||||||
|
|
||||||
if (!m_varsp) m_varsp = new VerilatedVarNameMap();
|
if (!m_varsp) m_varsp = new VerilatedVarNameMap();
|
||||||
VerilatedVar var(namep, datap, vltype, (VerilatedVarFlags)vlflags, dims);
|
VerilatedVar var(namep, datap, vltype, static_cast<VerilatedVarFlags>(vlflags), dims);
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap,dims);
|
va_start(ap,dims);
|
||||||
|
|
|
||||||
|
|
@ -583,29 +583,29 @@ extern WDataOutP _vl_moddiv_w(int lbits, WDataOutP owp, WDataInP lwp, WDataInP r
|
||||||
/// File I/O
|
/// File I/O
|
||||||
extern IData VL_FGETS_IXI(int obits, void* destp, IData fpi);
|
extern IData VL_FGETS_IXI(int obits, void* destp, IData fpi);
|
||||||
|
|
||||||
extern IData VL_FOPEN_S(const char* filenamep, const char* mode);
|
extern IData VL_FOPEN_S(const char* filenamep, const char* modep);
|
||||||
extern IData VL_FOPEN_WI(int fnwords, WDataInP ofilename, IData mode);
|
extern IData VL_FOPEN_WI(int fnwords, WDataInP filenamep, IData mode);
|
||||||
extern IData VL_FOPEN_QI(QData ofilename, IData mode);
|
extern IData VL_FOPEN_QI(QData filename, IData mode);
|
||||||
inline IData VL_FOPEN_II(IData ofilename, IData mode) VL_MT_SAFE {
|
inline IData VL_FOPEN_II(IData filename, IData mode) VL_MT_SAFE {
|
||||||
return VL_FOPEN_QI(ofilename,mode); }
|
return VL_FOPEN_QI(filename,mode); }
|
||||||
|
|
||||||
extern void VL_FCLOSE_I(IData fdi);
|
extern void VL_FCLOSE_I(IData fdi);
|
||||||
|
|
||||||
extern void VL_READMEM_W(bool hex, int width, int depth, int array_lsb, int fnwords,
|
extern void VL_READMEM_W(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
WDataInP ofilename, void* memp, IData start, IData end);
|
WDataInP filenamep, void* memp, IData start, IData end);
|
||||||
extern void VL_READMEM_Q(bool hex, int width, int depth, int array_lsb, int fnwords,
|
extern void VL_READMEM_Q(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
QData ofilename, void* memp, IData start, IData end);
|
QData filename, void* memp, IData start, IData end);
|
||||||
inline void VL_READMEM_I(bool hex, int width, int depth, int array_lsb, int fnwords,
|
inline void VL_READMEM_I(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
IData ofilename, void* memp, IData start, IData end) VL_MT_SAFE {
|
IData filename, void* memp, IData start, IData end) VL_MT_SAFE {
|
||||||
VL_READMEM_Q(hex, width,depth,array_lsb,fnwords, ofilename,memp,start,end); }
|
VL_READMEM_Q(hex, width,depth,array_lsb,fnwords, filename,memp,start,end); }
|
||||||
|
|
||||||
extern void VL_WRITEMEM_W(bool hex, int width, int depth, int array_lsb, int fnwords,
|
extern void VL_WRITEMEM_W(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
WDataInP ofilename, const void* memp, IData start, IData end);
|
WDataInP filenamep, const void* memp, IData start, IData end);
|
||||||
extern void VL_WRITEMEM_Q(bool hex, int width, int depth, int array_lsb, int fnwords,
|
extern void VL_WRITEMEM_Q(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
QData ofilename, const void* memp, IData start, IData end);
|
QData filename, const void* memp, IData start, IData end);
|
||||||
inline void VL_WRITEMEM_I(bool hex, int width, int depth, int array_lsb, int fnwords,
|
inline void VL_WRITEMEM_I(bool hex, int width, int depth, int array_lsb, int fnwords,
|
||||||
IData ofilename, const void* memp, IData start, IData end) VL_MT_SAFE {
|
IData filename, const void* memp, IData start, IData end) VL_MT_SAFE {
|
||||||
VL_WRITEMEM_Q(hex, width,depth,array_lsb,fnwords, ofilename,memp,start,end); }
|
VL_WRITEMEM_Q(hex, width,depth,array_lsb,fnwords, filename,memp,start,end); }
|
||||||
|
|
||||||
extern void VL_WRITEF(const char* formatp, ...);
|
extern void VL_WRITEF(const char* formatp, ...);
|
||||||
extern void VL_FWRITEF(IData fpi, const char* formatp, ...);
|
extern void VL_FWRITEF(IData fpi, const char* formatp, ...);
|
||||||
|
|
@ -621,7 +621,7 @@ extern void VL_SFORMAT_X(int obits, IData& destr, const char* formatp, ...);
|
||||||
extern void VL_SFORMAT_X(int obits, QData& destr, const char* formatp, ...);
|
extern void VL_SFORMAT_X(int obits, QData& destr, const char* formatp, ...);
|
||||||
extern void VL_SFORMAT_X(int obits, void* destp, const char* formatp, ...);
|
extern void VL_SFORMAT_X(int obits, void* destp, const char* formatp, ...);
|
||||||
|
|
||||||
extern IData VL_SYSTEM_IW(int lhsnwords, WDataInP lhs);
|
extern IData VL_SYSTEM_IW(int lhswords, WDataInP lhsp);
|
||||||
extern IData VL_SYSTEM_IQ(QData lhs);
|
extern IData VL_SYSTEM_IQ(QData lhs);
|
||||||
inline IData VL_SYSTEM_II(IData lhs) VL_MT_SAFE { return VL_SYSTEM_IQ(lhs); }
|
inline IData VL_SYSTEM_II(IData lhs) VL_MT_SAFE { return VL_SYSTEM_IQ(lhs); }
|
||||||
|
|
||||||
|
|
@ -632,24 +632,24 @@ extern const char* vl_mc_scan_plusargs(const char* prefixp); // PLIish
|
||||||
// Base macros
|
// Base macros
|
||||||
|
|
||||||
/// Return true if data[bit] set; not 0/1 return, but 0/non-zero return.
|
/// Return true if data[bit] set; not 0/1 return, but 0/non-zero return.
|
||||||
#define VL_BITISSET_I(data,bit) (data & (VL_UL(1)<<VL_BITBIT_I(bit)))
|
#define VL_BITISSET_I(data,bit) ((data) & (VL_UL(1) << VL_BITBIT_I(bit)))
|
||||||
#define VL_BITISSET_Q(data,bit) (data & (VL_ULL(1)<<VL_BITBIT_Q(bit)))
|
#define VL_BITISSET_Q(data,bit) ((data) & (VL_ULL(1) << VL_BITBIT_Q(bit)))
|
||||||
#define VL_BITISSET_W(data,bit) (data[VL_BITWORD_I(bit)] & (VL_UL(1)<<VL_BITBIT_I(bit)))
|
#define VL_BITISSET_W(data,bit) ((data)[VL_BITWORD_I(bit)] & (VL_UL(1) << VL_BITBIT_I(bit)))
|
||||||
#define VL_BITISSETLIMIT_W(data,width,bit) \
|
#define VL_BITISSETLIMIT_W(data,width,bit) \
|
||||||
(((bit)<(width)) && data[VL_BITWORD_I(bit)] & (VL_UL(1)<<VL_BITBIT_I(bit)))
|
(((bit)<(width)) && (data)[VL_BITWORD_I(bit)] & (VL_UL(1) << VL_BITBIT_I(bit)))
|
||||||
|
|
||||||
/// Shift appropriate word by bit. Does not account for wrapping between two words
|
/// Shift appropriate word by bit. Does not account for wrapping between two words
|
||||||
#define VL_BITRSHIFT_W(data,bit) (data[VL_BITWORD_I(bit)] >> VL_BITBIT_I(bit))
|
#define VL_BITRSHIFT_W(data,bit) ((data)[VL_BITWORD_I(bit)] >> VL_BITBIT_I(bit))
|
||||||
|
|
||||||
/// Create two 32-bit words from quadword
|
/// Create two 32-bit words from quadword
|
||||||
/// WData is always at least 2 words; does not clean upper bits
|
/// WData is always at least 2 words; does not clean upper bits
|
||||||
#define VL_SET_WQ(owp,data) { owp[0]=static_cast<IData>(data); \
|
#define VL_SET_WQ(owp,data) { (owp)[0] = static_cast<IData>(data); \
|
||||||
owp[1]=static_cast<IData>((data)>>VL_WORDSIZE); }
|
(owp)[1] = static_cast<IData>((data)>>VL_WORDSIZE); }
|
||||||
#define VL_SET_WI(owp,data) { owp[0]=static_cast<IData>(data); owp[1]=0; }
|
#define VL_SET_WI(owp,data) { (owp)[0] = static_cast<IData>(data); (owp)[1] = 0; }
|
||||||
#define VL_SET_QW(lwp) \
|
#define VL_SET_QW(lwp) \
|
||||||
( (static_cast<QData>(lwp[0])) \
|
( (static_cast<QData>((lwp)[0])) \
|
||||||
| (static_cast<QData>(lwp[1])<<(static_cast<QData>(VL_WORDSIZE)) ))
|
| (static_cast<QData>((lwp)[1]) << (static_cast<QData>(VL_WORDSIZE)) ))
|
||||||
#define _VL_SET_QII(ld,rd) ( (static_cast<QData>(ld)<<VL_ULL(32)) | static_cast<QData>(rd) )
|
#define _VL_SET_QII(ld,rd) ((static_cast<QData>(ld)<<VL_ULL(32)) | static_cast<QData>(rd))
|
||||||
|
|
||||||
/// Return FILE* from IData
|
/// Return FILE* from IData
|
||||||
extern FILE* VL_CVT_I_FP(IData lhs);
|
extern FILE* VL_CVT_I_FP(IData lhs);
|
||||||
|
|
@ -698,7 +698,7 @@ extern void _VL_DEBUG_PRINT_W(int lbits, WDataInP iwp);
|
||||||
// Pli macros
|
// Pli macros
|
||||||
|
|
||||||
#ifndef VL_TIME_PRECISION
|
#ifndef VL_TIME_PRECISION
|
||||||
# define VL_TIME_PRECISION -12 ///< Timescale units only for for VPI return - picoseconds
|
# define VL_TIME_PRECISION (-12) ///< Timescale units only for for VPI return - picoseconds
|
||||||
#endif
|
#endif
|
||||||
#ifndef VL_TIME_MULTIPLIER
|
#ifndef VL_TIME_MULTIPLIER
|
||||||
# define VL_TIME_MULTIPLIER 1
|
# define VL_TIME_MULTIPLIER 1
|
||||||
|
|
@ -828,31 +828,32 @@ static inline void VL_ASSIGNBIT_WO(int, int bit, WDataOutP owp, IData) VL_MT_SAF
|
||||||
#define VL_ASSIGN_ISI(obits,vvar,svar) { (vvar) = VL_CLEAN_II((obits),(obits),(svar).read()); }
|
#define VL_ASSIGN_ISI(obits,vvar,svar) { (vvar) = VL_CLEAN_II((obits),(obits),(svar).read()); }
|
||||||
#define VL_ASSIGN_QSQ(obits,vvar,svar) { (vvar) = VL_CLEAN_QQ((obits),(obits),(svar).read()); }
|
#define VL_ASSIGN_QSQ(obits,vvar,svar) { (vvar) = VL_CLEAN_QQ((obits),(obits),(svar).read()); }
|
||||||
|
|
||||||
#define VL_ASSIGN_ISW(obits,od,svar) { \
|
#define VL_ASSIGN_ISW(obits,od,svar) { \
|
||||||
od = (svar.read().get_word(0)) & VL_MASK_I(obits); \
|
(od) = ((svar).read().get_word(0)) & VL_MASK_I(obits); \
|
||||||
}
|
}
|
||||||
#define VL_ASSIGN_QSW(obits,od,svar) { \
|
#define VL_ASSIGN_QSW(obits,od,svar) { \
|
||||||
od = ((static_cast<QData>(svar.read().get_word(1)))<<VL_WORDSIZE | svar.read().get_word(0)) \
|
(od) = ((static_cast<QData>((svar).read().get_word(1)))<<VL_WORDSIZE \
|
||||||
& VL_MASK_Q(obits); \
|
| (svar).read().get_word(0)) \
|
||||||
}
|
& VL_MASK_Q(obits); \
|
||||||
#define VL_ASSIGN_WSW(obits,owp,svar) { \
|
}
|
||||||
int words = VL_WORDS_I(obits); \
|
#define VL_ASSIGN_WSW(obits,owp,svar) { \
|
||||||
for (int i=0; i < words; ++i) owp[i] = svar.read().get_word(i); \
|
int words = VL_WORDS_I(obits); \
|
||||||
owp[words-1] &= VL_MASK_I(obits); \
|
for (int i=0; i < words; ++i) (owp)[i] = (svar).read().get_word(i); \
|
||||||
}
|
(owp)[words-1] &= VL_MASK_I(obits); \
|
||||||
|
}
|
||||||
|
|
||||||
#define VL_ASSIGN_ISU(obits,vvar,svar) { (vvar) = VL_CLEAN_II((obits),(obits),(svar).read().to_uint()); }
|
#define VL_ASSIGN_ISU(obits,vvar,svar) { (vvar) = VL_CLEAN_II((obits),(obits),(svar).read().to_uint()); }
|
||||||
#define VL_ASSIGN_QSU(obits,vvar,svar) { (vvar) = VL_CLEAN_QQ((obits),(obits),(svar).read().to_uint64()); }
|
#define VL_ASSIGN_QSU(obits,vvar,svar) { (vvar) = VL_CLEAN_QQ((obits),(obits),(svar).read().to_uint64()); }
|
||||||
#define VL_ASSIGN_WSB(obits,owp,svar) { \
|
#define VL_ASSIGN_WSB(obits,owp,svar) { \
|
||||||
int words = VL_WORDS_I(obits); \
|
int words = VL_WORDS_I(obits); \
|
||||||
sc_biguint<obits> _butemp = (svar).read(); \
|
sc_biguint<(obits)> _butemp = (svar).read(); \
|
||||||
for (int i=0; i < words; ++i) { \
|
for (int i=0; i < words; ++i) { \
|
||||||
int msb = ((i+1)*VL_WORDSIZE) - 1; \
|
int msb = ((i+1)*VL_WORDSIZE) - 1; \
|
||||||
msb = (msb >= obits) ? (obits-1) : msb; \
|
msb = (msb >= (obits)) ? ((obits)-1) : msb; \
|
||||||
owp[i] = _butemp.range(msb,i*VL_WORDSIZE).to_uint(); \
|
(owp)[i] = _butemp.range(msb,i*VL_WORDSIZE).to_uint(); \
|
||||||
} \
|
} \
|
||||||
owp[words-1] &= VL_MASK_I(obits); \
|
(owp)[words-1] &= VL_MASK_I(obits); \
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copying verilog format from systemc integers and bit vectors.
|
// Copying verilog format from systemc integers and bit vectors.
|
||||||
// Set a SystemC variable
|
// Set a SystemC variable
|
||||||
|
|
@ -860,36 +861,36 @@ static inline void VL_ASSIGNBIT_WO(int, int bit, WDataOutP owp, IData) VL_MT_SAF
|
||||||
#define VL_ASSIGN_SII(obits,svar,vvar) { (svar).write(vvar); }
|
#define VL_ASSIGN_SII(obits,svar,vvar) { (svar).write(vvar); }
|
||||||
#define VL_ASSIGN_SQQ(obits,svar,vvar) { (svar).write(vvar); }
|
#define VL_ASSIGN_SQQ(obits,svar,vvar) { (svar).write(vvar); }
|
||||||
|
|
||||||
#define VL_ASSIGN_SWI(obits,svar,rd) { \
|
#define VL_ASSIGN_SWI(obits,svar,rd) { \
|
||||||
sc_bv<obits> _bvtemp; \
|
sc_bv<(obits)> _bvtemp; \
|
||||||
_bvtemp.set_word(0,(rd)); \
|
_bvtemp.set_word(0, (rd)); \
|
||||||
svar.write(_bvtemp); \
|
(svar).write(_bvtemp); \
|
||||||
}
|
}
|
||||||
#define VL_ASSIGN_SWQ(obits,svar,rd) { \
|
#define VL_ASSIGN_SWQ(obits,svar,rd) { \
|
||||||
sc_bv<obits> _bvtemp; \
|
sc_bv<(obits)> _bvtemp; \
|
||||||
_bvtemp.set_word(0, static_cast<IData>(rd)); \
|
_bvtemp.set_word(0, static_cast<IData>(rd)); \
|
||||||
_bvtemp.set_word(1, static_cast<IData>((rd)>>VL_WORDSIZE)); \
|
_bvtemp.set_word(1, static_cast<IData>((rd)>>VL_WORDSIZE)); \
|
||||||
svar.write(_bvtemp); \
|
(svar).write(_bvtemp); \
|
||||||
}
|
}
|
||||||
#define VL_ASSIGN_SWW(obits,svar,rwp) { \
|
#define VL_ASSIGN_SWW(obits,svar,rwp) { \
|
||||||
sc_bv<obits> _bvtemp; \
|
sc_bv<(obits)> _bvtemp; \
|
||||||
for (int i=0; i < VL_WORDS_I(obits); ++i) _bvtemp.set_word(i,rwp[i]); \
|
for (int i=0; i < VL_WORDS_I(obits); ++i) _bvtemp.set_word(i, (rwp)[i]); \
|
||||||
svar.write(_bvtemp); \
|
(svar).write(_bvtemp); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define VL_ASSIGN_SUI(obits,svar,rd) { (svar).write(rd); }
|
#define VL_ASSIGN_SUI(obits,svar,rd) { (svar).write(rd); }
|
||||||
#define VL_ASSIGN_SUQ(obits,svar,rd) { (svar).write(rd); }
|
#define VL_ASSIGN_SUQ(obits,svar,rd) { (svar).write(rd); }
|
||||||
#define VL_ASSIGN_SBI(obits,svar,rd) { (svar).write(rd); }
|
#define VL_ASSIGN_SBI(obits,svar,rd) { (svar).write(rd); }
|
||||||
#define VL_ASSIGN_SBQ(obits,svar,rd) { (svar).write(rd); }
|
#define VL_ASSIGN_SBQ(obits,svar,rd) { (svar).write(rd); }
|
||||||
#define VL_ASSIGN_SBW(obits,svar,rwp) { \
|
#define VL_ASSIGN_SBW(obits,svar,rwp) { \
|
||||||
sc_biguint<obits> _butemp; \
|
sc_biguint<(obits)> _butemp; \
|
||||||
for (int i=0; i < VL_WORDS_I(obits); ++i) { \
|
for (int i=0; i < VL_WORDS_I(obits); ++i) { \
|
||||||
int msb = ((i+1)*VL_WORDSIZE) - 1; \
|
int msb = ((i+1)*VL_WORDSIZE) - 1; \
|
||||||
msb = (msb >= obits) ? (obits-1) : msb; \
|
msb = (msb >= (obits)) ? ((obits)-1) : msb; \
|
||||||
_butemp.range(msb,i*VL_WORDSIZE) = rwp[i]; \
|
_butemp.range(msb, i*VL_WORDSIZE) = (rwp)[i]; \
|
||||||
} \
|
} \
|
||||||
svar.write(_butemp); \
|
(svar).write(_butemp); \
|
||||||
}
|
}
|
||||||
|
|
||||||
//===================================================================
|
//===================================================================
|
||||||
// Extending sizes
|
// Extending sizes
|
||||||
|
|
@ -957,8 +958,8 @@ static inline WDataOutP VL_EXTENDS_WW(int obits, int lbits, WDataOutP owp, WData
|
||||||
// REDUCTION OPERATORS
|
// REDUCTION OPERATORS
|
||||||
|
|
||||||
// EMIT_RULE: VL_REDAND: oclean=clean; lclean==clean; obits=1;
|
// EMIT_RULE: VL_REDAND: oclean=clean; lclean==clean; obits=1;
|
||||||
#define VL_REDAND_II(obits,lbits,lhs) (lhs == VL_MASK_I(lbits))
|
#define VL_REDAND_II(obits,lbits,lhs) ((lhs) == VL_MASK_I(lbits))
|
||||||
#define VL_REDAND_IQ(obits,lbits,lhs) (lhs == VL_MASK_Q(lbits))
|
#define VL_REDAND_IQ(obits,lbits,lhs) ((lhs) == VL_MASK_Q(lbits))
|
||||||
static inline IData VL_REDAND_IW(int, int lbits, WDataInP lwp) VL_MT_SAFE {
|
static inline IData VL_REDAND_IW(int, int lbits, WDataInP lwp) VL_MT_SAFE {
|
||||||
int words = VL_WORDS_I(lbits);
|
int words = VL_WORDS_I(lbits);
|
||||||
IData combine=lwp[0];
|
IData combine=lwp[0];
|
||||||
|
|
@ -968,8 +969,8 @@ static inline IData VL_REDAND_IW(int, int lbits, WDataInP lwp) VL_MT_SAFE {
|
||||||
}
|
}
|
||||||
|
|
||||||
// EMIT_RULE: VL_REDOR: oclean=clean; lclean==clean; obits=1;
|
// EMIT_RULE: VL_REDOR: oclean=clean; lclean==clean; obits=1;
|
||||||
#define VL_REDOR_I(lhs) (lhs!=0)
|
#define VL_REDOR_I(lhs) ((lhs)!=0)
|
||||||
#define VL_REDOR_Q(lhs) (lhs!=0)
|
#define VL_REDOR_Q(lhs) ((lhs)!=0)
|
||||||
static inline IData VL_REDOR_W(int words, WDataInP lwp) VL_MT_SAFE {
|
static inline IData VL_REDOR_W(int words, WDataInP lwp) VL_MT_SAFE {
|
||||||
IData equal=0;
|
IData equal=0;
|
||||||
for (int i=0; i < words; ++i) equal |= lwp[i];
|
for (int i=0; i < words; ++i) equal |= lwp[i];
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ public:
|
||||||
virtual void zero() const { *m_countp = 0; }
|
virtual void zero() const { *m_countp = 0; }
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
// cppcheck-suppress noExplicitConstructor
|
// cppcheck-suppress noExplicitConstructor
|
||||||
VerilatedCoverItemSpec(T* countp) : m_countp(countp) { zero(); }
|
VerilatedCoverItemSpec(T* countp) : m_countp(countp) { *m_countp = 0; }
|
||||||
virtual ~VerilatedCoverItemSpec() {}
|
virtual ~VerilatedCoverItemSpec() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -167,8 +167,8 @@ private:
|
||||||
// (foo.a.x, foo.b.y) => foo.*
|
// (foo.a.x, foo.b.y) => foo.*
|
||||||
// (foo.a.x, foo.b) => foo.*
|
// (foo.a.x, foo.b) => foo.*
|
||||||
if (old == add) return add;
|
if (old == add) return add;
|
||||||
if (old == "") return add;
|
if (old.empty()) return add;
|
||||||
if (add == "") return old;
|
if (add.empty()) return old;
|
||||||
|
|
||||||
const char* a = old.c_str();
|
const char* a = old.c_str();
|
||||||
const char* b = add.c_str();
|
const char* b = add.c_str();
|
||||||
|
|
@ -296,7 +296,7 @@ public:
|
||||||
}
|
}
|
||||||
// Ignore empty keys
|
// Ignore empty keys
|
||||||
for (int i=0; i<MAX_KEYS; ++i) {
|
for (int i=0; i<MAX_KEYS; ++i) {
|
||||||
if (keys[i]!="") {
|
if (!keys[i].empty()) {
|
||||||
for (int j=i+1; j<MAX_KEYS; ++j) {
|
for (int j=i+1; j<MAX_KEYS; ++j) {
|
||||||
if (keys[i] == keys[j]) { // Duplicate key. Keep the last one
|
if (keys[i] == keys[j]) { // Duplicate key. Keep the last one
|
||||||
keys[i] = "";
|
keys[i] = "";
|
||||||
|
|
@ -309,7 +309,7 @@ public:
|
||||||
int addKeynum=0;
|
int addKeynum=0;
|
||||||
for (int i=0; i<MAX_KEYS; ++i) {
|
for (int i=0; i<MAX_KEYS; ++i) {
|
||||||
const std::string key = keys[i];
|
const std::string key = keys[i];
|
||||||
if (keys[i]!="") {
|
if (!keys[i].empty()) {
|
||||||
const std::string val = valps[i];
|
const std::string val = valps[i];
|
||||||
//cout<<" "<<__FUNCTION__<<" "<<key<<" = "<<val<<endl;
|
//cout<<" "<<__FUNCTION__<<" "<<key<<" = "<<val<<endl;
|
||||||
m_insertp->m_keys[addKeynum] = valueIndex(key);
|
m_insertp->m_keys[addKeynum] = valueIndex(key);
|
||||||
|
|
@ -391,7 +391,7 @@ public:
|
||||||
for (EventMap::const_iterator it=eventCounts.begin(); it!=eventCounts.end(); ++it) {
|
for (EventMap::const_iterator it=eventCounts.begin(); it!=eventCounts.end(); ++it) {
|
||||||
os<<"C '"<<std::dec;
|
os<<"C '"<<std::dec;
|
||||||
os<<it->first;
|
os<<it->first;
|
||||||
if (it->second.first != "") os<<keyValueFormatter(VL_CIK_HIER,it->second.first);
|
if (!it->second.first.empty()) os<<keyValueFormatter(VL_CIK_HIER,it->second.first);
|
||||||
os<<"' "<<it->second.second;
|
os<<"' "<<it->second.second;
|
||||||
os<<std::endl;
|
os<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
@ -424,9 +424,9 @@ void VerilatedCov::_insertf(const char* filename, int lineno) VL_MT_SAFE {
|
||||||
}
|
}
|
||||||
|
|
||||||
#define K(n) const char* key ## n
|
#define K(n) const char* key ## n
|
||||||
#define A(n) const char* key ## n, const char* val ## n // Argument list
|
#define A(n) const char* key ## n, const char* valp ## n // Argument list
|
||||||
#define C(n) key ## n, val ## n // Calling argument list
|
#define C(n) key ## n, valp ## n // Calling argument list
|
||||||
#define N(n) "","" // Null argument list
|
#define N(n) "","" // Null argument list
|
||||||
void VerilatedCov::_insertp(A(0),A(1),A(2),A(3),A(4),A(5),A(6),A(7),A(8),A(9),
|
void VerilatedCov::_insertp(A(0),A(1),A(2),A(3),A(4),A(5),A(6),A(7),A(8),A(9),
|
||||||
A(10),A(11),A(12),A(13),A(14),A(15),A(16),A(17),A(18),A(19),
|
A(10),A(11),A(12),A(13),A(14),A(15),A(16),A(17),A(18),A(19),
|
||||||
A(20),A(21),A(22),A(23),A(24),A(25),A(26),A(27),A(28),A(29)) VL_MT_SAFE {
|
A(20),A(21),A(22),A(23),A(24),A(25),A(26),A(27),A(28),A(29)) VL_MT_SAFE {
|
||||||
|
|
@ -437,9 +437,9 @@ void VerilatedCov::_insertp(A(0),A(1),A(2),A(3),A(4),A(5),A(6),A(7),A(8),A(9),
|
||||||
key20,key21,key22,key23,key24,key25,key26,key27,key28,key29};
|
key20,key21,key22,key23,key24,key25,key26,key27,key28,key29};
|
||||||
const char* valps[VerilatedCovImpBase::MAX_KEYS]
|
const char* valps[VerilatedCovImpBase::MAX_KEYS]
|
||||||
= {NULL,NULL,NULL, // filename,lineno,page
|
= {NULL,NULL,NULL, // filename,lineno,page
|
||||||
val0,val1,val2,val3,val4,val5,val6,val7,val8,val9,
|
valp0,valp1,valp2,valp3,valp4,valp5,valp6,valp7,valp8,valp9,
|
||||||
val10,val11,val12,val13,val14,val15,val16,val17,val18,val19,
|
valp10,valp11,valp12,valp13,valp14,valp15,valp16,valp17,valp18,valp19,
|
||||||
val20,val21,val22,val23,val24,val25,val26,val27,val28,val29};
|
valp20,valp21,valp22,valp23,valp24,valp25,valp26,valp27,valp28,valp29};
|
||||||
VerilatedCovImp::imp().insertp(keyps, valps);
|
VerilatedCovImp::imp().insertp(keyps, valps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -721,14 +721,16 @@ void svPutLogicArrElem3(const svOpenArrayHandle d, svLogic value, int indx1, int
|
||||||
|
|
||||||
svScope svGetScope() {
|
svScope svGetScope() {
|
||||||
if (VL_UNLIKELY(!Verilated::dpiInContext())) { _VL_SVDPI_CONTEXT_WARN(); return NULL; }
|
if (VL_UNLIKELY(!Verilated::dpiInContext())) { _VL_SVDPI_CONTEXT_WARN(); return NULL; }
|
||||||
return (svScope)Verilated::dpiScope();
|
// NOLINTNEXTLINE(google-readability-casting)
|
||||||
|
return (svScope)(Verilated::dpiScope());
|
||||||
}
|
}
|
||||||
|
|
||||||
svScope svSetScope(const svScope scope) {
|
svScope svSetScope(const svScope scope) {
|
||||||
const VerilatedScope* prevScopep = Verilated::dpiScope();
|
const VerilatedScope* prevScopep = Verilated::dpiScope();
|
||||||
const VerilatedScope* vscopep = reinterpret_cast<const VerilatedScope*>(scope);
|
const VerilatedScope* vscopep = reinterpret_cast<const VerilatedScope*>(scope);
|
||||||
Verilated::dpiScope(vscopep);
|
Verilated::dpiScope(vscopep);
|
||||||
return (svScope)prevScopep;
|
// NOLINTNEXTLINE(google-readability-casting)
|
||||||
|
return (svScope)(prevScopep);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* svGetNameFromScope(const svScope scope) {
|
const char* svGetNameFromScope(const svScope scope) {
|
||||||
|
|
@ -737,7 +739,8 @@ const char* svGetNameFromScope(const svScope scope) {
|
||||||
}
|
}
|
||||||
|
|
||||||
svScope svGetScopeFromName(const char* scopeName) {
|
svScope svGetScopeFromName(const char* scopeName) {
|
||||||
return (svScope)VerilatedImp::scopeFind(scopeName);
|
// NOLINTNEXTLINE(google-readability-casting)
|
||||||
|
return (svScope)(VerilatedImp::scopeFind(scopeName));
|
||||||
}
|
}
|
||||||
|
|
||||||
int svPutUserData(const svScope scope, void* userKey, void* userData) {
|
int svPutUserData(const svScope scope, void* userKey, void* userData) {
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ void VerilatedFst::declSymbol(vluint32_t code, const char* name,
|
||||||
int dtypenum, fstVarDir vardir, fstVarType vartype,
|
int dtypenum, fstVarDir vardir, fstVarType vartype,
|
||||||
int arraynum, vluint32_t len) {
|
int arraynum, vluint32_t len) {
|
||||||
std::pair<Code2SymbolType::iterator, bool> p
|
std::pair<Code2SymbolType::iterator, bool> p
|
||||||
= m_code2symbol.insert(std::make_pair(code, (fstHandle)(0)));
|
= m_code2symbol.insert(std::make_pair(code, static_cast<fstHandle>(NULL)));
|
||||||
std::istringstream nameiss(name);
|
std::istringstream nameiss(name);
|
||||||
std::istream_iterator<std::string> beg(nameiss), end;
|
std::istream_iterator<std::string> beg(nameiss), end;
|
||||||
std::list<std::string> tokens(beg, end); // Split name
|
std::list<std::string> tokens(beg, end); // Split name
|
||||||
|
|
|
||||||
|
|
@ -77,10 +77,10 @@ public:
|
||||||
fstWriterClose(m_fst);
|
fstWriterClose(m_fst);
|
||||||
m_fst = NULL;
|
m_fst = NULL;
|
||||||
}
|
}
|
||||||
// void set_time_unit(const char* unit); ///< Set time units (s/ms, defaults to ns)
|
// void set_time_unit(const char* unitp); ///< Set time units (s/ms, defaults to ns)
|
||||||
// void set_time_unit(const std::string& unit) { set_time_unit(unit.c_str()); }
|
// void set_time_unit(const std::string& unit) { set_time_unit(unit.c_str()); }
|
||||||
|
|
||||||
// void set_time_resolution(const char* unit); ///< Set time resolution (s/ms, defaults to ns)
|
// void set_time_resolution(const char* unitp); ///< Set time resolution (s/ms, defaults to ns)
|
||||||
// void set_time_resolution(const std::string& unit) { set_time_resolution(unit.c_str()); }
|
// void set_time_resolution(const std::string& unit) { set_time_resolution(unit.c_str()); }
|
||||||
|
|
||||||
// double timescaleToDouble(const char* unitp);
|
// double timescaleToDouble(const char* unitp);
|
||||||
|
|
@ -93,8 +93,8 @@ public:
|
||||||
/// Inside dumping routines, called each cycle to make the dump
|
/// Inside dumping routines, called each cycle to make the dump
|
||||||
void dump(vluint64_t timeui);
|
void dump(vluint64_t timeui);
|
||||||
/// Inside dumping routines, declare callbacks for tracings
|
/// Inside dumping routines, declare callbacks for tracings
|
||||||
void addCallback(VerilatedFstCallback_t init, VerilatedFstCallback_t full,
|
void addCallback(VerilatedFstCallback_t initcb, VerilatedFstCallback_t fullcb,
|
||||||
VerilatedFstCallback_t change,
|
VerilatedFstCallback_t changecb,
|
||||||
void* userthis) VL_MT_UNSAFE_ONE;
|
void* userthis) VL_MT_UNSAFE_ONE;
|
||||||
|
|
||||||
/// Inside dumping routines, declare a module
|
/// Inside dumping routines, declare a module
|
||||||
|
|
|
||||||
|
|
@ -65,15 +65,15 @@ inline IData VL_LEN_IN(const std::string& ld) { return ld.length(); }
|
||||||
|
|
||||||
extern IData VL_FOPEN_NI(const std::string& filename, IData mode) VL_MT_SAFE;
|
extern IData VL_FOPEN_NI(const std::string& filename, IData mode) VL_MT_SAFE;
|
||||||
extern void VL_READMEM_N(bool hex, int width, int depth, int array_lsb,
|
extern void VL_READMEM_N(bool hex, int width, int depth, int array_lsb,
|
||||||
const std::string& ofilename,
|
const std::string& filename,
|
||||||
void* memp, IData start, IData end) VL_MT_SAFE;
|
void* memp, IData start, IData end) VL_MT_SAFE;
|
||||||
extern void VL_WRITEMEM_N(bool hex, int width, int depth, int array_lsb,
|
extern void VL_WRITEMEM_N(bool hex, int width, int depth, int array_lsb,
|
||||||
const std::string& ofilename,
|
const std::string& filename,
|
||||||
const void* memp, IData start, IData end) VL_MT_SAFE;
|
const void* memp, IData start, IData end) VL_MT_SAFE;
|
||||||
extern IData VL_SSCANF_INX(int lbits, const std::string& ld, const char* formatp, ...) VL_MT_SAFE;
|
extern IData VL_SSCANF_INX(int lbits, const std::string& ld, const char* formatp, ...) VL_MT_SAFE;
|
||||||
extern void VL_SFORMAT_X(int obits_ignored, std::string& output, const char* formatp, ...) VL_MT_SAFE;
|
extern void VL_SFORMAT_X(int obits_ignored, std::string& output, const char* formatp, ...) VL_MT_SAFE;
|
||||||
extern std::string VL_SFORMATF_NX(const char* formatp, ...) VL_MT_SAFE;
|
extern std::string VL_SFORMATF_NX(const char* formatp, ...) VL_MT_SAFE;
|
||||||
extern IData VL_VALUEPLUSARGS_INW(int rbits, const std::string& ld, WDataOutP rdp) VL_MT_SAFE;
|
extern IData VL_VALUEPLUSARGS_INW(int rbits, const std::string& ld, WDataOutP rwp) VL_MT_SAFE;
|
||||||
inline IData VL_VALUEPLUSARGS_INI(int rbits, const std::string& ld, IData& rdr) VL_MT_SAFE {
|
inline IData VL_VALUEPLUSARGS_INI(int rbits, const std::string& ld, IData& rdr) VL_MT_SAFE {
|
||||||
WData rwp[2]; // WData must always be at least 2
|
WData rwp[2]; // WData must always be at least 2
|
||||||
IData got = VL_VALUEPLUSARGS_INW(rbits,ld,rwp);
|
IData got = VL_VALUEPLUSARGS_INW(rbits,ld,rwp);
|
||||||
|
|
|
||||||
|
|
@ -70,10 +70,10 @@ public:
|
||||||
lxt2_wr_close(m_lxt2);
|
lxt2_wr_close(m_lxt2);
|
||||||
m_lxt2 = NULL;
|
m_lxt2 = NULL;
|
||||||
}
|
}
|
||||||
// void set_time_unit(const char* unit); ///< Set time units (s/ms, defaults to ns)
|
// void set_time_unit(const char* unitp); ///< Set time units (s/ms, defaults to ns)
|
||||||
// void set_time_unit(const std::string& unit) { set_time_unit(unit.c_str()); }
|
// void set_time_unit(const std::string& unit) { set_time_unit(unit.c_str()); }
|
||||||
|
|
||||||
// void set_time_resolution(const char* unit); ///< Set time resolution (s/ms, defaults to ns)
|
// void set_time_resolution(const char* unitp); ///< Set time resolution (s/ms, defaults to ns)
|
||||||
// void set_time_resolution(const std::string& unit) { set_time_resolution(unit.c_str()); }
|
// void set_time_resolution(const std::string& unit) { set_time_resolution(unit.c_str()); }
|
||||||
|
|
||||||
// double timescaleToDouble(const char* unitp);
|
// double timescaleToDouble(const char* unitp);
|
||||||
|
|
@ -86,8 +86,8 @@ public:
|
||||||
/// Inside dumping routines, called each cycle to make the dump
|
/// Inside dumping routines, called each cycle to make the dump
|
||||||
void dump(vluint64_t timeui);
|
void dump(vluint64_t timeui);
|
||||||
/// Inside dumping routines, declare callbacks for tracings
|
/// Inside dumping routines, declare callbacks for tracings
|
||||||
void addCallback(VerilatedLxt2Callback_t init, VerilatedLxt2Callback_t full,
|
void addCallback(VerilatedLxt2Callback_t initcb, VerilatedLxt2Callback_t fullcb,
|
||||||
VerilatedLxt2Callback_t change,
|
VerilatedLxt2Callback_t changecb,
|
||||||
void* userthis) VL_MT_UNSAFE_ONE;
|
void* userthis) VL_MT_UNSAFE_ONE;
|
||||||
|
|
||||||
/// Inside dumping routines, declare a module
|
/// Inside dumping routines, declare a module
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,9 @@
|
||||||
#ifndef O_NONBLOCK
|
#ifndef O_NONBLOCK
|
||||||
# define O_NONBLOCK 0
|
# define O_NONBLOCK 0
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef O_CLOEXEC
|
||||||
|
# define O_CLOEXEC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
// CONSTANTS
|
// CONSTANTS
|
||||||
static const char* const VLTSAVE_HEADER_STR = "verilatorsave01\n"; ///< Value of first bytes of each file
|
static const char* const VLTSAVE_HEADER_STR = "verilatorsave01\n"; ///< Value of first bytes of each file
|
||||||
|
|
@ -50,7 +53,7 @@ static const char* const VLTSAVE_TRAILER_STR = "vltsaved"; ///< Value of last by
|
||||||
|
|
||||||
bool VerilatedDeserialize::readDiffers(const void* __restrict datap, size_t size) VL_MT_UNSAFE_ONE {
|
bool VerilatedDeserialize::readDiffers(const void* __restrict datap, size_t size) VL_MT_UNSAFE_ONE {
|
||||||
bufferCheck();
|
bufferCheck();
|
||||||
const vluint8_t* __restrict dp = (const vluint8_t* __restrict)datap;
|
const vluint8_t* __restrict dp = static_cast<const vluint8_t* __restrict>(datap);
|
||||||
vluint8_t miss = 0;
|
vluint8_t miss = 0;
|
||||||
while (size--) {
|
while (size--) {
|
||||||
miss |= (*dp++ ^ *m_cp++);
|
miss |= (*dp++ ^ *m_cp++);
|
||||||
|
|
@ -119,7 +122,7 @@ void VerilatedSave::open(const char* filenamep) VL_MT_UNSAFE_ONE {
|
||||||
assert(0); // Not supported yet.
|
assert(0); // Not supported yet.
|
||||||
} else {
|
} else {
|
||||||
// cppcheck-suppress duplicateExpression
|
// cppcheck-suppress duplicateExpression
|
||||||
m_fd = ::open(filenamep, O_CREAT|O_WRONLY|O_TRUNC|O_LARGEFILE|O_NONBLOCK
|
m_fd = ::open(filenamep, O_CREAT|O_WRONLY|O_TRUNC|O_LARGEFILE|O_NONBLOCK|O_CLOEXEC
|
||||||
, 0666);
|
, 0666);
|
||||||
if (m_fd<0) {
|
if (m_fd<0) {
|
||||||
// User code can check isOpen()
|
// User code can check isOpen()
|
||||||
|
|
@ -142,7 +145,7 @@ void VerilatedRestore::open(const char* filenamep) VL_MT_UNSAFE_ONE {
|
||||||
assert(0); // Not supported yet.
|
assert(0); // Not supported yet.
|
||||||
} else {
|
} else {
|
||||||
// cppcheck-suppress duplicateExpression
|
// cppcheck-suppress duplicateExpression
|
||||||
m_fd = ::open(filenamep, O_CREAT|O_RDONLY|O_LARGEFILE
|
m_fd = ::open(filenamep, O_CREAT|O_RDONLY|O_LARGEFILE|O_CLOEXEC
|
||||||
, 0666);
|
, 0666);
|
||||||
if (m_fd<0) {
|
if (m_fd<0) {
|
||||||
// User code can check isOpen()
|
// User code can check isOpen()
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,9 @@
|
||||||
#ifndef O_NONBLOCK
|
#ifndef O_NONBLOCK
|
||||||
# define O_NONBLOCK 0
|
# define O_NONBLOCK 0
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef O_CLOEXEC
|
||||||
|
# define O_CLOEXEC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// VerilatedVcdImp
|
// VerilatedVcdImp
|
||||||
|
|
@ -109,7 +112,7 @@ protected:
|
||||||
// VerilatedVcdFile
|
// VerilatedVcdFile
|
||||||
|
|
||||||
bool VerilatedVcdFile::open(const std::string& name) VL_MT_UNSAFE {
|
bool VerilatedVcdFile::open(const std::string& name) VL_MT_UNSAFE {
|
||||||
m_fd = ::open(name.c_str(), O_CREAT|O_WRONLY|O_TRUNC|O_LARGEFILE|O_NONBLOCK, 0666);
|
m_fd = ::open(name.c_str(), O_CREAT|O_WRONLY|O_TRUNC|O_LARGEFILE|O_NONBLOCK|O_CLOEXEC, 0666);
|
||||||
return (m_fd>=0);
|
return (m_fd>=0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -237,7 +240,7 @@ void VerilatedVcd::makeNameMap() {
|
||||||
bool nullScope = false;
|
bool nullScope = false;
|
||||||
for (NameMap::const_iterator it=m_namemapp->begin(); it!=m_namemapp->end(); ++it) {
|
for (NameMap::const_iterator it=m_namemapp->begin(); it!=m_namemapp->end(); ++it) {
|
||||||
const std::string& hiername = it->first;
|
const std::string& hiername = it->first;
|
||||||
if (hiername.size() >= 1 && hiername[0] == '\t') nullScope=true;
|
if (!hiername.empty() && hiername[0] == '\t') nullScope=true;
|
||||||
}
|
}
|
||||||
if (nullScope) {
|
if (nullScope) {
|
||||||
NameMap* newmapp = new NameMap;
|
NameMap* newmapp = new NameMap;
|
||||||
|
|
@ -546,13 +549,15 @@ void VerilatedVcd::declare(vluint32_t code, const char* name, const char* wirep,
|
||||||
// Tab sorts before spaces, so signals nicely will print before scopes
|
// Tab sorts before spaces, so signals nicely will print before scopes
|
||||||
// Note the hiername may be nothing, if so we'll add "\t{name}"
|
// Note the hiername may be nothing, if so we'll add "\t{name}"
|
||||||
std::string nameasstr = name;
|
std::string nameasstr = name;
|
||||||
if (m_modName!="") { nameasstr = m_modName+m_scopeEscape+nameasstr; } // Optional ->module prefix
|
if (!m_modName.empty()) {
|
||||||
|
nameasstr = m_modName+m_scopeEscape+nameasstr; // Optional ->module prefix
|
||||||
|
}
|
||||||
std::string hiername;
|
std::string hiername;
|
||||||
std::string basename;
|
std::string basename;
|
||||||
for (const char* cp=nameasstr.c_str(); *cp; cp++) {
|
for (const char* cp=nameasstr.c_str(); *cp; cp++) {
|
||||||
if (isScopeEscape(*cp)) {
|
if (isScopeEscape(*cp)) {
|
||||||
// Ahh, we've just read a scope, not a basename
|
// Ahh, we've just read a scope, not a basename
|
||||||
if (hiername!="") hiername += " ";
|
if (!hiername.empty()) hiername += " ";
|
||||||
hiername += basename;
|
hiername += basename;
|
||||||
basename = "";
|
basename = "";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ private:
|
||||||
void openNext();
|
void openNext();
|
||||||
void makeNameMap();
|
void makeNameMap();
|
||||||
void deleteNameMap();
|
void deleteNameMap();
|
||||||
void printIndent(int levelchange);
|
void printIndent(int level_change);
|
||||||
void printStr(const char* str);
|
void printStr(const char* str);
|
||||||
void printQuad(vluint64_t n);
|
void printQuad(vluint64_t n);
|
||||||
void printTime(vluint64_t timeui);
|
void printTime(vluint64_t timeui);
|
||||||
|
|
@ -172,10 +172,10 @@ public:
|
||||||
/// Flush any remaining data from all files
|
/// Flush any remaining data from all files
|
||||||
static void flush_all() VL_MT_UNSAFE_ONE;
|
static void flush_all() VL_MT_UNSAFE_ONE;
|
||||||
|
|
||||||
void set_time_unit(const char* unit); ///< Set time units (s/ms, defaults to ns)
|
void set_time_unit(const char* unitp); ///< Set time units (s/ms, defaults to ns)
|
||||||
void set_time_unit(const std::string& unit) { set_time_unit(unit.c_str()); }
|
void set_time_unit(const std::string& unit) { set_time_unit(unit.c_str()); }
|
||||||
|
|
||||||
void set_time_resolution(const char* unit); ///< Set time resolution (s/ms, defaults to ns)
|
void set_time_resolution(const char* unitp); ///< Set time resolution (s/ms, defaults to ns)
|
||||||
void set_time_resolution(const std::string& unit) { set_time_resolution(unit.c_str()); }
|
void set_time_resolution(const std::string& unit) { set_time_resolution(unit.c_str()); }
|
||||||
|
|
||||||
double timescaleToDouble(const char* unitp);
|
double timescaleToDouble(const char* unitp);
|
||||||
|
|
@ -187,8 +187,8 @@ public:
|
||||||
void dumpSeconds(double secs) { dump(static_cast<vluint64_t>(secs * m_timeRes)); }
|
void dumpSeconds(double secs) { dump(static_cast<vluint64_t>(secs * m_timeRes)); }
|
||||||
|
|
||||||
/// Inside dumping routines, declare callbacks for tracings
|
/// Inside dumping routines, declare callbacks for tracings
|
||||||
void addCallback(VerilatedVcdCallback_t init, VerilatedVcdCallback_t full,
|
void addCallback(VerilatedVcdCallback_t initcb, VerilatedVcdCallback_t fullcb,
|
||||||
VerilatedVcdCallback_t change,
|
VerilatedVcdCallback_t changecb,
|
||||||
void* userthis) VL_MT_UNSAFE_ONE;
|
void* userthis) VL_MT_UNSAFE_ONE;
|
||||||
|
|
||||||
/// Inside dumping routines, declare a module
|
/// Inside dumping routines, declare a module
|
||||||
|
|
|
||||||
|
|
@ -79,11 +79,10 @@ public:
|
||||||
vluint8_t* newp = t_freeHead;
|
vluint8_t* newp = t_freeHead;
|
||||||
t_freeHead = *((vluint8_t**)newp);
|
t_freeHead = *((vluint8_t**)newp);
|
||||||
return newp+8;
|
return newp+8;
|
||||||
} else {
|
|
||||||
// +8: 8 bytes for next
|
|
||||||
vluint8_t* newp = reinterpret_cast<vluint8_t*>(::operator new(chunk+8));
|
|
||||||
return newp+8;
|
|
||||||
}
|
}
|
||||||
|
// +8: 8 bytes for next
|
||||||
|
vluint8_t* newp = reinterpret_cast<vluint8_t*>(::operator new(chunk+8));
|
||||||
|
return newp+8;
|
||||||
}
|
}
|
||||||
inline static void operator delete(void* obj, size_t size) VL_MT_SAFE {
|
inline static void operator delete(void* obj, size_t size) VL_MT_SAFE {
|
||||||
vluint8_t* oldp = ((vluint8_t*)obj)-8;
|
vluint8_t* oldp = ((vluint8_t*)obj)-8;
|
||||||
|
|
@ -156,9 +155,8 @@ public:
|
||||||
VerilatedVpioRange* nextp = new VerilatedVpioRange(*this);
|
VerilatedVpioRange* nextp = new VerilatedVpioRange(*this);
|
||||||
nextp->iterationInc();
|
nextp->iterationInc();
|
||||||
return ((nextp)->castVpiHandle());
|
return ((nextp)->castVpiHandle());
|
||||||
} else {
|
|
||||||
return 0; // End of list - only one deep
|
|
||||||
}
|
}
|
||||||
|
return 0; // End of list - only one deep
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -275,9 +273,8 @@ public:
|
||||||
if (m_it == varsp->end()) return 0;
|
if (m_it == varsp->end()) return 0;
|
||||||
return ((new VerilatedVpioVar(&(m_it->second), m_scopep))
|
return ((new VerilatedVpioVar(&(m_it->second), m_scopep))
|
||||||
->castVpiHandle());
|
->castVpiHandle());
|
||||||
} else {
|
|
||||||
return 0; // End of list - only one deep
|
|
||||||
}
|
}
|
||||||
|
return 0; // End of list - only one deep
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -388,9 +385,8 @@ public:
|
||||||
VpioTimedCbs::const_iterator it=s_s.m_timedCbs.begin();
|
VpioTimedCbs::const_iterator it=s_s.m_timedCbs.begin();
|
||||||
if (VL_LIKELY(it!=s_s.m_timedCbs.end())) {
|
if (VL_LIKELY(it!=s_s.m_timedCbs.end())) {
|
||||||
return it->first;
|
return it->first;
|
||||||
} else {
|
|
||||||
return ~VL_ULL(0); // maxquad
|
|
||||||
}
|
}
|
||||||
|
return ~VL_ULL(0); // maxquad
|
||||||
}
|
}
|
||||||
static void callCbs(vluint32_t reason) {
|
static void callCbs(vluint32_t reason) {
|
||||||
VpioCbList& cbObjList = s_s.m_cbObjLists[reason];
|
VpioCbList& cbObjList = s_s.m_cbObjLists[reason];
|
||||||
|
|
@ -1037,17 +1033,15 @@ vpiHandle vpi_handle_by_index(vpiHandle object, PLI_INT32 indx) {
|
||||||
return (new VerilatedVpioMemoryWord(varop->varp(), varop->scopep(), indx,
|
return (new VerilatedVpioMemoryWord(varop->varp(), varop->scopep(), indx,
|
||||||
indx - varop->varp()->unpacked().right()))
|
indx - varop->varp()->unpacked().right()))
|
||||||
->castVpiHandle();
|
->castVpiHandle();
|
||||||
} else {
|
|
||||||
if (VL_UNLIKELY(indx < varop->varp()->unpacked().left()
|
|
||||||
|| indx > varop->varp()->unpacked().right())) return 0;
|
|
||||||
return (new VerilatedVpioMemoryWord(varop->varp(), varop->scopep(), indx,
|
|
||||||
indx - varop->varp()->unpacked().left()))
|
|
||||||
->castVpiHandle();
|
|
||||||
}
|
}
|
||||||
} else {
|
if (VL_UNLIKELY(indx < varop->varp()->unpacked().left()
|
||||||
_VL_VPI_INTERNAL(__FILE__, __LINE__, "%s : can't resolve handle", VL_FUNC);
|
|| indx > varop->varp()->unpacked().right())) return 0;
|
||||||
return 0;
|
return (new VerilatedVpioMemoryWord(varop->varp(), varop->scopep(), indx,
|
||||||
|
indx - varop->varp()->unpacked().left()))
|
||||||
|
->castVpiHandle();
|
||||||
}
|
}
|
||||||
|
_VL_VPI_INTERNAL(__FILE__, __LINE__, "%s : can't resolve handle", VL_FUNC);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for traversing relationships
|
// for traversing relationships
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
# ifdef _WIN32
|
# ifdef _WIN32
|
||||||
# define VL_ATTR_PRINTF(fmtArgNum) // GCC with MS runtime will fool the print arg checker
|
# define VL_ATTR_PRINTF(fmtArgNum) // GCC with MS runtime will fool the print arg checker
|
||||||
# else
|
# else
|
||||||
# define VL_ATTR_PRINTF(fmtArgNum) __attribute__ ((format (printf, fmtArgNum, fmtArgNum+1)))
|
# define VL_ATTR_PRINTF(fmtArgNum) __attribute__ ((format (printf, (fmtArgNum), (fmtArgNum)+1)))
|
||||||
# endif
|
# endif
|
||||||
# define VL_ATTR_PURE __attribute__ ((pure))
|
# define VL_ATTR_PURE __attribute__ ((pure))
|
||||||
# define VL_ATTR_UNUSED __attribute__ ((unused))
|
# define VL_ATTR_UNUSED __attribute__ ((unused))
|
||||||
|
|
|
||||||
|
|
@ -75,13 +75,14 @@ private:
|
||||||
AstNode* newIfAssertOn(AstNode* nodep) {
|
AstNode* newIfAssertOn(AstNode* nodep) {
|
||||||
// Add a internal if to check assertions are on.
|
// Add a internal if to check assertions are on.
|
||||||
// Don't make this a AND term, as it's unlikely to need to test this.
|
// Don't make this a AND term, as it's unlikely to need to test this.
|
||||||
|
FileLine* fl = nodep->fileline();
|
||||||
AstNode* newp
|
AstNode* newp
|
||||||
= new AstIf(nodep->fileline(),
|
= new AstIf(fl,
|
||||||
// If assertions are off, have constant propagation rip them out later
|
// If assertions are off, have constant propagation rip them out later
|
||||||
// This allows syntax errors and such to be detected normally.
|
// This allows syntax errors and such to be detected normally.
|
||||||
(v3Global.opt.assertOn()
|
(v3Global.opt.assertOn()
|
||||||
? (AstNode*)(new AstCMath(nodep->fileline(), "Verilated::assertOn()", 1))
|
? static_cast<AstNode*>(new AstCMath(fl, "Verilated::assertOn()", 1))
|
||||||
: (AstNode*)(new AstConst(nodep->fileline(), AstConst::LogicFalse()))),
|
: static_cast<AstNode*>(new AstConst(fl, AstConst::LogicFalse()))),
|
||||||
nodep, NULL);
|
nodep, NULL);
|
||||||
newp->user1(true); // Don't assert/cover this if
|
newp->user1(true); // Don't assert/cover this if
|
||||||
return newp;
|
return newp;
|
||||||
|
|
|
||||||
|
|
@ -419,8 +419,8 @@ void AstNode::replaceWith(AstNode* newp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AstNRelinker::dump(std::ostream& str) const {
|
void AstNRelinker::dump(std::ostream& str) const {
|
||||||
str<<" BK="<<(uint32_t*)m_backp;
|
str<<" BK="<<reinterpret_cast<uint32_t*>(m_backp);
|
||||||
str<<" ITER="<<(uint32_t*)m_iterpp;
|
str<<" ITER="<<reinterpret_cast<uint32_t*>(m_iterpp);
|
||||||
str<<" CHG="<<(m_chg==RELINK_NEXT?"[NEXT] ":"");
|
str<<" CHG="<<(m_chg==RELINK_NEXT?"[NEXT] ":"");
|
||||||
str<<(m_chg==RELINK_OP1?"[OP1] ":"");
|
str<<(m_chg==RELINK_OP1?"[OP1] ":"");
|
||||||
str<<(m_chg==RELINK_OP2?"[OP2] ":"");
|
str<<(m_chg==RELINK_OP2?"[OP2] ":"");
|
||||||
|
|
@ -670,13 +670,13 @@ void AstNode::deleteNode() {
|
||||||
UASSERT(!m_backp, "Delete called on node with backlink still set");
|
UASSERT(!m_backp, "Delete called on node with backlink still set");
|
||||||
editCountInc();
|
editCountInc();
|
||||||
// Change links of old node so we coredump if used
|
// Change links of old node so we coredump if used
|
||||||
this->m_nextp = (AstNode*)1;
|
this->m_nextp = reinterpret_cast<AstNode*>(0x1);
|
||||||
this->m_backp = (AstNode*)1;
|
this->m_backp = reinterpret_cast<AstNode*>(0x1);
|
||||||
this->m_headtailp = (AstNode*)1;
|
this->m_headtailp = reinterpret_cast<AstNode*>(0x1);
|
||||||
this->m_op1p = (AstNode*)1;
|
this->m_op1p = reinterpret_cast<AstNode*>(0x1);
|
||||||
this->m_op2p = (AstNode*)1;
|
this->m_op2p = reinterpret_cast<AstNode*>(0x1);
|
||||||
this->m_op3p = (AstNode*)1;
|
this->m_op3p = reinterpret_cast<AstNode*>(0x1);
|
||||||
this->m_op4p = (AstNode*)1;
|
this->m_op4p = reinterpret_cast<AstNode*>(0x1);
|
||||||
if (
|
if (
|
||||||
#if !defined(VL_DEBUG) || defined(VL_LEAK_CHECKS)
|
#if !defined(VL_DEBUG) || defined(VL_LEAK_CHECKS)
|
||||||
1
|
1
|
||||||
|
|
@ -1077,7 +1077,9 @@ void AstNode::v3errorEnd(std::ostringstream& str) const {
|
||||||
nsstr<<str.str();
|
nsstr<<str.str();
|
||||||
if (debug()) {
|
if (debug()) {
|
||||||
nsstr<<endl;
|
nsstr<<endl;
|
||||||
nsstr<<"-node: "; ((AstNode*)this)->dump(nsstr); nsstr<<endl;
|
nsstr<<"-node: ";
|
||||||
|
const_cast<AstNode*>(this)->dump(nsstr);
|
||||||
|
nsstr<<endl;
|
||||||
}
|
}
|
||||||
m_fileline->v3errorEnd(nsstr);
|
m_fileline->v3errorEnd(nsstr);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
22
src/V3Ast.h
22
src/V3Ast.h
|
|
@ -1027,7 +1027,7 @@ std::ostream& operator<<(std::ostream& os, const V3Hash& rhs);
|
||||||
// Prefetch a node.
|
// Prefetch a node.
|
||||||
// The if() makes it faster, even though prefetch won't fault on null pointers
|
// The if() makes it faster, even though prefetch won't fault on null pointers
|
||||||
#define ASTNODE_PREFETCH(nodep) \
|
#define ASTNODE_PREFETCH(nodep) \
|
||||||
{ if (nodep) { VL_PREFETCH_RD(&(nodep->m_nextp)); VL_PREFETCH_RD(&(nodep->m_iterpp)); }}
|
{ if (nodep) { VL_PREFETCH_RD(&((nodep)->m_nextp)); VL_PREFETCH_RD(&((nodep)->m_iterpp)); }}
|
||||||
|
|
||||||
class AstNode {
|
class AstNode {
|
||||||
// v ASTNODE_PREFETCH depends on below ordering of members
|
// v ASTNODE_PREFETCH depends on below ordering of members
|
||||||
|
|
@ -1171,8 +1171,8 @@ public:
|
||||||
static string dedotName(const string& namein); // Name with dots removed
|
static string dedotName(const string& namein); // Name with dots removed
|
||||||
static string prettyName(const string& namein); // Name for printing out to the user
|
static string prettyName(const string& namein); // Name for printing out to the user
|
||||||
static string encodeName(const string& namein); // Encode user name into internal C representation
|
static string encodeName(const string& namein); // Encode user name into internal C representation
|
||||||
static string encodeNumber(vlsint64_t numin); // Encode number into internal C representation
|
static string encodeNumber(vlsint64_t num); // Encode number into internal C representation
|
||||||
static string vcdName(const string& namein); // Name for printing out to vcd files
|
static string vcdName(const string& namein); // Name for printing out to vcd files
|
||||||
string prettyName() const { return prettyName(name()); }
|
string prettyName() const { return prettyName(name()); }
|
||||||
string prettyTypeName() const; // "VARREF" for error messages
|
string prettyTypeName() const; // "VARREF" for error messages
|
||||||
virtual string prettyOperatorName() const { return "operator "+prettyTypeName(); }
|
virtual string prettyOperatorName() const { return "operator "+prettyTypeName(); }
|
||||||
|
|
@ -1347,13 +1347,13 @@ public:
|
||||||
void checkTree(); // User Interface version
|
void checkTree(); // User Interface version
|
||||||
void checkIter() const;
|
void checkIter() const;
|
||||||
void clearIter() { m_iterpp=NULL; }
|
void clearIter() { m_iterpp=NULL; }
|
||||||
void dumpPtrs(std::ostream& str=std::cout) const;
|
void dumpPtrs(std::ostream& os=std::cout) const;
|
||||||
void dumpTree(std::ostream& str=std::cout, const string& indent=" ", int maxDepth=0);
|
void dumpTree(std::ostream& os=std::cout, const string& indent=" ", int maxDepth=0);
|
||||||
void dumpTree(const string& indent, int maxDepth=0) { dumpTree(cout,indent,maxDepth); }
|
void dumpTree(const string& indent, int maxDepth=0) { dumpTree(cout,indent,maxDepth); }
|
||||||
void dumpTreeGdb(); // For GDB only
|
void dumpTreeGdb(); // For GDB only
|
||||||
void dumpTreeAndNext(std::ostream& str=std::cout, const string& indent=" ", int maxDepth=0);
|
void dumpTreeAndNext(std::ostream& os=std::cout, const string& indent=" ", int maxDepth=0);
|
||||||
void dumpTreeFile(const string& filename, bool append=false, bool doDump=true);
|
void dumpTreeFile(const string& filename, bool append=false, bool doDump=true);
|
||||||
static void dumpTreeFileGdb(const char* filenamep=NULL);
|
static void dumpTreeFileGdb(const char* filenamep=NULL);
|
||||||
|
|
||||||
// METHODS - queries
|
// METHODS - queries
|
||||||
virtual bool isPure() const { return true; } // Else a $display, etc, that must be ordered with other displays
|
virtual bool isPure() const { return true; } // Else a $display, etc, that must be ordered with other displays
|
||||||
|
|
@ -1798,7 +1798,7 @@ public:
|
||||||
bool widthSized() const { return !m_widthMin || m_widthMin==m_width; }
|
bool widthSized() const { return !m_widthMin || m_widthMin==m_width; }
|
||||||
bool generic() const { return m_generic; }
|
bool generic() const { return m_generic; }
|
||||||
void generic(bool flag) { m_generic = flag; }
|
void generic(bool flag) { m_generic = flag; }
|
||||||
AstNodeDType* dtypeDimensionp(int depth);
|
AstNodeDType* dtypeDimensionp(int dimension);
|
||||||
std::pair<uint32_t,uint32_t> dimensions(bool includeBasic);
|
std::pair<uint32_t,uint32_t> dimensions(bool includeBasic);
|
||||||
uint32_t arrayUnpackedElements(); // 1, or total multiplication of all dimensions
|
uint32_t arrayUnpackedElements(); // 1, or total multiplication of all dimensions
|
||||||
static int uniqueNumInc() { return ++s_uniqueNum; }
|
static int uniqueNumInc() { return ++s_uniqueNum; }
|
||||||
|
|
|
||||||
|
|
@ -577,7 +577,9 @@ const char* AstScope::broken() const {
|
||||||
void AstScope::cloneRelink() {
|
void AstScope::cloneRelink() {
|
||||||
if (m_aboveScopep && m_aboveScopep->clonep()) m_aboveScopep->clonep();
|
if (m_aboveScopep && m_aboveScopep->clonep()) m_aboveScopep->clonep();
|
||||||
if (m_aboveCellp && m_aboveCellp->clonep()) m_aboveCellp->clonep();
|
if (m_aboveCellp && m_aboveCellp->clonep()) m_aboveCellp->clonep();
|
||||||
if (m_modp && ((AstNode*)m_modp)->clonep()) ((AstNode*)m_modp)->clonep();
|
if (m_modp && static_cast<AstNode*>(m_modp)->clonep()) {
|
||||||
|
static_cast<AstNode*>(m_modp)->clonep();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string AstScope::nameDotless() const {
|
string AstScope::nameDotless() const {
|
||||||
|
|
@ -651,7 +653,7 @@ bool AstSenTree::hasCombo() const {
|
||||||
void AstTypeTable::clearCache() {
|
void AstTypeTable::clearCache() {
|
||||||
// When we mass-change widthMin in V3WidthCommit, we need to correct the table.
|
// When we mass-change widthMin in V3WidthCommit, we need to correct the table.
|
||||||
// Just clear out the maps; the search functions will be used to rebuild the map
|
// Just clear out the maps; the search functions will be used to rebuild the map
|
||||||
for (int i=0; i<(int)(AstBasicDTypeKwd::_ENUM_MAX); ++i) {
|
for (int i=0; i < static_cast<int>(AstBasicDTypeKwd::_ENUM_MAX); ++i) {
|
||||||
m_basicps[i] = NULL;
|
m_basicps[i] = NULL;
|
||||||
}
|
}
|
||||||
for (int isbit=0; isbit<_IDX0_MAX; ++isbit) {
|
for (int isbit=0; isbit<_IDX0_MAX; ++isbit) {
|
||||||
|
|
@ -701,7 +703,7 @@ AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, AstBasicDTypeKwd kw
|
||||||
else if (kwd == AstBasicDTypeKwd::BIT) idx = IDX0_BIT;
|
else if (kwd == AstBasicDTypeKwd::BIT) idx = IDX0_BIT;
|
||||||
else fl->v3fatalSrc("Bad kwd for findLogicBitDType");
|
else fl->v3fatalSrc("Bad kwd for findLogicBitDType");
|
||||||
std::pair<int,int> widths = make_pair(width,widthMin);
|
std::pair<int,int> widths = make_pair(width,widthMin);
|
||||||
LogicMap& mapr = m_logicMap[idx][(int)numeric];
|
LogicMap& mapr = m_logicMap[idx][static_cast<int>(numeric)];
|
||||||
LogicMap::const_iterator it = mapr.find(widths);
|
LogicMap::const_iterator it = mapr.find(widths);
|
||||||
if (it != mapr.end()) return it->second;
|
if (it != mapr.end()) return it->second;
|
||||||
//
|
//
|
||||||
|
|
@ -991,7 +993,7 @@ void AstMTaskBody::dump(std::ostream& str) {
|
||||||
}
|
}
|
||||||
void AstTypeTable::dump(std::ostream& str) {
|
void AstTypeTable::dump(std::ostream& str) {
|
||||||
this->AstNode::dump(str);
|
this->AstNode::dump(str);
|
||||||
for (int i=0; i<(int)(AstBasicDTypeKwd::_ENUM_MAX); ++i) {
|
for (int i=0; i < static_cast<int>(AstBasicDTypeKwd::_ENUM_MAX); ++i) {
|
||||||
if (AstBasicDType* subnodep=m_basicps[i]) {
|
if (AstBasicDType* subnodep=m_basicps[i]) {
|
||||||
str<<endl; // Newline from caller, so newline first
|
str<<endl; // Newline from caller, so newline first
|
||||||
str<<"\t\t"<<std::setw(8)<<AstBasicDTypeKwd(i).ascii();
|
str<<"\t\t"<<std::setw(8)<<AstBasicDTypeKwd(i).ascii();
|
||||||
|
|
|
||||||
|
|
@ -3501,8 +3501,8 @@ class AstScopeName : public AstNodeMath {
|
||||||
// Children: TEXT
|
// Children: TEXT
|
||||||
private:
|
private:
|
||||||
bool m_dpiExport; // Is for dpiExport
|
bool m_dpiExport; // Is for dpiExport
|
||||||
string scopeNameFormatter(AstText* textp) const;
|
string scopeNameFormatter(AstText* scopeTextp) const;
|
||||||
string scopePrettyNameFormatter(AstText* textp) const;
|
string scopePrettyNameFormatter(AstText* scopeTextp) const;
|
||||||
public:
|
public:
|
||||||
explicit AstScopeName(FileLine* fl) : AstNodeMath(fl), m_dpiExport(false) {
|
explicit AstScopeName(FileLine* fl) : AstNodeMath(fl), m_dpiExport(false) {
|
||||||
dtypeSetUInt64(); }
|
dtypeSetUInt64(); }
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ public:
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// Branch class functions
|
// Branch class functions
|
||||||
|
|
||||||
void V3Branch::branchAll(AstNetlist* rootp) {
|
void V3Branch::branchAll(AstNetlist* nodep) {
|
||||||
UINFO(2,__FUNCTION__<<": "<<endl);
|
UINFO(2,__FUNCTION__<<": "<<endl);
|
||||||
BranchVisitor visitor (rootp);
|
BranchVisitor visitor (nodep);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
class V3Branch {
|
class V3Branch {
|
||||||
public:
|
public:
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
static void branchAll(AstNetlist* rootp);
|
static void branchAll(AstNetlist* nodep);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // Guard
|
#endif // Guard
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,8 @@ public:
|
||||||
if (debug()>=9) cout<<"-nodeDel: "<<cvtToHex(nodep)<<endl;
|
if (debug()>=9) cout<<"-nodeDel: "<<cvtToHex(nodep)<<endl;
|
||||||
NodeMap::iterator iter = s_nodes.find(nodep);
|
NodeMap::iterator iter = s_nodes.find(nodep);
|
||||||
if (iter==s_nodes.end() || !(iter->second & FLAG_ALLOCATED)) {
|
if (iter==s_nodes.end() || !(iter->second & FLAG_ALLOCATED)) {
|
||||||
((AstNode*)(nodep))->v3fatalSrc("Deleting AstNode object that was never tracked or already deleted");
|
reinterpret_cast<const AstNode*>(nodep)
|
||||||
|
->v3fatalSrc("Deleting AstNode object that was never tracked or already deleted");
|
||||||
}
|
}
|
||||||
if (iter!=s_nodes.end()) s_nodes.erase(iter);
|
if (iter!=s_nodes.end()) s_nodes.erase(iter);
|
||||||
}
|
}
|
||||||
|
|
@ -155,7 +156,9 @@ public:
|
||||||
// may be varp() and other cross links that are bad.
|
// may be varp() and other cross links that are bad.
|
||||||
if (v3Global.opt.debugCheck()) {
|
if (v3Global.opt.debugCheck()) {
|
||||||
std::cerr<<"%Error: LeakedNode"<<(it->first->backp()?"Back: ":": ");
|
std::cerr<<"%Error: LeakedNode"<<(it->first->backp()?"Back: ":": ");
|
||||||
((AstNode*)(it->first))->AstNode::dump(std::cerr);
|
AstNode* rawp = const_cast<AstNode*>
|
||||||
|
(static_cast<const AstNode*>(it->first));
|
||||||
|
rawp->AstNode::dump(std::cerr);
|
||||||
std::cerr<<endl;
|
std::cerr<<endl;
|
||||||
V3Error::incErrors();
|
V3Error::incErrors();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ public:
|
||||||
width += 1; // The :
|
width += 1; // The :
|
||||||
width += cvtToStr(m_maxLineno).length();
|
width += cvtToStr(m_maxLineno).length();
|
||||||
width += 1; // Final :
|
width += 1; // Final :
|
||||||
return (int)width;
|
return static_cast<int>(width);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -248,7 +248,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
CdcVarVertex* makeVarVertex(AstVarScope* varscp) {
|
CdcVarVertex* makeVarVertex(AstVarScope* varscp) {
|
||||||
CdcVarVertex* vertexp = (CdcVarVertex*)(varscp->user1p());
|
CdcVarVertex* vertexp = reinterpret_cast<CdcVarVertex*>(varscp->user1p());
|
||||||
if (!vertexp) {
|
if (!vertexp) {
|
||||||
UINFO(6,"New vertex "<<varscp<<endl);
|
UINFO(6,"New vertex "<<varscp<<endl);
|
||||||
vertexp = new CdcVarVertex(&m_graph, m_scopep, varscp);
|
vertexp = new CdcVarVertex(&m_graph, m_scopep, varscp);
|
||||||
|
|
@ -376,7 +376,7 @@ private:
|
||||||
if (vvertexp->varScp()->varp()->isPrimaryIn()) {
|
if (vvertexp->varScp()->varp()->isPrimaryIn()) {
|
||||||
// Show the source "input" statement if it exists
|
// Show the source "input" statement if it exists
|
||||||
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
|
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
|
||||||
CdcEitherVertex* eFromVertexp = (CdcEitherVertex*)edgep->fromp();
|
CdcEitherVertex* eFromVertexp = static_cast<CdcEitherVertex*>(edgep->fromp());
|
||||||
eFromVertexp->asyncPath(true);
|
eFromVertexp->asyncPath(true);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -384,7 +384,7 @@ private:
|
||||||
// Also ok if from flop, but partially trace the flop so more obvious to users
|
// Also ok if from flop, but partially trace the flop so more obvious to users
|
||||||
if (vvertexp->fromFlop()) {
|
if (vvertexp->fromFlop()) {
|
||||||
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
|
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
|
||||||
CdcEitherVertex* eFromVertexp = (CdcEitherVertex*)edgep->fromp();
|
CdcEitherVertex* eFromVertexp = static_cast<CdcEitherVertex*>(edgep->fromp());
|
||||||
eFromVertexp->asyncPath(true);
|
eFromVertexp->asyncPath(true);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -392,7 +392,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
|
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
|
||||||
CdcEitherVertex* eFromVertexp = (CdcEitherVertex*)edgep->fromp();
|
CdcEitherVertex* eFromVertexp = static_cast<CdcEitherVertex*>(edgep->fromp());
|
||||||
CdcEitherVertex* submarkp = traceAsyncRecurse(eFromVertexp, mark);
|
CdcEitherVertex* submarkp = traceAsyncRecurse(eFromVertexp, mark);
|
||||||
if (submarkp && !mark_outp) mark_outp = submarkp;
|
if (submarkp && !mark_outp) mark_outp = submarkp;
|
||||||
}
|
}
|
||||||
|
|
@ -407,7 +407,7 @@ private:
|
||||||
*m_ofp<<"\n";
|
*m_ofp<<"\n";
|
||||||
CdcEitherVertex* targetp = vertexp; // One example destination flop (of possibly many)
|
CdcEitherVertex* targetp = vertexp; // One example destination flop (of possibly many)
|
||||||
for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep = edgep->outNextp()) {
|
for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep = edgep->outNextp()) {
|
||||||
CdcEitherVertex* eToVertexp = (CdcEitherVertex*)edgep->top();
|
CdcEitherVertex* eToVertexp = static_cast<CdcEitherVertex*>(edgep->top());
|
||||||
if (!eToVertexp) targetp = eToVertexp;
|
if (!eToVertexp) targetp = eToVertexp;
|
||||||
if (CdcLogicVertex* vvertexp = dynamic_cast<CdcLogicVertex*>(eToVertexp)) {
|
if (CdcLogicVertex* vvertexp = dynamic_cast<CdcLogicVertex*>(eToVertexp)) {
|
||||||
if (vvertexp->isFlop() // IE the target flop that is upsetting us
|
if (vvertexp->isFlop() // IE the target flop that is upsetting us
|
||||||
|
|
@ -434,7 +434,7 @@ private:
|
||||||
string cont = prefix+sep;
|
string cont = prefix+sep;
|
||||||
string nextsep = " ";
|
string nextsep = " ";
|
||||||
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
|
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
|
||||||
CdcEitherVertex* eFromVertexp = (CdcEitherVertex*)edgep->fromp();
|
CdcEitherVertex* eFromVertexp = static_cast<CdcEitherVertex*>(edgep->fromp());
|
||||||
if (dumpAsyncRecurse(eFromVertexp, cont, nextsep, level+1)) {
|
if (dumpAsyncRecurse(eFromVertexp, cont, nextsep, level+1)) {
|
||||||
nextsep = " | ";
|
nextsep = " | ";
|
||||||
}
|
}
|
||||||
|
|
@ -553,13 +553,13 @@ private:
|
||||||
// Now combine domains of sources/dests
|
// Now combine domains of sources/dests
|
||||||
if (traceDests) {
|
if (traceDests) {
|
||||||
for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep = edgep->outNextp()) {
|
for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep = edgep->outNextp()) {
|
||||||
CdcEitherVertex* eToVertexp = (CdcEitherVertex*)edgep->top();
|
CdcEitherVertex* eToVertexp = static_cast<CdcEitherVertex*>(edgep->top());
|
||||||
edgeDomainRecurse(eToVertexp, traceDests, level+1);
|
edgeDomainRecurse(eToVertexp, traceDests, level+1);
|
||||||
if (eToVertexp->dstDomainp()) senouts.insert(eToVertexp->dstDomainp());
|
if (eToVertexp->dstDomainp()) senouts.insert(eToVertexp->dstDomainp());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
|
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
|
||||||
CdcEitherVertex* eFromVertexp = (CdcEitherVertex*)edgep->fromp();
|
CdcEitherVertex* eFromVertexp = static_cast<CdcEitherVertex*>(edgep->fromp());
|
||||||
edgeDomainRecurse(eFromVertexp, traceDests, level+1);
|
edgeDomainRecurse(eFromVertexp, traceDests, level+1);
|
||||||
if (eFromVertexp->srcDomainp()) senouts.insert(eFromVertexp->srcDomainp());
|
if (eFromVertexp->srcDomainp()) senouts.insert(eFromVertexp->srcDomainp());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ private:
|
||||||
nodep->user1(clean);
|
nodep->user1(clean);
|
||||||
}
|
}
|
||||||
CleanState getCleanState(AstNode* nodep) {
|
CleanState getCleanState(AstNode* nodep) {
|
||||||
return ((CleanState)nodep->user1());
|
return static_cast<CleanState>(nodep->user1());
|
||||||
}
|
}
|
||||||
bool isClean(AstNode* nodep) {
|
bool isClean(AstNode* nodep) {
|
||||||
CleanState clstate = getCleanState(nodep);
|
CleanState clstate = getCleanState(nodep);
|
||||||
|
|
|
||||||
|
|
@ -376,7 +376,7 @@ class GaterVisitor : public GaterBaseVisitor {
|
||||||
m_pliVertexp = new GaterPliVertex(&m_graph);
|
m_pliVertexp = new GaterPliVertex(&m_graph);
|
||||||
}
|
}
|
||||||
if (m_stmtVscp) { // Already saw a variable, be sure to mark it!
|
if (m_stmtVscp) { // Already saw a variable, be sure to mark it!
|
||||||
GaterVarVertex* varVtxp = (GaterVarVertex*)(m_stmtVscp->user1p());
|
GaterVarVertex* varVtxp = reinterpret_cast<GaterVarVertex*>(m_stmtVscp->user1p());
|
||||||
new GaterEdge(&m_graph, m_pliVertexp, varVtxp, VU_PLI);
|
new GaterEdge(&m_graph, m_pliVertexp, varVtxp, VU_PLI);
|
||||||
}
|
}
|
||||||
m_stmtInPli = true; // Mark all followon variables too
|
m_stmtInPli = true; // Mark all followon variables too
|
||||||
|
|
@ -689,9 +689,9 @@ class GaterVisitor : public GaterBaseVisitor {
|
||||||
nodep->addNextHere(alwp);
|
nodep->addNextHere(alwp);
|
||||||
|
|
||||||
// Blow moved statements from old body
|
// Blow moved statements from old body
|
||||||
GaterBodyVisitor(nodep,exprp,true);
|
{ GaterBodyVisitor vis(nodep,exprp,true); }
|
||||||
// Blow old statements from new body
|
// Blow old statements from new body
|
||||||
GaterBodyVisitor(alwp,exprp,false);
|
{ GaterBodyVisitor vis(alwp,exprp,false); }
|
||||||
|
|
||||||
++m_statGaters;
|
++m_statGaters;
|
||||||
if (debug()>=9) alwp->dumpTree(cout," new: ");
|
if (debug()>=9) alwp->dumpTree(cout," new: ");
|
||||||
|
|
@ -764,7 +764,7 @@ class GaterVisitor : public GaterBaseVisitor {
|
||||||
}
|
}
|
||||||
m_stmtVscp = vscp;
|
m_stmtVscp = vscp;
|
||||||
// Find, or make new Vertex
|
// Find, or make new Vertex
|
||||||
GaterVarVertex* vertexp = (GaterVarVertex*)(vscp->user1p());
|
GaterVarVertex* vertexp = reinterpret_cast<GaterVarVertex*>(vscp->user1p());
|
||||||
if (!vertexp) {
|
if (!vertexp) {
|
||||||
vertexp = new GaterVarVertex(&m_graph, vscp);
|
vertexp = new GaterVarVertex(&m_graph, vscp);
|
||||||
vscp->user1p(vertexp);
|
vscp->user1p(vertexp);
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ private:
|
||||||
VL_DEBUG_FUNC; // Declare debug()
|
VL_DEBUG_FUNC; // Declare debug()
|
||||||
|
|
||||||
AstVarScope* getCreateLastClk(AstVarScope* vscp) {
|
AstVarScope* getCreateLastClk(AstVarScope* vscp) {
|
||||||
if (vscp->user1p()) return ((AstVarScope*)vscp->user1p());
|
if (vscp->user1p()) return static_cast<AstVarScope*>(vscp->user1p());
|
||||||
AstVar* varp = vscp->varp();
|
AstVar* varp = vscp->varp();
|
||||||
if (!varp->width1()) varp->v3error("Unsupported: Clock edge on non-single bit signal: "<<varp->prettyName());
|
if (!varp->width1()) varp->v3error("Unsupported: Clock edge on non-single bit signal: "<<varp->prettyName());
|
||||||
string newvarname = (string("__Vclklast__")+vscp->scopep()->nameDotless()+"__"+varp->name());
|
string newvarname = (string("__Vclklast__")+vscp->scopep()->nameDotless()+"__"+varp->name());
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ protected:
|
||||||
// Also repair it for DPI functions; when make __common need to insure proper
|
// Also repair it for DPI functions; when make __common need to insure proper
|
||||||
// flags get inherited from the old to new AstCFunc, and that AstText doesn't
|
// flags get inherited from the old to new AstCFunc, and that AstText doesn't
|
||||||
// get split between functions causing the text to have a danginling reference.
|
// get split between functions causing the text to have a danginling reference.
|
||||||
bool statementCombine() { return false && duplicateFunctionCombine(); }
|
bool statementCombine() { return false; } // duplicateFunctionCombine();
|
||||||
};
|
};
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|
|
||||||
|
|
@ -242,13 +242,15 @@ private:
|
||||||
bool operandHugeShiftL(const AstNodeBiop* nodep) {
|
bool operandHugeShiftL(const AstNodeBiop* nodep) {
|
||||||
return (VN_IS(nodep->rhsp(), Const)
|
return (VN_IS(nodep->rhsp(), Const)
|
||||||
&& !VN_CAST_CONST(nodep->rhsp(), Const)->num().isFourState()
|
&& !VN_CAST_CONST(nodep->rhsp(), Const)->num().isFourState()
|
||||||
&& VN_CAST_CONST(nodep->rhsp(), Const)->toUInt() >= (uint32_t)(nodep->width())
|
&& (VN_CAST_CONST(nodep->rhsp(), Const)->toUInt()
|
||||||
|
>= static_cast<uint32_t>(nodep->width()))
|
||||||
&& isTPure(nodep->lhsp()));
|
&& isTPure(nodep->lhsp()));
|
||||||
}
|
}
|
||||||
bool operandHugeShiftR(const AstNodeBiop* nodep) {
|
bool operandHugeShiftR(const AstNodeBiop* nodep) {
|
||||||
return (VN_IS(nodep->rhsp(), Const)
|
return (VN_IS(nodep->rhsp(), Const)
|
||||||
&& !VN_CAST_CONST(nodep->rhsp(), Const)->num().isFourState()
|
&& !VN_CAST_CONST(nodep->rhsp(), Const)->num().isFourState()
|
||||||
&& VN_CAST_CONST(nodep->rhsp(), Const)->toUInt() >= (uint32_t)(nodep->lhsp()->width())
|
&& (VN_CAST_CONST(nodep->rhsp(), Const)->toUInt()
|
||||||
|
>= static_cast<uint32_t>(nodep->lhsp()->width()))
|
||||||
&& isTPure(nodep->lhsp()));
|
&& isTPure(nodep->lhsp()));
|
||||||
}
|
}
|
||||||
bool operandIsTwo(const AstNode* nodep) {
|
bool operandIsTwo(const AstNode* nodep) {
|
||||||
|
|
@ -294,14 +296,14 @@ private:
|
||||||
return (VN_IS(nodep->rhsp(), Const)
|
return (VN_IS(nodep->rhsp(), Const)
|
||||||
&& VN_IS(nodep->fromp(), NodeVarRef)
|
&& VN_IS(nodep->fromp(), NodeVarRef)
|
||||||
&& !VN_CAST_CONST(nodep->fromp(), NodeVarRef)->lvalue()
|
&& !VN_CAST_CONST(nodep->fromp(), NodeVarRef)->lvalue()
|
||||||
&& ((int)(VN_CAST_CONST(nodep->rhsp(), Const)->toUInt())
|
&& (static_cast<int>(VN_CAST_CONST(nodep->rhsp(), Const)->toUInt())
|
||||||
>= VN_CAST(nodep->fromp(), NodeVarRef)->varp()->widthWords()));
|
>= VN_CAST(nodep->fromp(), NodeVarRef)->varp()->widthWords()));
|
||||||
}
|
}
|
||||||
bool operandSelFull(const AstSel* nodep) {
|
bool operandSelFull(const AstSel* nodep) {
|
||||||
return (VN_IS(nodep->lsbp(), Const)
|
return (VN_IS(nodep->lsbp(), Const)
|
||||||
&& VN_IS(nodep->widthp(), Const)
|
&& VN_IS(nodep->widthp(), Const)
|
||||||
&& nodep->lsbConst()==0
|
&& nodep->lsbConst()==0
|
||||||
&& (int)nodep->widthConst()==nodep->fromp()->width());
|
&& static_cast<int>(nodep->widthConst()) == nodep->fromp()->width());
|
||||||
}
|
}
|
||||||
bool operandSelExtend(AstSel* nodep) {
|
bool operandSelExtend(AstSel* nodep) {
|
||||||
// A pattern created by []'s after offsets have been removed
|
// A pattern created by []'s after offsets have been removed
|
||||||
|
|
@ -313,7 +315,7 @@ private:
|
||||||
&& VN_IS(nodep->lsbp(), Const)
|
&& VN_IS(nodep->lsbp(), Const)
|
||||||
&& VN_IS(nodep->widthp(), Const)
|
&& VN_IS(nodep->widthp(), Const)
|
||||||
&& nodep->lsbConst()==0
|
&& nodep->lsbConst()==0
|
||||||
&& (int)nodep->widthConst()==extendp->lhsp()->width()
|
&& static_cast<int>(nodep->widthConst()) == extendp->lhsp()->width()
|
||||||
)) return false;
|
)) return false;
|
||||||
replaceWChild(nodep, extendp->lhsp()); VL_DANGLING(nodep);
|
replaceWChild(nodep, extendp->lhsp()); VL_DANGLING(nodep);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -512,8 +514,7 @@ private:
|
||||||
const AstConst* rwidth = VN_CAST_CONST(rhsp->widthp(), Const);
|
const AstConst* rwidth = VN_CAST_CONST(rhsp->widthp(), Const);
|
||||||
if (!lstart || !rstart || !lwidth || !rwidth) return false; // too complicated
|
if (!lstart || !rstart || !lwidth || !rwidth) return false; // too complicated
|
||||||
int rend = (rstart->toSInt() + rwidth->toSInt());
|
int rend = (rstart->toSInt() + rwidth->toSInt());
|
||||||
if (rend == lstart->toSInt()) return true;
|
return (rend == lstart->toSInt());
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
bool ifMergeAdjacent(AstNode* lhsp, AstNode* rhsp) {
|
bool ifMergeAdjacent(AstNode* lhsp, AstNode* rhsp) {
|
||||||
// called by concatmergeable to determine if {lhsp, rhsp} make sense
|
// called by concatmergeable to determine if {lhsp, rhsp} make sense
|
||||||
|
|
@ -1184,7 +1185,8 @@ private:
|
||||||
if (!VN_IS(VN_CAST_CONST(nodep, And)->rhsp(), ShiftR)) return false;
|
if (!VN_IS(VN_CAST_CONST(nodep, And)->rhsp(), ShiftR)) return false;
|
||||||
const AstShiftR* shiftp = VN_CAST(VN_CAST_CONST(nodep, And)->rhsp(), ShiftR);
|
const AstShiftR* shiftp = VN_CAST(VN_CAST_CONST(nodep, And)->rhsp(), ShiftR);
|
||||||
if (!VN_IS(shiftp->rhsp(), Const)) return false;
|
if (!VN_IS(shiftp->rhsp(), Const)) return false;
|
||||||
if ((uint32_t)(nodep->width()) <= VN_CAST_CONST(shiftp->rhsp(), Const)->toUInt()) return false;
|
if (static_cast<uint32_t>(nodep->width())
|
||||||
|
<= VN_CAST_CONST(shiftp->rhsp(), Const)->toUInt()) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void replaceBoolShift(AstNode* nodep) {
|
void replaceBoolShift(AstNode* nodep) {
|
||||||
|
|
@ -1366,7 +1368,7 @@ private:
|
||||||
AstConcat* conp = VN_CAST(nodep->fromp(), Concat);
|
AstConcat* conp = VN_CAST(nodep->fromp(), Concat);
|
||||||
AstNode* conLhsp = conp->lhsp();
|
AstNode* conLhsp = conp->lhsp();
|
||||||
AstNode* conRhsp = conp->rhsp();
|
AstNode* conRhsp = conp->rhsp();
|
||||||
if ((int)nodep->lsbConst() >= conRhsp->width()) {
|
if (static_cast<int>(nodep->lsbConst()) >= conRhsp->width()) {
|
||||||
conLhsp->unlinkFrBack();
|
conLhsp->unlinkFrBack();
|
||||||
AstSel* newp = new AstSel(nodep->fileline(),
|
AstSel* newp = new AstSel(nodep->fileline(),
|
||||||
conLhsp,
|
conLhsp,
|
||||||
|
|
@ -1374,7 +1376,7 @@ private:
|
||||||
nodep->widthConst());
|
nodep->widthConst());
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
}
|
}
|
||||||
else if ((int)nodep->msbConst() < conRhsp->width()) {
|
else if (static_cast<int>(nodep->msbConst()) < conRhsp->width()) {
|
||||||
conRhsp->unlinkFrBack();
|
conRhsp->unlinkFrBack();
|
||||||
AstSel* newp = new AstSel(nodep->fileline(),
|
AstSel* newp = new AstSel(nodep->fileline(),
|
||||||
conRhsp,
|
conRhsp,
|
||||||
|
|
|
||||||
|
|
@ -180,9 +180,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleVarBottom(AstNodeDType* dtypep, int depth, // per-iteration
|
void toggleVarBottom(const ToggleEnt& above, const AstVar* varp) {
|
||||||
const ToggleEnt& above,
|
|
||||||
AstVar* varp, AstVar* chgVarp) { // Constant
|
|
||||||
AstCoverToggle* newp
|
AstCoverToggle* newp
|
||||||
= new AstCoverToggle(varp->fileline(),
|
= new AstCoverToggle(varp->fileline(),
|
||||||
newCoverInc(varp->fileline(), "", "v_toggle",
|
newCoverInc(varp->fileline(), "", "v_toggle",
|
||||||
|
|
@ -202,15 +200,11 @@ private:
|
||||||
ToggleEnt newent (above.m_comment+string("[")+cvtToStr(index_docs)+"]",
|
ToggleEnt newent (above.m_comment+string("[")+cvtToStr(index_docs)+"]",
|
||||||
new AstSel(varp->fileline(), above.m_varRefp->cloneTree(true), index_code, 1),
|
new AstSel(varp->fileline(), above.m_varRefp->cloneTree(true), index_code, 1),
|
||||||
new AstSel(varp->fileline(), above.m_chgRefp->cloneTree(true), index_code, 1));
|
new AstSel(varp->fileline(), above.m_chgRefp->cloneTree(true), index_code, 1));
|
||||||
toggleVarBottom(dtypep, depth+1,
|
toggleVarBottom(newent, varp);
|
||||||
newent,
|
|
||||||
varp, chgVarp);
|
|
||||||
newent.cleanup();
|
newent.cleanup();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
toggleVarBottom(dtypep, depth+1,
|
toggleVarBottom(above, varp);
|
||||||
above,
|
|
||||||
varp, chgVarp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (AstUnpackArrayDType* adtypep = VN_CAST(dtypep, UnpackArrayDType)) {
|
else if (AstUnpackArrayDType* adtypep = VN_CAST(dtypep, UnpackArrayDType)) {
|
||||||
|
|
|
||||||
|
|
@ -585,8 +585,8 @@ public:
|
||||||
}
|
}
|
||||||
virtual void visit(AstReplicate* nodep) {
|
virtual void visit(AstReplicate* nodep) {
|
||||||
if (nodep->lhsp()->widthMin() == 1 && !nodep->isWide()) {
|
if (nodep->lhsp()->widthMin() == 1 && !nodep->isWide()) {
|
||||||
if (((int)VN_CAST(nodep->rhsp(), Const)->toUInt()
|
if ((static_cast<int>(VN_CAST(nodep->rhsp(), Const)->toUInt())
|
||||||
* nodep->lhsp()->widthMin()) != nodep->widthMin())
|
* nodep->lhsp()->widthMin()) != nodep->widthMin())
|
||||||
nodep->v3fatalSrc("Replicate non-constant or width miscomputed");
|
nodep->v3fatalSrc("Replicate non-constant or width miscomputed");
|
||||||
puts("VL_REPLICATE_");
|
puts("VL_REPLICATE_");
|
||||||
emitIQW(nodep);
|
emitIQW(nodep);
|
||||||
|
|
@ -687,7 +687,9 @@ public:
|
||||||
}
|
}
|
||||||
for (int word=VL_WORDS_I(upWidth)-1; word>=0; word--) {
|
for (int word=VL_WORDS_I(upWidth)-1; word>=0; word--) {
|
||||||
// Only 32 bits - llx + long long here just to appease CPP format warning
|
// Only 32 bits - llx + long long here just to appease CPP format warning
|
||||||
ofp()->printf(",0x%08" VL_PRI64 "x", (vluint64_t)(nodep->num().dataWord(word+chunks*EMITC_NUM_CONSTW)));
|
ofp()->printf(",0x%08" VL_PRI64 "x",
|
||||||
|
static_cast<vluint64_t>(nodep->num().dataWord
|
||||||
|
(word+chunks*EMITC_NUM_CONSTW)));
|
||||||
}
|
}
|
||||||
puts(")");
|
puts(")");
|
||||||
}
|
}
|
||||||
|
|
@ -708,7 +710,9 @@ public:
|
||||||
}
|
}
|
||||||
for (int word=EMITC_NUM_CONSTW-1; word>=0; word--) {
|
for (int word=EMITC_NUM_CONSTW-1; word>=0; word--) {
|
||||||
// Only 32 bits - llx + long long here just to appease CPP format warning
|
// Only 32 bits - llx + long long here just to appease CPP format warning
|
||||||
ofp()->printf(",0x%08" VL_PRI64 "x", (vluint64_t)(nodep->num().dataWord(word+chunks*EMITC_NUM_CONSTW)));
|
ofp()->printf(",0x%08" VL_PRI64 "x",
|
||||||
|
static_cast<vluint64_t>(nodep->num().dataWord
|
||||||
|
(word+chunks*EMITC_NUM_CONSTW)));
|
||||||
}
|
}
|
||||||
puts(")");
|
puts(")");
|
||||||
}
|
}
|
||||||
|
|
@ -730,7 +734,7 @@ public:
|
||||||
uint32_t num = nodep->toUInt();
|
uint32_t num = nodep->toUInt();
|
||||||
// Only 32 bits - llx + long long here just to appease CPP format warning
|
// Only 32 bits - llx + long long here just to appease CPP format warning
|
||||||
if (num<10) puts(cvtToStr(num));
|
if (num<10) puts(cvtToStr(num));
|
||||||
else ofp()->printf("0x%" VL_PRI64 "x", (vluint64_t)num);
|
else ofp()->printf("0x%" VL_PRI64 "x", static_cast<vluint64_t>(num));
|
||||||
// If signed, we'll do our own functions
|
// If signed, we'll do our own functions
|
||||||
// But must be here, or <= comparisons etc may end up signed
|
// But must be here, or <= comparisons etc may end up signed
|
||||||
puts("U");
|
puts("U");
|
||||||
|
|
@ -1164,7 +1168,7 @@ class EmitCImp : EmitCStmts {
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
// Low level
|
// Low level
|
||||||
void emitVarReset(AstVar* modp);
|
void emitVarReset(AstVar* varp);
|
||||||
void emitCellCtors(AstNodeModule* modp);
|
void emitCellCtors(AstNodeModule* modp);
|
||||||
void emitSensitives();
|
void emitSensitives();
|
||||||
// Medium level
|
// Medium level
|
||||||
|
|
@ -1336,7 +1340,7 @@ void EmitCStmts::emitOpName(AstNode* nodep, const string& format,
|
||||||
// , Commas suppressed if the previous field is suppressed
|
// , Commas suppressed if the previous field is suppressed
|
||||||
string nextComma;
|
string nextComma;
|
||||||
bool needComma = false;
|
bool needComma = false;
|
||||||
#define COMMA { if (nextComma!="") { puts(nextComma); nextComma=""; } }
|
#define COMMA { if (!nextComma.empty()) { puts(nextComma); nextComma=""; } }
|
||||||
|
|
||||||
putbs("");
|
putbs("");
|
||||||
for (string::const_iterator pos = format.begin(); pos != format.end(); ++pos) {
|
for (string::const_iterator pos = format.begin(); pos != format.end(); ++pos) {
|
||||||
|
|
@ -1675,7 +1679,8 @@ void EmitCImp::emitVarReset(AstVar* varp) {
|
||||||
}
|
}
|
||||||
bool zeroit = (varp->attrFileDescr() // Zero it out, so we don't core dump if never call $fopen
|
bool zeroit = (varp->attrFileDescr() // Zero it out, so we don't core dump if never call $fopen
|
||||||
|| (varp->basicp() && varp->basicp()->isZeroInit())
|
|| (varp->basicp() && varp->basicp()->isZeroInit())
|
||||||
|| (varp->name().size()>=1 && varp->name()[0]=='_' && v3Global.opt.underlineZero())
|
|| (v3Global.opt.underlineZero()
|
||||||
|
&& !varp->name().empty() && varp->name()[0]=='_')
|
||||||
|| (v3Global.opt.xInitial() == "fast" || v3Global.opt.xInitial() == "0"));
|
|| (v3Global.opt.xInitial() == "fast" || v3Global.opt.xInitial() == "0"));
|
||||||
if (varp->isWide()) {
|
if (varp->isWide()) {
|
||||||
// DOCUMENT: We randomize everything. If the user wants a _var to be zero,
|
// DOCUMENT: We randomize everything. If the user wants a _var to be zero,
|
||||||
|
|
@ -1877,7 +1882,7 @@ void EmitCImp::emitSavableImp(AstNodeModule* modp) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ofp()->printf( "vluint64_t __Vcheckval = VL_ULL(0x%" VL_PRI64 "x);\n",
|
ofp()->printf( "vluint64_t __Vcheckval = VL_ULL(0x%" VL_PRI64 "x);\n",
|
||||||
(vluint64_t)hash.digestUInt64());
|
static_cast<vluint64_t>(hash.digestUInt64()));
|
||||||
if (de) {
|
if (de) {
|
||||||
puts("os.readAssert(__Vcheckval);\n");
|
puts("os.readAssert(__Vcheckval);\n");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -550,9 +550,9 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
}
|
}
|
||||||
// Terminals
|
// Terminals
|
||||||
virtual void visit(AstVarRef* nodep) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (nodep->varScopep())
|
if (nodep->varScopep()) {
|
||||||
putfs(nodep,nodep->varScopep()->prettyName());
|
putfs(nodep,nodep->varScopep()->prettyName());
|
||||||
else {
|
} else {
|
||||||
putfs(nodep,nodep->hiername());
|
putfs(nodep,nodep->hiername());
|
||||||
puts(nodep->varp()->prettyName());
|
puts(nodep->varp()->prettyName());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ public:
|
||||||
static void emitv();
|
static void emitv();
|
||||||
static void verilogForTree(AstNode* nodep, std::ostream& os=std::cout);
|
static void verilogForTree(AstNode* nodep, std::ostream& os=std::cout);
|
||||||
static void verilogPrefixedTree(AstNode* nodep, std::ostream& os, const string& prefix, int flWidth,
|
static void verilogPrefixedTree(AstNode* nodep, std::ostream& os, const string& prefix, int flWidth,
|
||||||
AstSenTree* domainp, bool user3percent);
|
AstSenTree* domainp, bool user3mark);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // Guard
|
#endif // Guard
|
||||||
|
|
|
||||||
|
|
@ -115,11 +115,11 @@ class EmitXmlFileVisitor : public AstNVisitor {
|
||||||
virtual void visit(AstPin* nodep) {
|
virtual void visit(AstPin* nodep) {
|
||||||
// What we call a pin in verilator is a port in the IEEE spec.
|
// What we call a pin in verilator is a port in the IEEE spec.
|
||||||
outputTag(nodep, "port"); // IEEE: vpiPort
|
outputTag(nodep, "port"); // IEEE: vpiPort
|
||||||
if (nodep->modVarp()->isInOnly())
|
if (nodep->modVarp()->isInOnly()) {
|
||||||
puts(" direction=\"in\"");
|
puts(" direction=\"in\"");
|
||||||
else if (nodep->modVarp()->isOutOnly())
|
} else if (nodep->modVarp()->isOutOnly()) {
|
||||||
puts(" direction=\"out\"");
|
puts(" direction=\"out\"");
|
||||||
else puts(" direction=\"inout\"");
|
} else puts(" direction=\"inout\"");
|
||||||
puts(" portIndex=\""+cvtToStr(nodep->pinNum())+"\""); // IEEE: vpiPortIndex
|
puts(" portIndex=\""+cvtToStr(nodep->pinNum())+"\""); // IEEE: vpiPortIndex
|
||||||
// Children includes vpiHighConn and vpiLowConn; we don't support port bits (yet?)
|
// Children includes vpiHighConn and vpiLowConn; we don't support port bits (yet?)
|
||||||
outputChildrenEnd(nodep, "port");
|
outputChildrenEnd(nodep, "port");
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ v3errorIniter v3errorInit;
|
||||||
V3ErrorCode::V3ErrorCode(const char* msgp) {
|
V3ErrorCode::V3ErrorCode(const char* msgp) {
|
||||||
// Return error encoding for given string, or ERROR, which is a bad code
|
// Return error encoding for given string, or ERROR, which is a bad code
|
||||||
for (int codei=V3ErrorCode::EC_MIN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
|
for (int codei=V3ErrorCode::EC_MIN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
|
||||||
V3ErrorCode code = (V3ErrorCode)codei;
|
V3ErrorCode code = V3ErrorCode(codei);
|
||||||
if (0==strcasecmp(msgp,code.ascii())) {
|
if (0==strcasecmp(msgp,code.ascii())) {
|
||||||
m_e = code; return;
|
m_e = code; return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -348,7 +348,7 @@ private:
|
||||||
if (nodep->user1SetOnce()) return; // Process once
|
if (nodep->user1SetOnce()) return; // Process once
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
// Remember, Sel's may have non-integer rhs, so need to optimize for that!
|
// Remember, Sel's may have non-integer rhs, so need to optimize for that!
|
||||||
if (nodep->widthMin()!=(int)nodep->widthConst()) nodep->v3fatalSrc("Width mismatch");
|
if (nodep->widthMin() != nodep->widthConst()) nodep->v3fatalSrc("Width mismatch");
|
||||||
if (VN_IS(nodep->backp(), NodeAssign) && nodep==VN_CAST(nodep->backp(), NodeAssign)->lhsp()) {
|
if (VN_IS(nodep->backp(), NodeAssign) && nodep==VN_CAST(nodep->backp(), NodeAssign)->lhsp()) {
|
||||||
// Sel is an LHS assignment select
|
// Sel is an LHS assignment select
|
||||||
} else if (nodep->isWide()) {
|
} else if (nodep->isWide()) {
|
||||||
|
|
@ -456,7 +456,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool expandWide(AstNodeAssign* nodep, AstSel* rhsp) {
|
bool expandWide(AstNodeAssign* nodep, AstSel* rhsp) {
|
||||||
if (nodep->widthMin()!=(int)rhsp->widthConst()) nodep->v3fatalSrc("Width mismatch");
|
if (nodep->widthMin() != rhsp->widthConst()) nodep->v3fatalSrc("Width mismatch");
|
||||||
if (VN_IS(rhsp->lsbp(), Const) && VL_BITBIT_I(rhsp->lsbConst())==0) {
|
if (VN_IS(rhsp->lsbp(), Const) && VL_BITBIT_I(rhsp->lsbConst())==0) {
|
||||||
int lsb = rhsp->lsbConst();
|
int lsb = rhsp->lsbConst();
|
||||||
UINFO(8," Wordize ASSIGN(SEL,align) "<<nodep<<endl);
|
UINFO(8," Wordize ASSIGN(SEL,align) "<<nodep<<endl);
|
||||||
|
|
@ -527,9 +527,12 @@ private:
|
||||||
// else we would just be setting it to the same exact value
|
// else we would just be setting it to the same exact value
|
||||||
AstNode* oldvalp = newAstWordSelClone(destp, w);
|
AstNode* oldvalp = newAstWordSelClone(destp, w);
|
||||||
fixCloneLvalue(oldvalp);
|
fixCloneLvalue(oldvalp);
|
||||||
if (!ones) oldvalp = new AstAnd(lhsp->fileline(),
|
if (!ones) {
|
||||||
new AstConst(lhsp->fileline(), maskold.dataWord(w)),
|
oldvalp = new AstAnd(lhsp->fileline(),
|
||||||
oldvalp);
|
new AstConst(lhsp->fileline(),
|
||||||
|
maskold.dataWord(w)),
|
||||||
|
oldvalp);
|
||||||
|
}
|
||||||
addWordAssign(nodep, w,
|
addWordAssign(nodep, w,
|
||||||
destp,
|
destp,
|
||||||
new AstOr(lhsp->fileline(),
|
new AstOr(lhsp->fileline(),
|
||||||
|
|
@ -542,12 +545,16 @@ private:
|
||||||
destp->deleteTree(); VL_DANGLING(destp);
|
destp->deleteTree(); VL_DANGLING(destp);
|
||||||
} else {
|
} else {
|
||||||
UINFO(8," ASSIGNSEL(const,narrow) "<<nodep<<endl);
|
UINFO(8," ASSIGNSEL(const,narrow) "<<nodep<<endl);
|
||||||
if (destp->isQuad() && !rhsp->isQuad()) rhsp = new AstCCast(nodep->fileline(), rhsp, nodep);
|
if (destp->isQuad() && !rhsp->isQuad()) {
|
||||||
|
rhsp = new AstCCast(nodep->fileline(), rhsp, nodep);
|
||||||
|
}
|
||||||
AstNode* oldvalp = destp->cloneTree(true);
|
AstNode* oldvalp = destp->cloneTree(true);
|
||||||
fixCloneLvalue(oldvalp);
|
fixCloneLvalue(oldvalp);
|
||||||
if (!ones) oldvalp = new AstAnd(lhsp->fileline(),
|
if (!ones) {
|
||||||
new AstConst(lhsp->fileline(), maskold),
|
oldvalp = new AstAnd(lhsp->fileline(),
|
||||||
oldvalp);
|
new AstConst(lhsp->fileline(), maskold),
|
||||||
|
oldvalp);
|
||||||
|
}
|
||||||
AstNode* newp
|
AstNode* newp
|
||||||
= new AstOr(lhsp->fileline(),
|
= new AstOr(lhsp->fileline(),
|
||||||
oldvalp,
|
oldvalp,
|
||||||
|
|
@ -569,7 +576,7 @@ private:
|
||||||
destp->cloneTree(true),
|
destp->cloneTree(true),
|
||||||
newSelBitWord(lhsp->lsbp(), 0));
|
newSelBitWord(lhsp->lsbp(), 0));
|
||||||
fixCloneLvalue(oldvalp);
|
fixCloneLvalue(oldvalp);
|
||||||
if (!ones)
|
if (!ones) {
|
||||||
oldvalp = new AstAnd(lhsp->fileline(),
|
oldvalp = new AstAnd(lhsp->fileline(),
|
||||||
new AstNot(lhsp->fileline(),
|
new AstNot(lhsp->fileline(),
|
||||||
new AstShiftL(lhsp->fileline(),
|
new AstShiftL(lhsp->fileline(),
|
||||||
|
|
@ -580,7 +587,7 @@ private:
|
||||||
newSelBitBit(lhsp->lsbp()),
|
newSelBitBit(lhsp->lsbp()),
|
||||||
VL_WORDSIZE)),
|
VL_WORDSIZE)),
|
||||||
oldvalp);
|
oldvalp);
|
||||||
|
}
|
||||||
// Restrict the shift amount to 0-31, see bug804.
|
// Restrict the shift amount to 0-31, see bug804.
|
||||||
AstNode* shiftp = new AstAnd(nodep->fileline(), lhsp->lsbp()->cloneTree(true),
|
AstNode* shiftp = new AstAnd(nodep->fileline(), lhsp->lsbp()->cloneTree(true),
|
||||||
new AstConst(nodep->fileline(), VL_WORDSIZE-1));
|
new AstConst(nodep->fileline(), VL_WORDSIZE-1));
|
||||||
|
|
@ -618,10 +625,10 @@ private:
|
||||||
fixCloneLvalue(oldvalp);
|
fixCloneLvalue(oldvalp);
|
||||||
|
|
||||||
V3Number maskwidth (nodep->fileline(), destp->widthMin());
|
V3Number maskwidth (nodep->fileline(), destp->widthMin());
|
||||||
for (int bit=0; bit<(int)lhsp->widthConst(); bit++) maskwidth.setBit(bit,1);
|
for (int bit=0; bit < lhsp->widthConst(); bit++) maskwidth.setBit(bit,1);
|
||||||
|
|
||||||
if (destp->isQuad() && !rhsp->isQuad()) rhsp = new AstCCast(nodep->fileline(), rhsp, nodep);
|
if (destp->isQuad() && !rhsp->isQuad()) rhsp = new AstCCast(nodep->fileline(), rhsp, nodep);
|
||||||
if (!ones)
|
if (!ones) {
|
||||||
oldvalp = new AstAnd(lhsp->fileline(),
|
oldvalp = new AstAnd(lhsp->fileline(),
|
||||||
new AstNot(lhsp->fileline(),
|
new AstNot(lhsp->fileline(),
|
||||||
new AstShiftL(lhsp->fileline(),
|
new AstShiftL(lhsp->fileline(),
|
||||||
|
|
@ -630,6 +637,7 @@ private:
|
||||||
lhsp->lsbp()->cloneTree(true),
|
lhsp->lsbp()->cloneTree(true),
|
||||||
destp->width())),
|
destp->width())),
|
||||||
oldvalp);
|
oldvalp);
|
||||||
|
}
|
||||||
AstNode* newp
|
AstNode* newp
|
||||||
= new AstOr(lhsp->fileline(),
|
= new AstOr(lhsp->fileline(),
|
||||||
oldvalp,
|
oldvalp,
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,8 @@
|
||||||
|
|
||||||
// If change this code, run a test with the below size set very small
|
// If change this code, run a test with the below size set very small
|
||||||
//#define INFILTER_IPC_BUFSIZ 16
|
//#define INFILTER_IPC_BUFSIZ 16
|
||||||
#define INFILTER_IPC_BUFSIZ 64*1024 // For debug, try this as a small number
|
#define INFILTER_IPC_BUFSIZ (64*1024) // For debug, try this as a small number
|
||||||
#define INFILTER_CACHE_MAX 64*1024 // Maximum bytes to cache if same file read twice
|
#define INFILTER_CACHE_MAX (64*1024) // Maximum bytes to cache if same file read twice
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// V3File Internal state
|
// V3File Internal state
|
||||||
|
|
@ -124,8 +124,8 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void writeDepend(const string& filename);
|
void writeDepend(const string& filename);
|
||||||
void writeTimes(const string& filename, const string& cmdline);
|
void writeTimes(const string& filename, const string& cmdlineIn);
|
||||||
bool checkTimes(const string& filename, const string& cmdline);
|
bool checkTimes(const string& filename, const string& cmdlineIn);
|
||||||
};
|
};
|
||||||
|
|
||||||
V3FileDependImp dependImp; // Depend implementation class
|
V3FileDependImp dependImp; // Depend implementation class
|
||||||
|
|
@ -180,7 +180,7 @@ inline void V3FileDependImp::writeTimes(const string& filename, const string& cm
|
||||||
for (std::set<DependFile>::iterator iter=m_filenameList.begin();
|
for (std::set<DependFile>::iterator iter=m_filenameList.begin();
|
||||||
iter!=m_filenameList.end(); ++iter) {
|
iter!=m_filenameList.end(); ++iter) {
|
||||||
// Read stats of files we create after we're done making them (execpt for this file, of course)
|
// Read stats of files we create after we're done making them (execpt for this file, of course)
|
||||||
DependFile* dfp = (DependFile*)&(*iter);
|
DependFile* dfp = const_cast<DependFile*>(&(*iter));
|
||||||
V3Options::fileNfsFlush(dfp->filename());
|
V3Options::fileNfsFlush(dfp->filename());
|
||||||
dfp->loadStats();
|
dfp->loadStats();
|
||||||
off_t showSize = iter->size();
|
off_t showSize = iter->size();
|
||||||
|
|
@ -232,6 +232,7 @@ inline bool V3FileDependImp::checkTimes(const string& filename, const string& cm
|
||||||
string chkFilename; getline(*ifp, chkFilename, '"');
|
string chkFilename; getline(*ifp, chkFilename, '"');
|
||||||
|
|
||||||
V3Options::fileNfsFlush(chkFilename);
|
V3Options::fileNfsFlush(chkFilename);
|
||||||
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
|
||||||
struct stat chkStat;
|
struct stat chkStat;
|
||||||
int err = stat(chkFilename.c_str(), &chkStat);
|
int err = stat(chkFilename.c_str(), &chkStat);
|
||||||
if (err!=0) {
|
if (err!=0) {
|
||||||
|
|
@ -280,11 +281,11 @@ void V3File::addTgtDepend(const string& filename) {
|
||||||
void V3File::writeDepend(const string& filename) {
|
void V3File::writeDepend(const string& filename) {
|
||||||
dependImp.writeDepend(filename);
|
dependImp.writeDepend(filename);
|
||||||
}
|
}
|
||||||
void V3File::writeTimes(const string& filename, const string& cmdline) {
|
void V3File::writeTimes(const string& filename, const string& cmdlineIn) {
|
||||||
dependImp.writeTimes(filename, cmdline);
|
dependImp.writeTimes(filename, cmdlineIn);
|
||||||
}
|
}
|
||||||
bool V3File::checkTimes(const string& filename, const string& cmdline) {
|
bool V3File::checkTimes(const string& filename, const string& cmdlineIn) {
|
||||||
return dependImp.checkTimes(filename, cmdline);
|
return dependImp.checkTimes(filename, cmdlineIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3File::createMakeDir() {
|
void V3File::createMakeDir() {
|
||||||
|
|
@ -463,7 +464,7 @@ private:
|
||||||
dup2(fd_stdout[P_WR], 1);
|
dup2(fd_stdout[P_WR], 1);
|
||||||
// And stderr comes from parent
|
// And stderr comes from parent
|
||||||
|
|
||||||
execl("/bin/sh", "sh", "-c", command.c_str(), (char*)NULL);
|
execl("/bin/sh", "sh", "-c", command.c_str(), static_cast<char*>(NULL));
|
||||||
// Don't use v3fatal, we don't share the common structures any more
|
// Don't use v3fatal, we don't share the common structures any more
|
||||||
fprintf(stderr,"--pipe-filter: exec failed: %s\n",strerror(errno));
|
fprintf(stderr,"--pipe-filter: exec failed: %s\n",strerror(errno));
|
||||||
_exit(10);
|
_exit(10);
|
||||||
|
|
@ -858,7 +859,7 @@ void V3OutFormatter::printf(const char *fmt...) {
|
||||||
|
|
||||||
V3OutFile::V3OutFile(const string& filename, V3OutFormatter::Language lang)
|
V3OutFile::V3OutFile(const string& filename, V3OutFormatter::Language lang)
|
||||||
: V3OutFormatter(filename, lang) {
|
: V3OutFormatter(filename, lang) {
|
||||||
if ((m_fp = V3File::new_fopen_w(filename.c_str())) == NULL) {
|
if ((m_fp = V3File::new_fopen_w(filename)) == NULL) {
|
||||||
v3fatal("Cannot write "<<filename);
|
v3fatal("Cannot write "<<filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,8 @@ public:
|
||||||
static void addSrcDepend(const string& filename);
|
static void addSrcDepend(const string& filename);
|
||||||
static void addTgtDepend(const string& filename);
|
static void addTgtDepend(const string& filename);
|
||||||
static void writeDepend(const string& filename);
|
static void writeDepend(const string& filename);
|
||||||
static void writeTimes(const string& filename, const string& cmdline);
|
static void writeTimes(const string& filename, const string& cmdlineIn);
|
||||||
static bool checkTimes(const string& filename, const string& cmdline);
|
static bool checkTimes(const string& filename, const string& cmdlineIn);
|
||||||
|
|
||||||
// Directory utilities
|
// Directory utilities
|
||||||
static void createMakeDir();
|
static void createMakeDir();
|
||||||
|
|
@ -129,7 +129,7 @@ private:
|
||||||
int m_bracketLevel; // Intenting = { block, indicates number of {'s seen.
|
int m_bracketLevel; // Intenting = { block, indicates number of {'s seen.
|
||||||
|
|
||||||
int endLevels(const char* strg);
|
int endLevels(const char* strg);
|
||||||
const char* indentStr(int levels);
|
const char* indentStr(int num);
|
||||||
void putcNoTracking(char chr);
|
void putcNoTracking(char chr);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -160,7 +160,7 @@ public:
|
||||||
void blockInc() { m_parenVec.push(m_indentLevel + m_blockIndent); }
|
void blockInc() { m_parenVec.push(m_indentLevel + m_blockIndent); }
|
||||||
void blockDec() { if (!m_parenVec.empty()) m_parenVec.pop(); }
|
void blockDec() { if (!m_parenVec.empty()) m_parenVec.pop(); }
|
||||||
// STATIC METHODS
|
// STATIC METHODS
|
||||||
static const string indentSpaces(int levels);
|
static const string indentSpaces(int num);
|
||||||
|
|
||||||
// CALLBACKS - MUST OVERRIDE
|
// CALLBACKS - MUST OVERRIDE
|
||||||
virtual void putcOutput(char chr) = 0;
|
virtual void putcOutput(char chr) = 0;
|
||||||
|
|
|
||||||
|
|
@ -36,15 +36,15 @@
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// FileLineSingleton class functions
|
// FileLineSingleton class functions
|
||||||
|
|
||||||
const string FileLineSingleton::filenameLetters(int no) {
|
const string FileLineSingleton::filenameLetters(int fileno) {
|
||||||
const int size = 1 + (64 / 4); // Each letter retires more than 4 bits of a > 64 bit number
|
const int size = 1 + (64 / 4); // Each letter retires more than 4 bits of a > 64 bit number
|
||||||
char out[size];
|
char out[size];
|
||||||
char* op = out+size-1;
|
char* op = out+size-1;
|
||||||
*--op = '\0'; // We build backwards
|
*--op = '\0'; // We build backwards
|
||||||
int num = no;
|
int num = fileno;
|
||||||
do {
|
do {
|
||||||
*--op = 'a'+num%26;
|
*--op = 'a'+num%26;
|
||||||
num /= 26;
|
num /= 26;
|
||||||
} while (num);
|
} while (num);
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|
@ -90,8 +90,8 @@ FileLine::FileLine(FileLine::EmptySecret) {
|
||||||
|
|
||||||
m_warnOn=0;
|
m_warnOn=0;
|
||||||
for (int codei=V3ErrorCode::EC_MIN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
|
for (int codei=V3ErrorCode::EC_MIN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
|
||||||
V3ErrorCode code = (V3ErrorCode)codei;
|
V3ErrorCode code = V3ErrorCode(codei);
|
||||||
warnOff(code, code.defaultsOff());
|
warnOff(code, code.defaultsOff());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -205,15 +205,15 @@ bool FileLine::warnOff(const string& msg, bool flag) {
|
||||||
|
|
||||||
void FileLine::warnLintOff(bool flag) {
|
void FileLine::warnLintOff(bool flag) {
|
||||||
for (int codei=V3ErrorCode::EC_MIN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
|
for (int codei=V3ErrorCode::EC_MIN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
|
||||||
V3ErrorCode code = (V3ErrorCode)codei;
|
V3ErrorCode code = V3ErrorCode(codei);
|
||||||
if (code.lintError()) warnOff(code, flag);
|
if (code.lintError()) warnOff(code, flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileLine::warnStyleOff(bool flag) {
|
void FileLine::warnStyleOff(bool flag) {
|
||||||
for (int codei=V3ErrorCode::EC_MIN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
|
for (int codei=V3ErrorCode::EC_MIN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
|
||||||
V3ErrorCode code = (V3ErrorCode)codei;
|
V3ErrorCode code = V3ErrorCode(codei);
|
||||||
if (code.styleError()) warnOff(code, flag);
|
if (code.styleError()) warnOff(code, flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -229,10 +229,8 @@ bool FileLine::warnIsOff(V3ErrorCode code) const {
|
||||||
void FileLine::modifyStateInherit(const FileLine* fromp) {
|
void FileLine::modifyStateInherit(const FileLine* fromp) {
|
||||||
// Any warnings that are off in "from", become off in "this".
|
// Any warnings that are off in "from", become off in "this".
|
||||||
for (int codei=V3ErrorCode::EC_MIN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
|
for (int codei=V3ErrorCode::EC_MIN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
|
||||||
V3ErrorCode code = (V3ErrorCode)codei;
|
V3ErrorCode code = V3ErrorCode(codei);
|
||||||
if (fromp->warnIsOff(code)) {
|
if (fromp->warnIsOff(code)) { warnOff(code, true); }
|
||||||
warnOff(code, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,10 +123,10 @@ public:
|
||||||
const string filebasenameNoExt() const;
|
const string filebasenameNoExt() const;
|
||||||
const string profileFuncname() const;
|
const string profileFuncname() const;
|
||||||
const string xml() const { return "fl=\""+filenameLetters()+cvtToStr(lineno())+"\""; }
|
const string xml() const { return "fl=\""+filenameLetters()+cvtToStr(lineno())+"\""; }
|
||||||
string lineDirectiveStrg(int enter_exit_level) const;
|
string lineDirectiveStrg(int enterExit) const;
|
||||||
void warnOn(V3ErrorCode code, bool flag) { m_warnOn.set(code,flag); } // Turn on/off warning messages on this line.
|
void warnOn(V3ErrorCode code, bool flag) { m_warnOn.set(code,flag); } // Turn on/off warning messages on this line.
|
||||||
void warnOff(V3ErrorCode code, bool flag) { warnOn(code,!flag); }
|
void warnOff(V3ErrorCode code, bool flag) { warnOn(code,!flag); }
|
||||||
bool warnOff(const string& code, bool flag); // Returns 1 if ok
|
bool warnOff(const string& msg, bool flag); // Returns 1 if ok
|
||||||
bool warnIsOff(V3ErrorCode code) const;
|
bool warnIsOff(V3ErrorCode code) const;
|
||||||
void warnLintOff(bool flag);
|
void warnLintOff(bool flag);
|
||||||
void warnStyleOff(bool flag);
|
void warnStyleOff(bool flag);
|
||||||
|
|
|
||||||
|
|
@ -230,9 +230,11 @@ private:
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeAssign* nodep) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
m_substTreep = nodep->rhsp();
|
m_substTreep = nodep->rhsp();
|
||||||
if (!VN_IS(nodep->lhsp(), NodeVarRef))
|
if (!VN_IS(nodep->lhsp(), NodeVarRef)) {
|
||||||
clearSimple("ASSIGN(non-VARREF)");
|
clearSimple("ASSIGN(non-VARREF)");
|
||||||
else iterateChildren(nodep);
|
} else {
|
||||||
|
iterateChildren(nodep);
|
||||||
|
}
|
||||||
// We don't push logic other then assignments/NOTs into SenItems
|
// We don't push logic other then assignments/NOTs into SenItems
|
||||||
// This avoids a mess in computing what exactly a POSEDGE is
|
// This avoids a mess in computing what exactly a POSEDGE is
|
||||||
// V3Const cleans up any NOTs by flipping the edges for us
|
// V3Const cleans up any NOTs by flipping the edges for us
|
||||||
|
|
@ -345,7 +347,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
GateVarVertex* makeVarVertex(AstVarScope* varscp) {
|
GateVarVertex* makeVarVertex(AstVarScope* varscp) {
|
||||||
GateVarVertex* vertexp = (GateVarVertex*)(varscp->user1p());
|
GateVarVertex* vertexp = reinterpret_cast<GateVarVertex*>(varscp->user1p());
|
||||||
if (!vertexp) {
|
if (!vertexp) {
|
||||||
UINFO(6,"New vertex "<<varscp<<endl);
|
UINFO(6,"New vertex "<<varscp<<endl);
|
||||||
vertexp = new GateVarVertex(&m_graph, m_scopep, varscp);
|
vertexp = new GateVarVertex(&m_graph, m_scopep, varscp);
|
||||||
|
|
@ -368,7 +370,7 @@ private:
|
||||||
|
|
||||||
void optimizeSignals(bool allowMultiIn);
|
void optimizeSignals(bool allowMultiIn);
|
||||||
bool elimLogicOkOutputs(GateLogicVertex* consumeVertexp, const GateOkVisitor& okVisitor);
|
bool elimLogicOkOutputs(GateLogicVertex* consumeVertexp, const GateOkVisitor& okVisitor);
|
||||||
void optimizeElimVar(AstVarScope* varscp, AstNode* logicp, AstNode* consumerp);
|
void optimizeElimVar(AstVarScope* varscp, AstNode* substp, AstNode* consumerp);
|
||||||
void warnSignals();
|
void warnSignals();
|
||||||
void consumedMark();
|
void consumedMark();
|
||||||
void consumedMarkRecurse(GateEitherVertex* vertexp);
|
void consumedMarkRecurse(GateEitherVertex* vertexp);
|
||||||
|
|
@ -738,7 +740,7 @@ void GateVisitor::consumedMark() {
|
||||||
// Propagate consumed signals backwards to all producers into a consumed node
|
// Propagate consumed signals backwards to all producers into a consumed node
|
||||||
m_graph.userClearVertices();
|
m_graph.userClearVertices();
|
||||||
for (V3GraphVertex* vertexp = m_graph.verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
for (V3GraphVertex* vertexp = m_graph.verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) {
|
||||||
GateEitherVertex* evertexp = (GateEitherVertex*)vertexp;
|
GateEitherVertex* evertexp = static_cast<GateEitherVertex*>(vertexp);
|
||||||
if (!evertexp->user() && evertexp->consumed()) {
|
if (!evertexp->user() && evertexp->consumed()) {
|
||||||
consumedMarkRecurse(evertexp);
|
consumedMarkRecurse(evertexp);
|
||||||
}
|
}
|
||||||
|
|
@ -751,7 +753,7 @@ void GateVisitor::consumedMarkRecurse(GateEitherVertex* vertexp) {
|
||||||
if (!vertexp->consumed()) vertexp->setConsumed("propagated");
|
if (!vertexp->consumed()) vertexp->setConsumed("propagated");
|
||||||
// Walk sources and mark them too
|
// Walk sources and mark them too
|
||||||
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
|
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
|
||||||
GateEitherVertex* eFromVertexp = (GateEitherVertex*)edgep->fromp();
|
GateEitherVertex* eFromVertexp = static_cast<GateEitherVertex*>(edgep->fromp());
|
||||||
consumedMarkRecurse(eFromVertexp);
|
consumedMarkRecurse(eFromVertexp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1016,7 +1018,7 @@ public:
|
||||||
if (AstNodeVarRef* lhsVarRefp = VN_CAST(lhsp, NodeVarRef)) {
|
if (AstNodeVarRef* lhsVarRefp = VN_CAST(lhsp, NodeVarRef)) {
|
||||||
if (lhsVarRefp->varScopep() != consumerVarScopep) consumerVarScopep->v3fatalSrc("Consumer doesn't match lhs of assign");
|
if (lhsVarRefp->varScopep() != consumerVarScopep) consumerVarScopep->v3fatalSrc("Consumer doesn't match lhs of assign");
|
||||||
if (AstNodeAssign* dup = m_hash.hashAndFindDupe(m_assignp,activep,m_ifCondp)) {
|
if (AstNodeAssign* dup = m_hash.hashAndFindDupe(m_assignp,activep,m_ifCondp)) {
|
||||||
return (AstNodeVarRef*) dup->lhsp();
|
return static_cast<AstNodeVarRef*>(dup->lhsp());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1044,16 +1046,17 @@ private:
|
||||||
|
|
||||||
m_depth++;
|
m_depth++;
|
||||||
if (vvertexp->inSize1()) {
|
if (vvertexp->inSize1()) {
|
||||||
AstNodeVarRef* dupVarRefp = (AstNodeVarRef*) vvertexp->iterateInEdges(*this, VNUser(vvertexp)).toNodep();
|
AstNodeVarRef* dupVarRefp = static_cast<AstNodeVarRef*>
|
||||||
|
(vvertexp->iterateInEdges(*this, VNUser(vvertexp)).toNodep());
|
||||||
if (dupVarRefp) {
|
if (dupVarRefp) {
|
||||||
V3GraphEdge* edgep = vvertexp->inBeginp();
|
V3GraphEdge* edgep = vvertexp->inBeginp();
|
||||||
GateLogicVertex* lvertexp = (GateLogicVertex*)edgep->fromp();
|
GateLogicVertex* lvertexp = static_cast<GateLogicVertex*>(edgep->fromp());
|
||||||
if (!vvertexp->dedupable()) vvertexp->varScp()->v3fatalSrc("GateLogicVertex* visit should have returned NULL if consumer var vertex is not dedupable.");
|
if (!vvertexp->dedupable()) vvertexp->varScp()->v3fatalSrc("GateLogicVertex* visit should have returned NULL if consumer var vertex is not dedupable.");
|
||||||
GateOkVisitor okVisitor(lvertexp->nodep(), false, true);
|
GateOkVisitor okVisitor(lvertexp->nodep(), false, true);
|
||||||
if (okVisitor.isSimple()) {
|
if (okVisitor.isSimple()) {
|
||||||
AstVarScope* dupVarScopep = dupVarRefp->varScopep();
|
AstVarScope* dupVarScopep = dupVarRefp->varScopep();
|
||||||
GateVarVertex* dupVvertexp = (GateVarVertex*) (dupVarScopep->user1p());
|
GateVarVertex* dupVvertexp
|
||||||
|
= reinterpret_cast<GateVarVertex*>(dupVarScopep->user1p());
|
||||||
UINFO(4,"replacing " << vvertexp << " with " << dupVvertexp << endl);
|
UINFO(4,"replacing " << vvertexp << " with " << dupVvertexp << endl);
|
||||||
++m_numDeduped;
|
++m_numDeduped;
|
||||||
// Replace all of this varvertex's consumers with dupVarRefp
|
// Replace all of this varvertex's consumers with dupVarRefp
|
||||||
|
|
@ -1089,7 +1092,7 @@ private:
|
||||||
virtual VNUser visit(GateLogicVertex* lvertexp, VNUser vu) {
|
virtual VNUser visit(GateLogicVertex* lvertexp, VNUser vu) {
|
||||||
lvertexp->iterateInEdges(*this);
|
lvertexp->iterateInEdges(*this);
|
||||||
|
|
||||||
GateVarVertex* consumerVvertexpp = (GateVarVertex*) vu.toGraphVertex();
|
GateVarVertex* consumerVvertexpp = static_cast<GateVarVertex*>(vu.toGraphVertex());
|
||||||
if (lvertexp->dedupable() && consumerVvertexpp->dedupable()) {
|
if (lvertexp->dedupable() && consumerVvertexpp->dedupable()) {
|
||||||
AstNode* nodep = lvertexp->nodep();
|
AstNode* nodep = lvertexp->nodep();
|
||||||
AstVarScope* consumerVarScopep = consumerVvertexpp->varScp();
|
AstVarScope* consumerVarScopep = consumerVvertexpp->varScp();
|
||||||
|
|
@ -1161,9 +1164,10 @@ private:
|
||||||
const AstConst* cstart = VN_CAST(cur->lsbp(), Const);
|
const AstConst* cstart = VN_CAST(cur->lsbp(), Const);
|
||||||
const AstConst* cwidth = VN_CAST(cur->widthp(), Const);
|
const AstConst* cwidth = VN_CAST(cur->widthp(), Const);
|
||||||
if (!pstart || !pwidth || !cstart || !cwidth) return NULL; // too complicated
|
if (!pstart || !pwidth || !cstart || !cwidth) return NULL; // too complicated
|
||||||
if (cur->lsbConst()+cur->widthConst() == pre->lsbConst())
|
if (cur->lsbConst()+cur->widthConst() == pre->lsbConst()) {
|
||||||
return new AstSel(curVarRefp->fileline(), curVarRefp->cloneTree(false), cur->lsbConst(), pre->widthConst()+cur->widthConst());
|
return new AstSel(curVarRefp->fileline(), curVarRefp->cloneTree(false),
|
||||||
else return NULL;
|
cur->lsbConst(), pre->widthConst()+cur->widthConst());
|
||||||
|
} else return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual VNUser visit(GateVarVertex *vvertexp, VNUser) {
|
virtual VNUser visit(GateVarVertex *vvertexp, VNUser) {
|
||||||
|
|
@ -1353,7 +1357,7 @@ private:
|
||||||
m_seen_clk_vectors++;
|
m_seen_clk_vectors++;
|
||||||
m_total_seen_clk_vectors++;
|
m_total_seen_clk_vectors++;
|
||||||
}
|
}
|
||||||
GateClkDecompState* currState = (GateClkDecompState*) vu.c();
|
GateClkDecompState* currState = reinterpret_cast<GateClkDecompState*>(vu.c());
|
||||||
GateClkDecompState nextState(currState->m_offset, vsp);
|
GateClkDecompState nextState(currState->m_offset, vsp);
|
||||||
vvertexp->iterateCurrentOutEdges(*this, VNUser(&nextState));
|
vvertexp->iterateCurrentOutEdges(*this, VNUser(&nextState));
|
||||||
if (vsp->varp()->width() > 1) {
|
if (vsp->varp()->width() > 1) {
|
||||||
|
|
@ -1364,7 +1368,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual VNUser visit(GateLogicVertex* lvertexp, VNUser vu) {
|
virtual VNUser visit(GateLogicVertex* lvertexp, VNUser vu) {
|
||||||
GateClkDecompState* currState = (GateClkDecompState*) vu.c();
|
GateClkDecompState* currState = reinterpret_cast<GateClkDecompState*>(vu.c());
|
||||||
int clk_offset = currState->m_offset;
|
int clk_offset = currState->m_offset;
|
||||||
if (const AstAssignW* assignp = VN_CAST(lvertexp->nodep(), AssignW)) {
|
if (const AstAssignW* assignp = VN_CAST(lvertexp->nodep(), AssignW)) {
|
||||||
UINFO(9,"CLK DECOMP Logic (off = "<<clk_offset<<") - "<<lvertexp<<" : "<<m_clk_vsp<<endl);
|
UINFO(9,"CLK DECOMP Logic (off = "<<clk_offset<<") - "<<lvertexp<<" : "<<m_clk_vsp<<endl);
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class GraphAcycEdge : public V3GraphEdge {
|
||||||
private:
|
private:
|
||||||
typedef std::list<V3GraphEdge*> OrigEdgeList; // List of orig edges, see also GraphAcyc's decl
|
typedef std::list<V3GraphEdge*> OrigEdgeList; // List of orig edges, see also GraphAcyc's decl
|
||||||
V3GraphEdge* origEdgep() const {
|
V3GraphEdge* origEdgep() const {
|
||||||
OrigEdgeList* oEListp = ((OrigEdgeList*)userp());
|
OrigEdgeList* oEListp = static_cast<OrigEdgeList*>(userp());
|
||||||
if (!oEListp) v3fatalSrc("No original edge associated with acyc edge "<<this<<endl);
|
if (!oEListp) v3fatalSrc("No original edge associated with acyc edge "<<this<<endl);
|
||||||
return (oEListp->front());
|
return (oEListp->front());
|
||||||
}
|
}
|
||||||
|
|
@ -114,12 +114,12 @@ private:
|
||||||
void buildGraph(V3Graph* origGraphp);
|
void buildGraph(V3Graph* origGraphp);
|
||||||
void buildGraphIterate(V3GraphVertex* overtexp, GraphAcycVertex* avertexp);
|
void buildGraphIterate(V3GraphVertex* overtexp, GraphAcycVertex* avertexp);
|
||||||
void simplify(bool allowCut);
|
void simplify(bool allowCut);
|
||||||
void simplifyNone(GraphAcycVertex* vertexp);
|
void simplifyNone(GraphAcycVertex* avertexp);
|
||||||
void simplifyOne(GraphAcycVertex* vertexp);
|
void simplifyOne(GraphAcycVertex* avertexp);
|
||||||
void simplifyOut(GraphAcycVertex* vertexp);
|
void simplifyOut(GraphAcycVertex* avertexp);
|
||||||
void simplifyDup(GraphAcycVertex* vertexp);
|
void simplifyDup(GraphAcycVertex* avertexp);
|
||||||
void cutBasic(GraphAcycVertex* vertexp);
|
void cutBasic(GraphAcycVertex* avertexp);
|
||||||
void cutBackward(GraphAcycVertex* vertexp);
|
void cutBackward(GraphAcycVertex* avertexp);
|
||||||
void deleteMarked();
|
void deleteMarked();
|
||||||
void place();
|
void place();
|
||||||
void placeTryEdge(V3GraphEdge* edgep);
|
void placeTryEdge(V3GraphEdge* edgep);
|
||||||
|
|
@ -144,8 +144,8 @@ private:
|
||||||
m_origEdgeDelp.push_back(oep);
|
m_origEdgeDelp.push_back(oep);
|
||||||
toEdgep->userp(oep);
|
toEdgep->userp(oep);
|
||||||
}
|
}
|
||||||
OrigEdgeList* oEListp = (OrigEdgeList*)(toEdgep->userp());
|
OrigEdgeList* oEListp = static_cast<OrigEdgeList*>(toEdgep->userp());
|
||||||
if (OrigEdgeList* addListp = (OrigEdgeList*)(addEdgep->userp())) {
|
if (OrigEdgeList* addListp = static_cast<OrigEdgeList*>(addEdgep->userp())) {
|
||||||
for (OrigEdgeList::iterator it = addListp->begin(); it != addListp->end(); ++it) {
|
for (OrigEdgeList::iterator it = addListp->begin(); it != addListp->end(); ++it) {
|
||||||
oEListp->push_back(*it);
|
oEListp->push_back(*it);
|
||||||
}
|
}
|
||||||
|
|
@ -158,7 +158,7 @@ private:
|
||||||
// From the break edge, cut edges in original graph it represents
|
// From the break edge, cut edges in original graph it represents
|
||||||
UINFO(8,why<<" CUT "<<breakEdgep->fromp()<<endl);
|
UINFO(8,why<<" CUT "<<breakEdgep->fromp()<<endl);
|
||||||
breakEdgep->cut();
|
breakEdgep->cut();
|
||||||
OrigEdgeList* oEListp = (OrigEdgeList*)(breakEdgep->userp());
|
OrigEdgeList* oEListp = static_cast<OrigEdgeList*>(breakEdgep->userp());
|
||||||
if (!oEListp) v3fatalSrc("No original edge associated with cutting edge "<<breakEdgep<<endl);
|
if (!oEListp) v3fatalSrc("No original edge associated with cutting edge "<<breakEdgep<<endl);
|
||||||
// The breakGraph edge may represent multiple real edges; cut them all
|
// The breakGraph edge may represent multiple real edges; cut them all
|
||||||
for (OrigEdgeList::iterator it = oEListp->begin(); it != oEListp->end(); ++it) {
|
for (OrigEdgeList::iterator it = oEListp->begin(); it != oEListp->end(); ++it) {
|
||||||
|
|
@ -169,7 +169,7 @@ private:
|
||||||
}
|
}
|
||||||
// Work Que
|
// Work Que
|
||||||
void workPush(V3GraphVertex* vertexp) {
|
void workPush(V3GraphVertex* vertexp) {
|
||||||
GraphAcycVertex* avertexp = (GraphAcycVertex*)vertexp;
|
GraphAcycVertex* avertexp = static_cast<GraphAcycVertex*>(vertexp);
|
||||||
// Add vertex to list of nodes needing further optimization trials
|
// Add vertex to list of nodes needing further optimization trials
|
||||||
if (!avertexp->m_onWorkList) {
|
if (!avertexp->m_onWorkList) {
|
||||||
avertexp->m_onWorkList = true;
|
avertexp->m_onWorkList = true;
|
||||||
|
|
@ -216,7 +216,7 @@ void GraphAcyc::buildGraph(V3Graph* origGraphp) {
|
||||||
// Build edges between logic vertices
|
// Build edges between logic vertices
|
||||||
for (V3GraphVertex* overtexp = origGraphp->verticesBeginp(); overtexp; overtexp=overtexp->verticesNextp()) {
|
for (V3GraphVertex* overtexp = origGraphp->verticesBeginp(); overtexp; overtexp=overtexp->verticesNextp()) {
|
||||||
if (overtexp->color()) {
|
if (overtexp->color()) {
|
||||||
GraphAcycVertex* avertexp = (GraphAcycVertex*)(overtexp->userp());
|
GraphAcycVertex* avertexp = static_cast<GraphAcycVertex*>(overtexp->userp());
|
||||||
buildGraphIterate(overtexp, avertexp);
|
buildGraphIterate(overtexp, avertexp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -228,7 +228,7 @@ void GraphAcyc::buildGraphIterate(V3GraphVertex* overtexp, GraphAcycVertex* aver
|
||||||
if (origFollowEdge(edgep)) { // not cut
|
if (origFollowEdge(edgep)) { // not cut
|
||||||
V3GraphVertex* toVertexp = edgep->top();
|
V3GraphVertex* toVertexp = edgep->top();
|
||||||
if (toVertexp->color()) {
|
if (toVertexp->color()) {
|
||||||
GraphAcycVertex* toAVertexp = (GraphAcycVertex*)(toVertexp->userp());
|
GraphAcycVertex* toAVertexp = static_cast<GraphAcycVertex*>(toVertexp->userp());
|
||||||
// Replicate the old edge into the new graph
|
// Replicate the old edge into the new graph
|
||||||
// There may be multiple edges between same pairs of vertices
|
// There may be multiple edges between same pairs of vertices
|
||||||
V3GraphEdge* breakEdgep = new GraphAcycEdge
|
V3GraphEdge* breakEdgep = new GraphAcycEdge
|
||||||
|
|
@ -267,7 +267,7 @@ void GraphAcyc::deleteMarked() {
|
||||||
// Delete nodes marked for removal
|
// Delete nodes marked for removal
|
||||||
for (V3GraphVertex* nextp, *vertexp = m_breakGraph.verticesBeginp(); vertexp; vertexp=nextp) {
|
for (V3GraphVertex* nextp, *vertexp = m_breakGraph.verticesBeginp(); vertexp; vertexp=nextp) {
|
||||||
nextp = vertexp->verticesNextp();
|
nextp = vertexp->verticesNextp();
|
||||||
GraphAcycVertex* avertexp = (GraphAcycVertex*)vertexp;
|
GraphAcycVertex* avertexp = static_cast<GraphAcycVertex*>(vertexp);
|
||||||
if (avertexp->isDelete()) {
|
if (avertexp->isDelete()) {
|
||||||
avertexp->unlinkDelete(&m_breakGraph); VL_DANGLING(avertexp);
|
avertexp->unlinkDelete(&m_breakGraph); VL_DANGLING(avertexp);
|
||||||
}
|
}
|
||||||
|
|
@ -377,7 +377,7 @@ void GraphAcyc::simplifyDup(GraphAcycVertex* avertexp) {
|
||||||
for (V3GraphEdge* nextp, *edgep = avertexp->outBeginp(); edgep; edgep=nextp) {
|
for (V3GraphEdge* nextp, *edgep = avertexp->outBeginp(); edgep; edgep=nextp) {
|
||||||
nextp = edgep->outNextp();
|
nextp = edgep->outNextp();
|
||||||
V3GraphVertex* outVertexp = edgep->top();
|
V3GraphVertex* outVertexp = edgep->top();
|
||||||
V3GraphEdge* prevEdgep = (V3GraphEdge*)outVertexp->userp();
|
V3GraphEdge* prevEdgep = static_cast<V3GraphEdge*>(outVertexp->userp());
|
||||||
if (prevEdgep) {
|
if (prevEdgep) {
|
||||||
if (!prevEdgep->cutable()) {
|
if (!prevEdgep->cutable()) {
|
||||||
// !cutable duplicates prev !cutable: we can ignore it, redundant
|
// !cutable duplicates prev !cutable: we can ignore it, redundant
|
||||||
|
|
@ -484,7 +484,8 @@ void GraphAcyc::placeTryEdge(V3GraphEdge* edgep) {
|
||||||
// Vertex::m_user begin: number indicates this edge was completed
|
// Vertex::m_user begin: number indicates this edge was completed
|
||||||
// Try to assign ranks, presuming this edge is in place
|
// Try to assign ranks, presuming this edge is in place
|
||||||
// If we come across user()==placestep, we've detected a loop and must back out
|
// If we come across user()==placestep, we've detected a loop and must back out
|
||||||
bool loop=placeIterate((GraphAcycVertex*)edgep->top(), edgep->fromp()->rank()+1);
|
bool loop = placeIterate(static_cast<GraphAcycVertex*>(edgep->top()),
|
||||||
|
edgep->fromp()->rank()+1);
|
||||||
if (!loop) {
|
if (!loop) {
|
||||||
// No loop, we can keep it as uncutable
|
// No loop, we can keep it as uncutable
|
||||||
// Commit the new ranks we calculated
|
// Commit the new ranks we calculated
|
||||||
|
|
@ -523,7 +524,7 @@ bool GraphAcyc::placeIterate(GraphAcycVertex* vertexp, uint32_t currentRank) {
|
||||||
// Follow all edges and increase their ranks
|
// Follow all edges and increase their ranks
|
||||||
for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep=edgep->outNextp()) {
|
for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep=edgep->outNextp()) {
|
||||||
if (edgep->weight() && !edgep->cutable()) {
|
if (edgep->weight() && !edgep->cutable()) {
|
||||||
if (placeIterate((GraphAcycVertex*)edgep->top(), currentRank+1)) {
|
if (placeIterate(static_cast<GraphAcycVertex*>(edgep->top()), currentRank+1)) {
|
||||||
// We don't need to reset user(); we'll use a different placeStep for the next edge
|
// We don't need to reset user(); we'll use a different placeStep for the next edge
|
||||||
return true; // Loop detected
|
return true; // Loop detected
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ private:
|
||||||
nextp = edgep->outNextp();
|
nextp = edgep->outNextp();
|
||||||
if (followEdge(edgep)) {
|
if (followEdge(edgep)) {
|
||||||
V3GraphVertex* outVertexp = edgep->top();
|
V3GraphVertex* outVertexp = edgep->top();
|
||||||
V3GraphEdge* prevEdgep = (V3GraphEdge*)outVertexp->userp();
|
V3GraphEdge* prevEdgep = static_cast<V3GraphEdge*>(outVertexp->userp());
|
||||||
if (!prevEdgep) { // No previous assignment
|
if (!prevEdgep) { // No previous assignment
|
||||||
outVertexp->userp(edgep);
|
outVertexp->userp(edgep);
|
||||||
} else { // Duplicate
|
} else { // Duplicate
|
||||||
|
|
@ -427,7 +427,7 @@ private:
|
||||||
|
|
||||||
//! Iterate through all connected nodes of a graph with a loop or loops.
|
//! Iterate through all connected nodes of a graph with a loop or loops.
|
||||||
V3GraphVertex* vertexIterateAll(V3GraphVertex* vertexp) {
|
V3GraphVertex* vertexIterateAll(V3GraphVertex* vertexp) {
|
||||||
if (V3GraphVertex* newVertexp = (V3GraphVertex*)vertexp->userp()) {
|
if (V3GraphVertex* newVertexp = static_cast<V3GraphVertex*>(vertexp->userp())) {
|
||||||
return newVertexp;
|
return newVertexp;
|
||||||
} else {
|
} else {
|
||||||
newVertexp = vertexp->clone(m_loopGraphp);
|
newVertexp = vertexp->clone(m_loopGraphp);
|
||||||
|
|
@ -436,7 +436,7 @@ private:
|
||||||
for (V3GraphEdge* edgep = vertexp->outBeginp();
|
for (V3GraphEdge* edgep = vertexp->outBeginp();
|
||||||
edgep; edgep=edgep->outNextp()) {
|
edgep; edgep=edgep->outNextp()) {
|
||||||
if (followEdge(edgep)) {
|
if (followEdge(edgep)) {
|
||||||
V3GraphEdge* newEdgep = (V3GraphEdge*)edgep->userp();
|
V3GraphEdge* newEdgep = static_cast<V3GraphEdge*>(edgep->userp());
|
||||||
if (!newEdgep) {
|
if (!newEdgep) {
|
||||||
V3GraphVertex* newTop = vertexIterateAll(edgep->top());
|
V3GraphVertex* newTop = vertexIterateAll(edgep->top());
|
||||||
newEdgep = edgep->clone(m_loopGraphp, newVertexp,
|
newEdgep = edgep->clone(m_loopGraphp, newVertexp,
|
||||||
|
|
|
||||||
|
|
@ -159,9 +159,7 @@ private:
|
||||||
}
|
}
|
||||||
// If we saw all of the nodes, then they have the same number of hits
|
// If we saw all of the nodes, then they have the same number of hits
|
||||||
// (Else something in dfa1p that wasn't in dfa2p)
|
// (Else something in dfa1p that wasn't in dfa2p)
|
||||||
if (num1s != num2s) return false;
|
return (num1s == num2s);
|
||||||
// Match
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void insertDfaOrigins(DfaVertex* dfaStatep) {
|
void insertDfaOrigins(DfaVertex* dfaStatep) {
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class GraphPathChecker : GraphAlg<const V3Graph> {
|
||||||
bool pathExistsInternal(const V3GraphVertex* ap,
|
bool pathExistsInternal(const V3GraphVertex* ap,
|
||||||
const V3GraphVertex* bp,
|
const V3GraphVertex* bp,
|
||||||
unsigned* costp = NULL);
|
unsigned* costp = NULL);
|
||||||
void initHalfCriticalPaths(GraphWay w, bool checkOnly);
|
void initHalfCriticalPaths(GraphWay way, bool checkOnly);
|
||||||
void incGeneration() { ++m_generation; }
|
void incGeneration() { ++m_generation; }
|
||||||
|
|
||||||
VL_DEBUG_FUNC; // Declare debug()
|
VL_DEBUG_FUNC; // Declare debug()
|
||||||
|
|
|
||||||
|
|
@ -334,7 +334,7 @@ public:
|
||||||
virtual string name() { return "import"; }
|
virtual string name() { return "import"; }
|
||||||
virtual void runTest() {
|
virtual void runTest() {
|
||||||
DfaGraph* gp = &m_graph;
|
DfaGraph* gp = &m_graph;
|
||||||
if (V3GraphTest::debug()) gp->debug(9);
|
if (V3GraphTest::debug()) DfaGraph::debug(9);
|
||||||
dotImport();
|
dotImport();
|
||||||
dump();
|
dump();
|
||||||
gp->acyclic(&V3GraphEdge::followAlwaysTrue);
|
gp->acyclic(&V3GraphEdge::followAlwaysTrue);
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ class V3Inst {
|
||||||
public:
|
public:
|
||||||
static void instAll(AstNetlist* nodep);
|
static void instAll(AstNetlist* nodep);
|
||||||
static void dearrayAll(AstNetlist* nodep);
|
static void dearrayAll(AstNetlist* nodep);
|
||||||
static AstAssignW* pinReconnectSimple(AstPin* nodep, AstCell* cellp,
|
static AstAssignW* pinReconnectSimple(AstPin* pinp, AstCell* cellp,
|
||||||
bool forTristate, bool alwaysCvt=false);
|
bool forTristate, bool alwaysCvt=false);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // Guard
|
#endif // Guard
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ private:
|
||||||
virtual void visit(AstVarRef* nodep) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
AstVarScope* vscp = nodep->varScopep();
|
AstVarScope* vscp = nodep->varScopep();
|
||||||
if (!vscp) nodep->v3fatalSrc("Scope not assigned");
|
if (!vscp) nodep->v3fatalSrc("Scope not assigned");
|
||||||
if (AstVarScope* newvscp = (AstVarScope*)vscp->user4p()) {
|
if (AstVarScope* newvscp = reinterpret_cast<AstVarScope*>(vscp->user4p())) {
|
||||||
UINFO(9, " Replace "<<nodep<<" to "<<newvscp<<endl);
|
UINFO(9, " Replace "<<nodep<<" to "<<newvscp<<endl);
|
||||||
AstVarRef* newrefp = new AstVarRef(nodep->fileline(), newvscp, nodep->lvalue());
|
AstVarRef* newrefp = new AstVarRef(nodep->fileline(), newvscp, nodep->lvalue());
|
||||||
nodep->replaceWith(newrefp);
|
nodep->replaceWith(newrefp);
|
||||||
|
|
@ -222,7 +222,7 @@ private:
|
||||||
const std::set<LifeLocation>& dlyVarAssigns = m_writes[dlyVarp];
|
const std::set<LifeLocation>& dlyVarAssigns = m_writes[dlyVarp];
|
||||||
// Proof (1)
|
// Proof (1)
|
||||||
const std::set<LifeLocation>& dlyVarReads = m_reads[dlyVarp];
|
const std::set<LifeLocation>& dlyVarReads = m_reads[dlyVarp];
|
||||||
if (dlyVarReads.size() > 0) {
|
if (!dlyVarReads.empty()) {
|
||||||
continue; // do not scrunch, go to next LifePostLocation
|
continue; // do not scrunch, go to next LifePostLocation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -459,14 +459,14 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// CONSTUCTORS
|
// CONSTUCTORS
|
||||||
LinkCellsVisitor(AstNetlist* rootp, V3InFilter* filterp, V3ParseSym* parseSymp)
|
LinkCellsVisitor(AstNetlist* nodep, V3InFilter* filterp, V3ParseSym* parseSymp)
|
||||||
: m_mods(rootp) {
|
: m_mods(nodep) {
|
||||||
m_filterp = filterp;
|
m_filterp = filterp;
|
||||||
m_parseSymp = parseSymp;
|
m_parseSymp = parseSymp;
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
m_libVertexp = NULL;
|
m_libVertexp = NULL;
|
||||||
m_topVertexp = NULL;
|
m_topVertexp = NULL;
|
||||||
iterate(rootp);
|
iterate(nodep);
|
||||||
}
|
}
|
||||||
virtual ~LinkCellsVisitor() {}
|
virtual ~LinkCellsVisitor() {}
|
||||||
};
|
};
|
||||||
|
|
@ -474,7 +474,7 @@ public:
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// Link class functions
|
// Link class functions
|
||||||
|
|
||||||
void V3LinkCells::link(AstNetlist* rootp, V3InFilter* filterp, V3ParseSym* parseSymp) {
|
void V3LinkCells::link(AstNetlist* nodep, V3InFilter* filterp, V3ParseSym* parseSymp) {
|
||||||
UINFO(4,__FUNCTION__<<": "<<endl);
|
UINFO(4,__FUNCTION__<<": "<<endl);
|
||||||
LinkCellsVisitor visitor (rootp, filterp, parseSymp);
|
LinkCellsVisitor visitor (nodep, filterp, parseSymp);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,27 +34,27 @@ enum VLinkDotStep { LDS_PRIMARY, LDS_PARAMED, LDS_ARRAYED, LDS_SCOPED };
|
||||||
class V3LinkDot {
|
class V3LinkDot {
|
||||||
private:
|
private:
|
||||||
static int debug();
|
static int debug();
|
||||||
static void linkDotGuts(AstNetlist* nodep, VLinkDotStep step);
|
static void linkDotGuts(AstNetlist* rootp, VLinkDotStep step);
|
||||||
public:
|
public:
|
||||||
static void linkDotPrimary(AstNetlist* nodep) {
|
static void linkDotPrimary(AstNetlist* nodep) {
|
||||||
UINFO(2,__FUNCTION__<<": "<<endl);
|
UINFO(2,__FUNCTION__<<": "<<endl);
|
||||||
linkDotGuts(nodep,LDS_PRIMARY);
|
linkDotGuts(nodep,LDS_PRIMARY);
|
||||||
V3Global::dumpCheckGlobalTree("linkdot", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
|
V3Global::dumpCheckGlobalTree("linkdot", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
|
||||||
}
|
}
|
||||||
static void linkDotParamed(AstNetlist* nodep) {
|
static void linkDotParamed(AstNetlist* nodep) {
|
||||||
UINFO(2,__FUNCTION__<<": "<<endl);
|
UINFO(2,__FUNCTION__<<": "<<endl);
|
||||||
linkDotGuts(nodep,LDS_PARAMED);
|
linkDotGuts(nodep,LDS_PARAMED);
|
||||||
V3Global::dumpCheckGlobalTree("paramlink", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
|
V3Global::dumpCheckGlobalTree("paramlink", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
|
||||||
}
|
}
|
||||||
static void linkDotArrayed(AstNetlist* nodep) {
|
static void linkDotArrayed(AstNetlist* nodep) {
|
||||||
UINFO(2,__FUNCTION__<<": "<<endl);
|
UINFO(2,__FUNCTION__<<": "<<endl);
|
||||||
linkDotGuts(nodep,LDS_ARRAYED);
|
linkDotGuts(nodep,LDS_ARRAYED);
|
||||||
V3Global::dumpCheckGlobalTree("linkdot", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
|
V3Global::dumpCheckGlobalTree("linkdot", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
|
||||||
}
|
}
|
||||||
static void linkDotScope(AstNetlist* nodep) {
|
static void linkDotScope(AstNetlist* nodep) {
|
||||||
UINFO(2,__FUNCTION__<<": "<<endl);
|
UINFO(2,__FUNCTION__<<": "<<endl);
|
||||||
linkDotGuts(nodep,LDS_SCOPED);
|
linkDotGuts(nodep,LDS_SCOPED);
|
||||||
V3Global::dumpCheckGlobalTree("linkdot", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
|
V3Global::dumpCheckGlobalTree("linkdot", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -271,10 +271,10 @@ public:
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// Link class functions
|
// Link class functions
|
||||||
|
|
||||||
void V3LinkLValue::linkLValue(AstNetlist* rootp) {
|
void V3LinkLValue::linkLValue(AstNetlist* nodep) {
|
||||||
UINFO(4,__FUNCTION__<<": "<<endl);
|
UINFO(4,__FUNCTION__<<": "<<endl);
|
||||||
{
|
{
|
||||||
LinkLValueVisitor visitor(rootp, false);
|
LinkLValueVisitor visitor(nodep, false);
|
||||||
} // Destruct before checking
|
} // Destruct before checking
|
||||||
V3Global::dumpCheckGlobalTree("linklvalue", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
|
V3Global::dumpCheckGlobalTree("linklvalue", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 6);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,30 +85,30 @@ void V3LinkLevel::modSortByLevel() {
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// Wrapping
|
// Wrapping
|
||||||
|
|
||||||
void V3LinkLevel::wrapTop(AstNetlist* netlistp) {
|
void V3LinkLevel::wrapTop(AstNetlist* rootp) {
|
||||||
UINFO(2,__FUNCTION__<<": "<<endl);
|
UINFO(2,__FUNCTION__<<": "<<endl);
|
||||||
// We do ONLY the top module
|
// We do ONLY the top module
|
||||||
AstNodeModule* oldmodp = netlistp->modulesp();
|
AstNodeModule* oldmodp = rootp->modulesp();
|
||||||
if (!oldmodp) netlistp->v3fatalSrc("No module found to process");
|
if (!oldmodp) rootp->v3fatalSrc("No module found to process");
|
||||||
AstNodeModule* newmodp = new AstModule(oldmodp->fileline(), string("TOP_")+oldmodp->name());
|
AstNodeModule* newmodp = new AstModule(oldmodp->fileline(), string("TOP_")+oldmodp->name());
|
||||||
// Make the new module first in the list
|
// Make the new module first in the list
|
||||||
oldmodp->unlinkFrBackWithNext();
|
oldmodp->unlinkFrBackWithNext();
|
||||||
newmodp->addNext(oldmodp);
|
newmodp->addNext(oldmodp);
|
||||||
newmodp->level(1);
|
newmodp->level(1);
|
||||||
newmodp->modPublic(true);
|
newmodp->modPublic(true);
|
||||||
netlistp->addModulep(newmodp);
|
rootp->addModulep(newmodp);
|
||||||
|
|
||||||
// TODO the module creation above could be done after linkcells, but
|
// TODO the module creation above could be done after linkcells, but
|
||||||
// the rest must be done after data type resolution
|
// the rest must be done after data type resolution
|
||||||
wrapTopCell(netlistp);
|
wrapTopCell(rootp);
|
||||||
wrapTopPackages(netlistp);
|
wrapTopPackages(rootp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3LinkLevel::wrapTopCell(AstNetlist* netlistp) {
|
void V3LinkLevel::wrapTopCell(AstNetlist* rootp) {
|
||||||
AstNodeModule* newmodp = netlistp->modulesp();
|
AstNodeModule* newmodp = rootp->modulesp();
|
||||||
if (!newmodp || !newmodp->isTop()) netlistp->v3fatalSrc("No TOP module found to process");
|
if (!newmodp || !newmodp->isTop()) rootp->v3fatalSrc("No TOP module found to process");
|
||||||
AstNodeModule* oldmodp = VN_CAST(newmodp->nextp(), NodeModule);
|
AstNodeModule* oldmodp = VN_CAST(newmodp->nextp(), NodeModule);
|
||||||
if (!oldmodp) netlistp->v3fatalSrc("No module found to process");
|
if (!oldmodp) rootp->v3fatalSrc("No module found to process");
|
||||||
|
|
||||||
// Add instance
|
// Add instance
|
||||||
AstCell* cellp = new AstCell(newmodp->fileline(),
|
AstCell* cellp = new AstCell(newmodp->fileline(),
|
||||||
|
|
@ -148,12 +148,12 @@ void V3LinkLevel::wrapTopCell(AstNetlist* netlistp) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3LinkLevel::wrapTopPackages(AstNetlist* netlistp) {
|
void V3LinkLevel::wrapTopPackages(AstNetlist* rootp) {
|
||||||
// Instantiate all packages under the top wrapper
|
// Instantiate all packages under the top wrapper
|
||||||
// This way all later SCOPE based optimizations can ignore packages
|
// This way all later SCOPE based optimizations can ignore packages
|
||||||
AstNodeModule* newmodp = netlistp->modulesp();
|
AstNodeModule* newmodp = rootp->modulesp();
|
||||||
if (!newmodp || !newmodp->isTop()) netlistp->v3fatalSrc("No TOP module found to process");
|
if (!newmodp || !newmodp->isTop()) rootp->v3fatalSrc("No TOP module found to process");
|
||||||
for (AstNodeModule* modp = netlistp->modulesp(); modp; modp=VN_CAST(modp->nextp(), NodeModule)) {
|
for (AstNodeModule* modp = rootp->modulesp(); modp; modp=VN_CAST(modp->nextp(), NodeModule)) {
|
||||||
if (VN_IS(modp, Package)) {
|
if (VN_IS(modp, Package)) {
|
||||||
AstCell* cellp = new AstCell(modp->fileline(),
|
AstCell* cellp = new AstCell(modp->fileline(),
|
||||||
// Could add __03a__03a="::" to prevent conflict
|
// Could add __03a__03a="::" to prevent conflict
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,11 @@
|
||||||
|
|
||||||
class V3LinkLevel {
|
class V3LinkLevel {
|
||||||
private:
|
private:
|
||||||
static void wrapTopCell(AstNetlist* nodep);
|
static void wrapTopCell(AstNetlist* rootp);
|
||||||
static void wrapTopPackages(AstNetlist* nodep);
|
static void wrapTopPackages(AstNetlist* rootp);
|
||||||
public:
|
public:
|
||||||
static void modSortByLevel();
|
static void modSortByLevel();
|
||||||
static void wrapTop(AstNetlist* nodep);
|
static void wrapTop(AstNetlist* rootp);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // Guard
|
#endif // Guard
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
class V3LinkParse {
|
class V3LinkParse {
|
||||||
public:
|
public:
|
||||||
static void linkParse(AstNetlist* nodep);
|
static void linkParse(AstNetlist* rootp);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // Guard
|
#endif // Guard
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
class V3LinkResolve {
|
class V3LinkResolve {
|
||||||
public:
|
public:
|
||||||
static void linkResolve(AstNetlist* nodep);
|
static void linkResolve(AstNetlist* rootp);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // Guard
|
#endif // Guard
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ protected:
|
||||||
};
|
};
|
||||||
// cppcheck-suppress unusedStructMember
|
// cppcheck-suppress unusedStructMember
|
||||||
uint32_t m_flags;
|
uint32_t m_flags;
|
||||||
VarFlags(AstNode* nodep) { m_flags = nodep->user2(); }
|
explicit VarFlags(AstNode* nodep) { m_flags = nodep->user2(); }
|
||||||
void setNodeFlags(AstNode* nodep) { nodep->user2(m_flags); }
|
void setNodeFlags(AstNode* nodep) { nodep->user2(m_flags); }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -215,7 +215,7 @@ private:
|
||||||
clearOptimizable(nodep->varp(),"BVmultiF");
|
clearOptimizable(nodep->varp(),"BVmultiF");
|
||||||
}
|
}
|
||||||
// First varref in function must be assignment found earlier
|
// First varref in function must be assignment found earlier
|
||||||
AstVarRef* firstasn = (AstVarRef*)(nodep->varp()->user4p());
|
AstVarRef* firstasn = static_cast<AstVarRef*>(nodep->varp()->user4p());
|
||||||
if (firstasn && nodep!=firstasn) {
|
if (firstasn && nodep!=firstasn) {
|
||||||
clearStdOptimizable(nodep->varp(),"notFirstAsn");
|
clearStdOptimizable(nodep->varp(),"notFirstAsn");
|
||||||
nodep->varp()->user4p(NULL);
|
nodep->varp()->user4p(NULL);
|
||||||
|
|
|
||||||
|
|
@ -490,7 +490,7 @@ string V3Number::displayed(FileLine*fl, const string& vformat) const {
|
||||||
while ((bit%3)!=2) bit++;
|
while ((bit%3)!=2) bit++;
|
||||||
for (; bit>0; bit -= 3) {
|
for (; bit>0; bit -= 3) {
|
||||||
int v = bitsValue(bit-2, 3);
|
int v = bitsValue(bit-2, 3);
|
||||||
str += (char)('0'+v);
|
str += static_cast<char>('0' + v);
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
@ -501,8 +501,8 @@ string V3Number::displayed(FileLine*fl, const string& vformat) const {
|
||||||
while ((bit%4)!=3) bit++;
|
while ((bit%4)!=3) bit++;
|
||||||
for (; bit>0; bit -= 4) {
|
for (; bit>0; bit -= 4) {
|
||||||
int v = bitsValue(bit-3, 4);
|
int v = bitsValue(bit-3, 4);
|
||||||
if (v>=10) str += (char)('a'+v-10);
|
if (v>=10) str += static_cast<char>('a' + v - 10);
|
||||||
else str += (char)('0'+v);
|
else str += static_cast<char>('0' + v);
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
@ -521,8 +521,8 @@ string V3Number::displayed(FileLine*fl, const string& vformat) const {
|
||||||
for (; bit>=0; bit -= 8) {
|
for (; bit>=0; bit -= 8) {
|
||||||
int v = bitsValue(bit-7, 8);
|
int v = bitsValue(bit-7, 8);
|
||||||
if (!start || v) {
|
if (!start || v) {
|
||||||
str += (char)((v==0)?' ':v);
|
str += static_cast<char>((v==0) ? ' ' : v);
|
||||||
start = false; // Drop leading 0s
|
start = false; // Drop leading 0s
|
||||||
} else {
|
} else {
|
||||||
if (fmtsize != "0") str += ' ';
|
if (fmtsize != "0") str += ' ';
|
||||||
}
|
}
|
||||||
|
|
@ -555,7 +555,7 @@ string V3Number::displayed(FileLine*fl, const string& vformat) const {
|
||||||
}
|
}
|
||||||
int intfmtsize = atoi(fmtsize.c_str());
|
int intfmtsize = atoi(fmtsize.c_str());
|
||||||
bool zeropad = fmtsize.length()>0 && fmtsize[0]=='0';
|
bool zeropad = fmtsize.length()>0 && fmtsize[0]=='0';
|
||||||
while ((int)(str.length()) < intfmtsize) {
|
while (static_cast<int>(str.length()) < intfmtsize) {
|
||||||
if (zeropad) str.insert(0, "0");
|
if (zeropad) str.insert(0, "0");
|
||||||
else str.insert(0, " ");
|
else str.insert(0, " ");
|
||||||
}
|
}
|
||||||
|
|
@ -572,23 +572,23 @@ string V3Number::displayed(FileLine*fl, const string& vformat) const {
|
||||||
// 'p' // Packed - converted to another code by V3Width
|
// 'p' // Packed - converted to another code by V3Width
|
||||||
case 'u': { // Packed 2-state
|
case 'u': { // Packed 2-state
|
||||||
for (int i=0; i<words(); i++) {
|
for (int i=0; i<words(); i++) {
|
||||||
str += (char)((m_value[i] >> 0) & 0xff);
|
str += static_cast<char>((m_value[i] >> 0) & 0xff);
|
||||||
str += (char)((m_value[i] >> 8) & 0xff);
|
str += static_cast<char>((m_value[i] >> 8) & 0xff);
|
||||||
str += (char)((m_value[i] >> 16) & 0xff);
|
str += static_cast<char>((m_value[i] >> 16) & 0xff);
|
||||||
str += (char)((m_value[i] >> 24) & 0xff);
|
str += static_cast<char>((m_value[i] >> 24) & 0xff);
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
case 'z': { // Packed 4-state
|
case 'z': { // Packed 4-state
|
||||||
for (int i=0; i<words(); i++) {
|
for (int i=0; i<words(); i++) {
|
||||||
str += (char)((m_value[i] >> 0) & 0xff);
|
str += static_cast<char>((m_value[i] >> 0) & 0xff);
|
||||||
str += (char)((m_value[i] >> 8) & 0xff);
|
str += static_cast<char>((m_value[i] >> 8) & 0xff);
|
||||||
str += (char)((m_value[i] >> 16) & 0xff);
|
str += static_cast<char>((m_value[i] >> 16) & 0xff);
|
||||||
str += (char)((m_value[i] >> 24) & 0xff);
|
str += static_cast<char>((m_value[i] >> 24) & 0xff);
|
||||||
str += (char)((m_valueX[i] >> 0) & 0xff);
|
str += static_cast<char>((m_valueX[i] >> 0) & 0xff);
|
||||||
str += (char)((m_valueX[i] >> 8) & 0xff);
|
str += static_cast<char>((m_valueX[i] >> 8) & 0xff);
|
||||||
str += (char)((m_valueX[i] >> 16) & 0xff);
|
str += static_cast<char>((m_valueX[i] >> 16) & 0xff);
|
||||||
str += (char)((m_valueX[i] >> 24) & 0xff);
|
str += static_cast<char>((m_valueX[i] >> 24) & 0xff);
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
@ -691,11 +691,11 @@ vlsint32_t V3Number::toSInt() const {
|
||||||
uint32_t v = toUInt();
|
uint32_t v = toUInt();
|
||||||
uint32_t signExtend = (-(v & (1UL<<(width()-1))));
|
uint32_t signExtend = (-(v & (1UL<<(width()-1))));
|
||||||
uint32_t extended = v | signExtend;
|
uint32_t extended = v | signExtend;
|
||||||
return (vlsint32_t)(extended);
|
return static_cast<vlsint32_t>(extended);
|
||||||
} else {
|
} else {
|
||||||
// Where we use this (widths, etc) and care about signedness,
|
// Where we use this (widths, etc) and care about signedness,
|
||||||
// we can reasonably assume the MSB isn't set on unsigned numbers.
|
// we can reasonably assume the MSB isn't set on unsigned numbers.
|
||||||
return (vlsint32_t)toUInt();
|
return static_cast<vlsint32_t>(toUInt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -705,15 +705,16 @@ vluint64_t V3Number::toUQuad() const {
|
||||||
for (int i=2; i<words(); ++i) {
|
for (int i=2; i<words(); ++i) {
|
||||||
UASSERT(!m_value[i], "Value too wide for 64-bits expected in this context "<<*this);
|
UASSERT(!m_value[i], "Value too wide for 64-bits expected in this context "<<*this);
|
||||||
}
|
}
|
||||||
if (width()<=32) return ((vluint64_t)(toUInt()));
|
if (width()<=32) return (static_cast<vluint64_t>(toUInt()));
|
||||||
return ((vluint64_t)m_value[1]<<VL_ULL(32)) | ((vluint64_t)m_value[0]);
|
return ((static_cast<vluint64_t>(m_value[1])<<VL_ULL(32))
|
||||||
|
| (static_cast<vluint64_t>(m_value[0])));
|
||||||
}
|
}
|
||||||
|
|
||||||
vlsint64_t V3Number::toSQuad() const {
|
vlsint64_t V3Number::toSQuad() const {
|
||||||
vluint64_t v = toUQuad();
|
vluint64_t v = toUQuad();
|
||||||
vluint64_t signExtend = (-(v & (VL_ULL(1)<<(width()-1))));
|
vluint64_t signExtend = (-(v & (VL_ULL(1)<<(width()-1))));
|
||||||
vluint64_t extended = v | signExtend;
|
vluint64_t extended = v | signExtend;
|
||||||
return (vlsint64_t)(extended);
|
return static_cast<vlsint64_t>(extended);
|
||||||
}
|
}
|
||||||
|
|
||||||
string V3Number::toString() const {
|
string V3Number::toString() const {
|
||||||
|
|
@ -727,8 +728,8 @@ string V3Number::toString() const {
|
||||||
for (; bit>=0; bit -= 8) {
|
for (; bit>=0; bit -= 8) {
|
||||||
int v = bitsValue(bit-7, 8);
|
int v = bitsValue(bit-7, 8);
|
||||||
if (!start || v) {
|
if (!start || v) {
|
||||||
str += (char)((v==0)?' ':v);
|
str += static_cast<char>((v==0) ? ' ' : v);
|
||||||
start = false; // Drop leading 0s
|
start = false; // Drop leading 0s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
|
|
@ -1069,7 +1070,7 @@ V3Number& V3Number::opStreamL(const V3Number& lhs, const V3Number& rhs) {
|
||||||
m_fileline->v3warn(WIDTHCONCAT,"Unsized numbers/parameters not allowed in streams.");
|
m_fileline->v3warn(WIDTHCONCAT,"Unsized numbers/parameters not allowed in streams.");
|
||||||
}
|
}
|
||||||
// Slice size should never exceed the lhs width
|
// Slice size should never exceed the lhs width
|
||||||
int ssize = std::min(rhs.toUInt(), (unsigned)lhs.width());
|
int ssize = std::min(rhs.toUInt(), static_cast<unsigned>(lhs.width()));
|
||||||
for (int istart=0; istart<lhs.width(); istart+=ssize) {
|
for (int istart=0; istart<lhs.width(); istart+=ssize) {
|
||||||
int ostart = std::max(0, lhs.width()-ssize-istart);
|
int ostart = std::max(0, lhs.width()-ssize-istart);
|
||||||
for (int bit=0; bit<ssize && bit<lhs.width()-istart; bit++) {
|
for (int bit=0; bit<ssize && bit<lhs.width()-istart; bit++) {
|
||||||
|
|
@ -1273,7 +1274,7 @@ V3Number& V3Number::opRotL(const V3Number& lhs, const V3Number& rhs) {
|
||||||
setZero();
|
setZero();
|
||||||
uint32_t rhsval = rhs.toUInt();
|
uint32_t rhsval = rhs.toUInt();
|
||||||
for (int bit=0; bit<this->width(); bit++) {
|
for (int bit=0; bit<this->width(); bit++) {
|
||||||
if (bit >= (int)rhsval) {
|
if (bit >= static_cast<int>(rhsval)) {
|
||||||
setBit(bit,lhs.bitIs((bit - rhsval) % this->width()));
|
setBit(bit,lhs.bitIs((bit - rhsval) % this->width()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1288,7 +1289,7 @@ V3Number& V3Number::opShiftR(const V3Number& lhs, const V3Number& rhs) {
|
||||||
if (rhs.bitIs1(bit)) return *this; // shift of over 2^32 must be zero
|
if (rhs.bitIs1(bit)) return *this; // shift of over 2^32 must be zero
|
||||||
}
|
}
|
||||||
uint32_t rhsval = rhs.toUInt();
|
uint32_t rhsval = rhs.toUInt();
|
||||||
if (rhsval < (uint32_t)lhs.width()) {
|
if (rhsval < static_cast<uint32_t>(lhs.width())) {
|
||||||
for (int bit=0; bit<this->width(); bit++) {
|
for (int bit=0; bit<this->width(); bit++) {
|
||||||
setBit(bit,lhs.bitIs(bit + rhsval));
|
setBit(bit,lhs.bitIs(bit + rhsval));
|
||||||
}
|
}
|
||||||
|
|
@ -1310,7 +1311,7 @@ V3Number& V3Number::opShiftRS(const V3Number& lhs, const V3Number& rhs, uint32_t
|
||||||
return *this; // shift of over 2^32 must be -1/0
|
return *this; // shift of over 2^32 must be -1/0
|
||||||
}
|
}
|
||||||
uint32_t rhsval = rhs.toUInt();
|
uint32_t rhsval = rhs.toUInt();
|
||||||
if (rhsval < (uint32_t)lhs.width()) {
|
if (rhsval < static_cast<uint32_t>(lhs.width())) {
|
||||||
for (int bit=0; bit<this->width(); bit++) {
|
for (int bit=0; bit<this->width(); bit++) {
|
||||||
setBit(bit,lhs.bitIsExtend(bit + rhsval, lbits));
|
setBit(bit,lhs.bitIsExtend(bit + rhsval, lbits));
|
||||||
}
|
}
|
||||||
|
|
@ -1331,8 +1332,8 @@ V3Number& V3Number::opShiftL(const V3Number& lhs, const V3Number& rhs) {
|
||||||
}
|
}
|
||||||
uint32_t rhsval = rhs.toUInt();
|
uint32_t rhsval = rhs.toUInt();
|
||||||
for (int bit=0; bit<this->width(); bit++) {
|
for (int bit=0; bit<this->width(); bit++) {
|
||||||
if (bit >= (int)rhsval) {
|
if (bit >= static_cast<int>(rhsval)) {
|
||||||
setBit(bit,lhs.bitIs(bit - rhsval));
|
setBit(bit, lhs.bitIs(bit - rhsval));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
|
|
@ -1391,7 +1392,8 @@ V3Number& V3Number::opMul(const V3Number& lhs, const V3Number& rhs) {
|
||||||
} else {
|
} else {
|
||||||
for (int lword=0; lword<lhs.words(); lword++) {
|
for (int lword=0; lword<lhs.words(); lword++) {
|
||||||
for (int rword=0; rword<rhs.words(); rword++) {
|
for (int rword=0; rword<rhs.words(); rword++) {
|
||||||
vluint64_t mul = (vluint64_t)(lhs.m_value[lword]) * (vluint64_t)(rhs.m_value[rword]);
|
vluint64_t mul = static_cast<vluint64_t>(lhs.m_value[lword])
|
||||||
|
* static_cast<vluint64_t>(rhs.m_value[rword]);
|
||||||
for (int qword=lword+rword; qword<this->words(); qword++) {
|
for (int qword=lword+rword; qword<this->words(); qword++) {
|
||||||
mul += (vluint64_t)(m_value[qword]);
|
mul += (vluint64_t)(m_value[qword]);
|
||||||
m_value[qword] = (mul & VL_ULL(0xffffffff));
|
m_value[qword] = (mul & VL_ULL(0xffffffff));
|
||||||
|
|
@ -1494,9 +1496,10 @@ V3Number& V3Number::opModDivGuts(const V3Number& lhs, const V3Number& rhs, bool
|
||||||
if (vw == 1) { // Single divisor word breaks rest of algorithm
|
if (vw == 1) { // Single divisor word breaks rest of algorithm
|
||||||
vluint64_t k = 0;
|
vluint64_t k = 0;
|
||||||
for (int j = uw-1; j >= 0; j--) {
|
for (int j = uw-1; j >= 0; j--) {
|
||||||
vluint64_t unw64 = ((k<<VL_ULL(32)) + (vluint64_t)(lhs.m_value[j]));
|
vluint64_t unw64 = ((k<<VL_ULL(32)) + static_cast<vluint64_t>(lhs.m_value[j]));
|
||||||
m_value[j] = unw64 / (vluint64_t)(rhs.m_value[0]);
|
m_value[j] = unw64 / static_cast<vluint64_t>(rhs.m_value[0]);
|
||||||
k = unw64 - (vluint64_t)(m_value[j])*(vluint64_t)(rhs.m_value[0]);
|
k = unw64 - (static_cast<vluint64_t>(m_value[j])
|
||||||
|
* static_cast<vluint64_t>(rhs.m_value[0]));
|
||||||
}
|
}
|
||||||
UINFO(9, " opmoddiv-1w "<<lhs<<" "<<rhs<<" q="<<*this<<" rem=0x"<<std::hex<<k<<std::dec<<endl);
|
UINFO(9, " opmoddiv-1w "<<lhs<<" "<<rhs<<" q="<<*this<<" rem=0x"<<std::hex<<k<<std::dec<<endl);
|
||||||
if (is_modulus) { setZero(); m_value[0] = k; }
|
if (is_modulus) { setZero(); m_value[0] = k; }
|
||||||
|
|
@ -1536,9 +1539,10 @@ V3Number& V3Number::opModDivGuts(const V3Number& lhs, const V3Number& rhs, bool
|
||||||
// Main loop
|
// Main loop
|
||||||
for (int j = uw - vw; j >= 0; j--) {
|
for (int j = uw - vw; j >= 0; j--) {
|
||||||
// Estimate
|
// Estimate
|
||||||
vluint64_t unw64 = ((vluint64_t)(un[j+vw])<<VL_ULL(32) | (vluint64_t)(un[j+vw-1]));
|
vluint64_t unw64 = (static_cast<vluint64_t>(un[j+vw])<<VL_ULL(32)
|
||||||
vluint64_t qhat = unw64 / (vluint64_t)(vn[vw-1]);
|
| static_cast<vluint64_t>(un[j+vw-1]));
|
||||||
vluint64_t rhat = unw64 - qhat*(vluint64_t)(vn[vw-1]);
|
vluint64_t qhat = unw64 / static_cast<vluint64_t>(vn[vw-1]);
|
||||||
|
vluint64_t rhat = unw64 - qhat*static_cast<vluint64_t>(vn[vw-1]);
|
||||||
|
|
||||||
again:
|
again:
|
||||||
if (qhat >= VL_ULL(0x100000000)
|
if (qhat >= VL_ULL(0x100000000)
|
||||||
|
|
@ -1565,7 +1569,7 @@ V3Number& V3Number::opModDivGuts(const V3Number& lhs, const V3Number& rhs, bool
|
||||||
this->m_value[j]--;
|
this->m_value[j]--;
|
||||||
k = 0;
|
k = 0;
|
||||||
for (int i=0; i<vw; i++) {
|
for (int i=0; i<vw; i++) {
|
||||||
t = (vluint64_t)(un[i+j]) + (vluint64_t)(vn[i]) + k;
|
t = static_cast<vluint64_t>(un[i+j]) + static_cast<vluint64_t>(vn[i]) + k;
|
||||||
un[i+j] = t;
|
un[i+j] = t;
|
||||||
k = t >> VL_ULL(32);
|
k = t >> VL_ULL(32);
|
||||||
}
|
}
|
||||||
|
|
@ -1684,15 +1688,15 @@ V3Number& V3Number::opSel(const V3Number& lhs, const V3Number& msb, const V3Numb
|
||||||
|
|
||||||
V3Number& V3Number::opSel(const V3Number& lhs, uint32_t msbval, uint32_t lsbval) {
|
V3Number& V3Number::opSel(const V3Number& lhs, uint32_t msbval, uint32_t lsbval) {
|
||||||
setZero();
|
setZero();
|
||||||
int ibit=lsbval;
|
int ibit = lsbval;
|
||||||
for(int bit=0; bit<this->width(); bit++) {
|
for(int bit=0; bit<this->width(); bit++) {
|
||||||
if (ibit>=0 && ibit<lhs.width()
|
if (ibit>=0 && ibit<lhs.width()
|
||||||
&& ibit<=(int)msbval) {
|
&& ibit <= static_cast<int>(msbval)) {
|
||||||
setBit(bit,lhs.bitIs(ibit));
|
setBit(bit, lhs.bitIs(ibit));
|
||||||
} else {
|
} else {
|
||||||
setBit(bit,'x');
|
setBit(bit, 'x');
|
||||||
}
|
}
|
||||||
ibit++;
|
++ibit;
|
||||||
}
|
}
|
||||||
//UINFO(0,"RANGE "<<lhs<<" "<<msb<<" "<<lsb<<" = "<<*this<<endl);
|
//UINFO(0,"RANGE "<<lhs<<" "<<msb<<" "<<lsb<<" = "<<*this<<endl);
|
||||||
return *this;
|
return *this;
|
||||||
|
|
@ -1743,12 +1747,12 @@ V3Number& V3Number::opIToRD(const V3Number& lhs) {
|
||||||
}
|
}
|
||||||
V3Number& V3Number::opRToIS(const V3Number& lhs) {
|
V3Number& V3Number::opRToIS(const V3Number& lhs) {
|
||||||
double v = VL_TRUNC(lhs.toDouble());
|
double v = VL_TRUNC(lhs.toDouble());
|
||||||
vlsint32_t i = (vlsint32_t)v; // C converts from double to vlsint32
|
vlsint32_t i = static_cast<vlsint32_t>(v); // C converts from double to vlsint32
|
||||||
return setLongS(i);
|
return setLongS(i);
|
||||||
}
|
}
|
||||||
V3Number& V3Number::opRToIRoundS(const V3Number& lhs) {
|
V3Number& V3Number::opRToIRoundS(const V3Number& lhs) {
|
||||||
double v = VL_ROUND(lhs.toDouble());
|
double v = VL_ROUND(lhs.toDouble());
|
||||||
vlsint32_t i = (vlsint32_t)v; // C converts from double to vlsint32
|
vlsint32_t i = static_cast<vlsint32_t>(v); // C converts from double to vlsint32
|
||||||
return setLongS(i);
|
return setLongS(i);
|
||||||
}
|
}
|
||||||
V3Number& V3Number::opRealToBits(const V3Number& lhs) {
|
V3Number& V3Number::opRealToBits(const V3Number& lhs) {
|
||||||
|
|
|
||||||
|
|
@ -134,9 +134,9 @@ public:
|
||||||
explicit V3Number(FileLine* fileline) { init(fileline, 1); }
|
explicit V3Number(FileLine* fileline) { init(fileline, 1); }
|
||||||
V3Number(FileLine* fileline, int width) { init(fileline, width); } // 0=unsized
|
V3Number(FileLine* fileline, int width) { init(fileline, width); } // 0=unsized
|
||||||
V3Number(FileLine* fileline, int width, uint32_t value) { init(fileline, width); m_value[0]=value; opCleanThis(); }
|
V3Number(FileLine* fileline, int width, uint32_t value) { init(fileline, width); m_value[0]=value; opCleanThis(); }
|
||||||
V3Number(FileLine* fileline, const char* source); // Create from a verilog 32'hxxxx number.
|
V3Number(FileLine* fileline, const char* sourcep); // Create from a verilog 32'hxxxx number.
|
||||||
class VerilogStringLiteral {}; // for creator type-overload selection
|
class VerilogStringLiteral {}; // For creator type-overload selection
|
||||||
V3Number(VerilogStringLiteral, FileLine* fileline, const string& vvalue);
|
V3Number(VerilogStringLiteral, FileLine* fileline, const string& str);
|
||||||
class String {};
|
class String {};
|
||||||
V3Number(String, FileLine* fileline, const string& value) { init(fileline, 0); setString(value); }
|
V3Number(String, FileLine* fileline, const string& value) { init(fileline, 0); setString(value); }
|
||||||
|
|
||||||
|
|
@ -173,7 +173,7 @@ public:
|
||||||
// ACCESSORS
|
// ACCESSORS
|
||||||
string ascii(bool prefixed=true, bool cleanVerilog=false) const;
|
string ascii(bool prefixed=true, bool cleanVerilog=false) const;
|
||||||
static string quoteNameControls(const string& namein); // Add backslash quotes to strings
|
static string quoteNameControls(const string& namein); // Add backslash quotes to strings
|
||||||
string displayed(FileLine* fl, const string& format) const;
|
string displayed(FileLine* fl, const string& vformat) const;
|
||||||
static bool displayedFmtLegal(char format); // Is this a valid format letter?
|
static bool displayedFmtLegal(char format); // Is this a valid format letter?
|
||||||
int width() const { return m_width; }
|
int width() const { return m_width; }
|
||||||
int widthMin() const; // Minimum width that can represent this number (~== log2(num)+1)
|
int widthMin() const; // Minimum width that can represent this number (~== log2(num)+1)
|
||||||
|
|
@ -194,9 +194,9 @@ public:
|
||||||
bool isBitsZero(int msb, int lsb) const;
|
bool isBitsZero(int msb, int lsb) const;
|
||||||
bool isEqOne() const;
|
bool isEqOne() const;
|
||||||
bool isEqAllOnes(int optwidth=0) const;
|
bool isEqAllOnes(int optwidth=0) const;
|
||||||
bool isCaseEq(const V3Number& rhsp) const; // operator==
|
bool isCaseEq(const V3Number& rhs) const; // operator==
|
||||||
bool isLt(const V3Number& rhsp) const; // operator<
|
bool isLt(const V3Number& rhs) const; // operator<
|
||||||
bool isLtXZ(const V3Number& rhsp) const; // operator< with XZ compared
|
bool isLtXZ(const V3Number& rhs) const; // operator< with XZ compared
|
||||||
void isSigned(bool ssigned) { m_signed=ssigned; }
|
void isSigned(bool ssigned) { m_signed=ssigned; }
|
||||||
bool isUnknown() const;
|
bool isUnknown() const;
|
||||||
uint32_t toUInt() const;
|
uint32_t toUInt() const;
|
||||||
|
|
@ -246,18 +246,18 @@ public:
|
||||||
V3Number& opConcat (const V3Number& lhs, const V3Number& rhs);
|
V3Number& opConcat (const V3Number& lhs, const V3Number& rhs);
|
||||||
V3Number& opLenN (const V3Number& lhs);
|
V3Number& opLenN (const V3Number& lhs);
|
||||||
V3Number& opRepl (const V3Number& lhs, const V3Number& rhs);
|
V3Number& opRepl (const V3Number& lhs, const V3Number& rhs);
|
||||||
V3Number& opRepl (const V3Number& lhs, uint32_t rhs);
|
V3Number& opRepl (const V3Number& lhs, uint32_t rhsval);
|
||||||
V3Number& opStreamL (const V3Number& lhs, const V3Number& rhs);
|
V3Number& opStreamL (const V3Number& lhs, const V3Number& rhs);
|
||||||
V3Number& opSel (const V3Number& lhs, const V3Number& rhs, const V3Number& ths);
|
V3Number& opSel (const V3Number& lhs, const V3Number& msb, const V3Number& lsb);
|
||||||
V3Number& opSel (const V3Number& lhs, uint32_t rhs, uint32_t ths);
|
V3Number& opSel (const V3Number& lhs, uint32_t msbval, uint32_t lsbval);
|
||||||
V3Number& opSelInto (const V3Number& lhs, const V3Number& lsb, int width);
|
V3Number& opSelInto (const V3Number& lhs, const V3Number& lsb, int width);
|
||||||
V3Number& opSelInto (const V3Number& lhs, int lsb, int width);
|
V3Number& opSelInto (const V3Number& lhs, int lsbval, int width);
|
||||||
V3Number& opCond (const V3Number& lhs, const V3Number& rhs, const V3Number& ths);
|
V3Number& opCond (const V3Number& lhs, const V3Number& if1s, const V3Number& if0s);
|
||||||
V3Number& opCaseEq (const V3Number& lhs, const V3Number& rhs);
|
V3Number& opCaseEq (const V3Number& lhs, const V3Number& rhs);
|
||||||
V3Number& opCaseNeq (const V3Number& lhs, const V3Number& rhs);
|
V3Number& opCaseNeq (const V3Number& lhs, const V3Number& rhs);
|
||||||
V3Number& opWildEq (const V3Number& lhs, const V3Number& rhs);
|
V3Number& opWildEq (const V3Number& lhs, const V3Number& rhs);
|
||||||
V3Number& opWildNeq (const V3Number& lhs, const V3Number& rhs);
|
V3Number& opWildNeq (const V3Number& lhs, const V3Number& rhs);
|
||||||
V3Number& opBufIf1 (const V3Number& lhs, const V3Number& rhs);
|
V3Number& opBufIf1 (const V3Number& ens, const V3Number& if1s);
|
||||||
// "standard" math
|
// "standard" math
|
||||||
V3Number& opNot (const V3Number& lhs);
|
V3Number& opNot (const V3Number& lhs);
|
||||||
V3Number& opLogNot (const V3Number& lhs);
|
V3Number& opLogNot (const V3Number& lhs);
|
||||||
|
|
@ -324,7 +324,7 @@ public:
|
||||||
// "N" - string operations
|
// "N" - string operations
|
||||||
V3Number& opConcatN (const V3Number& lhs, const V3Number& rhs);
|
V3Number& opConcatN (const V3Number& lhs, const V3Number& rhs);
|
||||||
V3Number& opReplN (const V3Number& lhs, const V3Number& rhs);
|
V3Number& opReplN (const V3Number& lhs, const V3Number& rhs);
|
||||||
V3Number& opReplN (const V3Number& lhs, uint32_t rhs);
|
V3Number& opReplN (const V3Number& lhs, uint32_t rhsval);
|
||||||
V3Number& opEqN (const V3Number& lhs, const V3Number& rhs);
|
V3Number& opEqN (const V3Number& lhs, const V3Number& rhs);
|
||||||
V3Number& opNeqN (const V3Number& lhs, const V3Number& rhs);
|
V3Number& opNeqN (const V3Number& lhs, const V3Number& rhs);
|
||||||
V3Number& opGtN (const V3Number& lhs, const V3Number& rhs);
|
V3Number& opGtN (const V3Number& lhs, const V3Number& rhs);
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,10 @@ void test(const string& lhss, const string& op, const string& rhss, const string
|
||||||
if (ok.toUInt()!=1) {
|
if (ok.toUInt()!=1) {
|
||||||
v3fatalSrc("%Error:Test FAILED");
|
v3fatalSrc("%Error:Test FAILED");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(l1);
|
||||||
|
free(r1);
|
||||||
|
free(e1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,7 @@ string V3Options::allArgsString() {
|
||||||
V3LangCode::V3LangCode(const char* textp) {
|
V3LangCode::V3LangCode(const char* textp) {
|
||||||
// Return code for given string, or ERROR, which is a bad code
|
// Return code for given string, or ERROR, which is a bad code
|
||||||
for (int codei=V3LangCode::L_ERROR; codei<V3LangCode::_ENUM_END; ++codei) {
|
for (int codei=V3LangCode::L_ERROR; codei<V3LangCode::_ENUM_END; ++codei) {
|
||||||
V3LangCode code = (V3LangCode)codei;
|
V3LangCode code = V3LangCode(codei);
|
||||||
if (0==strcasecmp(textp,code.ascii())) {
|
if (0==strcasecmp(textp,code.ascii())) {
|
||||||
m_e = code; return;
|
m_e = code; return;
|
||||||
}
|
}
|
||||||
|
|
@ -260,7 +260,8 @@ V3LangCode::V3LangCode(const char* textp) {
|
||||||
// File searching
|
// File searching
|
||||||
|
|
||||||
bool V3Options::fileStatDir(const string& filename) {
|
bool V3Options::fileStatDir(const string& filename) {
|
||||||
struct stat sstat; // Stat information
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
|
||||||
|
struct stat sstat; // Stat information
|
||||||
int err = stat(filename.c_str(), &sstat);
|
int err = stat(filename.c_str(), &sstat);
|
||||||
if (err!=0) return false;
|
if (err!=0) return false;
|
||||||
if (!S_ISDIR(sstat.st_mode)) return false;
|
if (!S_ISDIR(sstat.st_mode)) return false;
|
||||||
|
|
@ -268,7 +269,8 @@ bool V3Options::fileStatDir(const string& filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool V3Options::fileStatNormal(const string& filename) {
|
bool V3Options::fileStatNormal(const string& filename) {
|
||||||
struct stat sstat; // Stat information
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
|
||||||
|
struct stat sstat; // Stat information
|
||||||
int err = stat(filename.c_str(), &sstat);
|
int err = stat(filename.c_str(), &sstat);
|
||||||
if (err!=0) return false;
|
if (err!=0) return false;
|
||||||
if (S_ISDIR(sstat.st_mode)) return false;
|
if (S_ISDIR(sstat.st_mode)) return false;
|
||||||
|
|
@ -450,6 +452,7 @@ string V3Options::getenvSYSTEMC_ARCH() {
|
||||||
string sysname = "WIN32";
|
string sysname = "WIN32";
|
||||||
var = "win32";
|
var = "win32";
|
||||||
#else
|
#else
|
||||||
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
|
||||||
struct utsname uts;
|
struct utsname uts;
|
||||||
uname(&uts);
|
uname(&uts);
|
||||||
string sysname = VString::downcase(uts.sysname); // aka 'uname -s'
|
string sysname = VString::downcase(uts.sysname); // aka 'uname -s'
|
||||||
|
|
@ -1164,7 +1167,7 @@ void V3Options::parseOptsFile(FileLine* fl, const string& filename, bool rel) {
|
||||||
// Convert to argv style arg list and parse them
|
// Convert to argv style arg list and parse them
|
||||||
char* argv [args.size()+1];
|
char* argv [args.size()+1];
|
||||||
for (unsigned i=0; i<args.size(); ++i) {
|
for (unsigned i=0; i<args.size(); ++i) {
|
||||||
argv[i] = (char*)args[i].c_str();
|
argv[i] = const_cast<char*>(args[i].c_str());
|
||||||
}
|
}
|
||||||
parseOptsList(fl, optdir, args.size(), argv);
|
parseOptsList(fl, optdir, args.size(), argv);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@
|
||||||
#include "V3Global.h"
|
#include "V3Global.h"
|
||||||
#include "V3LangCode.h"
|
#include "V3LangCode.h"
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class V3OptionsImp;
|
class V3OptionsImp;
|
||||||
class FileLine;
|
class FileLine;
|
||||||
|
|
@ -214,7 +214,7 @@ class V3Options {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// METHODS
|
// METHODS
|
||||||
void addArg(const string& flag);
|
void addArg(const string& arg);
|
||||||
void addDefine(const string& defline, bool allowPlus);
|
void addDefine(const string& defline, bool allowPlus);
|
||||||
void addFuture(const string& flag);
|
void addFuture(const string& flag);
|
||||||
void addIncDirUser(const string& incdir); // User requested
|
void addIncDirUser(const string& incdir); // User requested
|
||||||
|
|
@ -238,9 +238,9 @@ class V3Options {
|
||||||
~V3Options();
|
~V3Options();
|
||||||
void setDebugMode(int level);
|
void setDebugMode(int level);
|
||||||
void setDebugSrcLevel(const string& srcfile, int level);
|
void setDebugSrcLevel(const string& srcfile, int level);
|
||||||
int debugSrcLevel(const string& srcfile, int default_level=V3Error::debugDefault());
|
int debugSrcLevel(const string& srcfile_path, int default_level=V3Error::debugDefault());
|
||||||
void setDumpTreeLevel(const string& srcfile, int level);
|
void setDumpTreeLevel(const string& srcfile, int level);
|
||||||
int dumpTreeLevel(const string& srcfile);
|
int dumpTreeLevel(const string& srcfile_path);
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
void addCppFile(const string& filename);
|
void addCppFile(const string& filename);
|
||||||
|
|
|
||||||
|
|
@ -749,7 +749,7 @@ private:
|
||||||
m_orderUserps.push_back(newup);
|
m_orderUserps.push_back(newup);
|
||||||
varscp->user1p(newup);
|
varscp->user1p(newup);
|
||||||
}
|
}
|
||||||
OrderUser* up = (OrderUser*)(varscp->user1p());
|
OrderUser* up = reinterpret_cast<OrderUser*>(varscp->user1p());
|
||||||
OrderVarVertex* varVxp = up->newVarUserVertex(&m_graph, m_scopep, varscp, type, createdp);
|
OrderVarVertex* varVxp = up->newVarUserVertex(&m_graph, m_scopep, varscp, type, createdp);
|
||||||
return varVxp;
|
return varVxp;
|
||||||
}
|
}
|
||||||
|
|
@ -1059,7 +1059,8 @@ private:
|
||||||
// clock_enable attribute: user's worring about it for us
|
// clock_enable attribute: user's worring about it for us
|
||||||
con = false;
|
con = false;
|
||||||
}
|
}
|
||||||
if (m_inClkAss && (varscp->varp()->attrClocker()) != AstVarAttrClocker::CLOCKER_YES) {
|
if (m_inClkAss && (varscp->varp()->attrClocker()
|
||||||
|
!= AstVarAttrClocker::CLOCKER_YES)) {
|
||||||
con = false;
|
con = false;
|
||||||
UINFO(4, "nodep used as clock_enable "<<varscp<<" in "<<m_logicVxp->nodep()<<endl);
|
UINFO(4, "nodep used as clock_enable "<<varscp<<" in "<<m_logicVxp->nodep()<<endl);
|
||||||
}
|
}
|
||||||
|
|
@ -1087,10 +1088,12 @@ private:
|
||||||
} else {
|
} else {
|
||||||
// If the lhs is a clocker, avoid marking that as circular by
|
// If the lhs is a clocker, avoid marking that as circular by
|
||||||
// putting a hard edge instead of normal cuttable
|
// putting a hard edge instead of normal cuttable
|
||||||
if (varscp->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES)
|
if (varscp->varp()->attrClocker()
|
||||||
|
== AstVarAttrClocker::CLOCKER_YES) {
|
||||||
new OrderEdge(&m_graph, m_logicVxp, varVxp, WEIGHT_NORMAL);
|
new OrderEdge(&m_graph, m_logicVxp, varVxp, WEIGHT_NORMAL);
|
||||||
else
|
} else {
|
||||||
new OrderComboCutEdge(&m_graph, m_logicVxp, varVxp);
|
new OrderComboCutEdge(&m_graph, m_logicVxp, varVxp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// For m_inPost:
|
// For m_inPost:
|
||||||
// Add edge consumed_var_POST->logic_vertex
|
// Add edge consumed_var_POST->logic_vertex
|
||||||
|
|
@ -1354,7 +1357,7 @@ void OrderVisitor::processInputsInIterate(OrderEitherVertex* vertexp, VertexVec&
|
||||||
// Also, determine if this vertex is an input
|
// Also, determine if this vertex is an input
|
||||||
int inonly = 1; // 0=no, 1=maybe, 2=yes until a no
|
int inonly = 1; // 0=no, 1=maybe, 2=yes until a no
|
||||||
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep=edgep->inNextp()) {
|
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep=edgep->inNextp()) {
|
||||||
OrderEitherVertex* frVertexp = (OrderEitherVertex*)edgep->fromp();
|
OrderEitherVertex* frVertexp = static_cast<OrderEitherVertex*>(edgep->fromp());
|
||||||
processInputsInIterate(frVertexp, todoVec);
|
processInputsInIterate(frVertexp, todoVec);
|
||||||
if (frVertexp->isFromInput()) {
|
if (frVertexp->isFromInput()) {
|
||||||
if (inonly==1) inonly = 2;
|
if (inonly==1) inonly = 2;
|
||||||
|
|
@ -1393,7 +1396,7 @@ void OrderVisitor::processInputsOutIterate(OrderEitherVertex* vertexp, VertexVec
|
||||||
{
|
{
|
||||||
// Propagate PrimaryIn through simple assignments, followint target of vertex
|
// Propagate PrimaryIn through simple assignments, followint target of vertex
|
||||||
for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep=edgep->outNextp()) {
|
for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep=edgep->outNextp()) {
|
||||||
OrderEitherVertex* toVertexp = (OrderEitherVertex*)edgep->top();
|
OrderEitherVertex* toVertexp = static_cast<OrderEitherVertex*>(edgep->top());
|
||||||
if (OrderVarStdVertex* vvertexp = dynamic_cast<OrderVarStdVertex*>(toVertexp)) {
|
if (OrderVarStdVertex* vvertexp = dynamic_cast<OrderVarStdVertex*>(toVertexp)) {
|
||||||
processInputsInIterate(vvertexp, todoVec);
|
processInputsInIterate(vvertexp, todoVec);
|
||||||
}
|
}
|
||||||
|
|
@ -1506,7 +1509,7 @@ void OrderVisitor::processDomainsIterate(OrderEitherVertex* vertexp) {
|
||||||
}
|
}
|
||||||
if (!domainp) {
|
if (!domainp) {
|
||||||
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
|
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
|
||||||
OrderEitherVertex* fromVertexp = (OrderEitherVertex*)edgep->fromp();
|
OrderEitherVertex* fromVertexp = static_cast<OrderEitherVertex*>(edgep->fromp());
|
||||||
if (edgep->weight()
|
if (edgep->weight()
|
||||||
&& fromVertexp->domainMatters()
|
&& fromVertexp->domainMatters()
|
||||||
) {
|
) {
|
||||||
|
|
@ -1721,7 +1724,7 @@ void OrderVisitor::processMoveDoneOne(OrderMoveVertex* vertexp) {
|
||||||
// Mark our outputs as one closer to ready
|
// Mark our outputs as one closer to ready
|
||||||
for (V3GraphEdge* edgep = vertexp->outBeginp(), *nextp; edgep; edgep=nextp) {
|
for (V3GraphEdge* edgep = vertexp->outBeginp(), *nextp; edgep; edgep=nextp) {
|
||||||
nextp = edgep->outNextp();
|
nextp = edgep->outNextp();
|
||||||
OrderMoveVertex* toVertexp = (OrderMoveVertex*)edgep->top();
|
OrderMoveVertex* toVertexp = static_cast<OrderMoveVertex*>(edgep->top());
|
||||||
UINFO(9," Clear to "<<(toVertexp->inEmpty()?"[EMP] ":" ")
|
UINFO(9," Clear to "<<(toVertexp->inEmpty()?"[EMP] ":" ")
|
||||||
<<toVertexp<<endl);
|
<<toVertexp<<endl);
|
||||||
// Delete this edge
|
// Delete this edge
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,7 @@ uint64_t V3Os::timeUsecs() {
|
||||||
#if defined(_WIN32) || defined(__MINGW32__)
|
#if defined(_WIN32) || defined(__MINGW32__)
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
|
||||||
timeval tv;
|
timeval tv;
|
||||||
if (gettimeofday(&tv, NULL) < 0) return 0;
|
if (gettimeofday(&tv, NULL) < 0) return 0;
|
||||||
return static_cast<uint64_t>(tv.tv_sec)*1000000 + tv.tv_usec;
|
return static_cast<uint64_t>(tv.tv_sec)*1000000 + tv.tv_usec;
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public:
|
||||||
return filenameNonExt(filenameNonDir(filename)); }
|
return filenameNonExt(filenameNonDir(filename)); }
|
||||||
static string filenameDir(const string& filename); ///< Return directory part of filename
|
static string filenameDir(const string& filename); ///< Return directory part of filename
|
||||||
static string filenameSubstitute(const string& filename); ///< Return filename with env vars removed
|
static string filenameSubstitute(const string& filename); ///< Return filename with env vars removed
|
||||||
static string filenameRealPath(const string& fn); ///< Return realpath of filename
|
static string filenameRealPath(const string& filename); ///< Return realpath of filename
|
||||||
static bool filenameIsRel(const string& filename); ///< True if relative
|
static bool filenameIsRel(const string& filename); ///< True if relative
|
||||||
|
|
||||||
// METHODS (directory utilities)
|
// METHODS (directory utilities)
|
||||||
|
|
|
||||||
|
|
@ -618,25 +618,26 @@ void ParamVisitor::visitCell(AstCell* nodep) {
|
||||||
&& VN_IS(exprp, VarRef)
|
&& VN_IS(exprp, VarRef)
|
||||||
&& VN_CAST(exprp, VarRef)->varp()
|
&& VN_CAST(exprp, VarRef)->varp()
|
||||||
&& VN_CAST(exprp, VarRef)->varp()->subDTypep()
|
&& VN_CAST(exprp, VarRef)->varp()->subDTypep()
|
||||||
&& VN_IS(VN_CAST(exprp, VarRef)->varp()->subDTypep(), IfaceRefDType))
|
&& VN_IS(VN_CAST(exprp, VarRef)->varp()->subDTypep(), IfaceRefDType)) {
|
||||||
pinIrefp = VN_CAST(VN_CAST(exprp, VarRef)->varp()->subDTypep(), IfaceRefDType);
|
pinIrefp = VN_CAST(VN_CAST(exprp, VarRef)->varp()->subDTypep(), IfaceRefDType);
|
||||||
else if (exprp
|
} else if (exprp
|
||||||
&& exprp->op1p()
|
&& exprp->op1p()
|
||||||
&& VN_IS(exprp->op1p(), VarRef)
|
&& VN_IS(exprp->op1p(), VarRef)
|
||||||
&& VN_CAST(exprp->op1p(), VarRef)->varp()
|
&& VN_CAST(exprp->op1p(), VarRef)->varp()
|
||||||
&& VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep()
|
&& VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep()
|
||||||
&& VN_CAST(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep(), UnpackArrayDType)
|
&& VN_CAST(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep(), UnpackArrayDType)
|
||||||
&& VN_CAST(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep(), UnpackArrayDType)->subDTypep()
|
&& VN_CAST(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep(), UnpackArrayDType)->subDTypep()
|
||||||
&& VN_CAST(VN_CAST(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep(), UnpackArrayDType)->subDTypep(), IfaceRefDType))
|
&& VN_CAST(VN_CAST(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep(), UnpackArrayDType)->subDTypep(), IfaceRefDType)) {
|
||||||
pinIrefp = VN_CAST(VN_CAST(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep(), UnpackArrayDType)->subDTypep(), IfaceRefDType);
|
pinIrefp = VN_CAST(VN_CAST(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep(), UnpackArrayDType)->subDTypep(), IfaceRefDType);
|
||||||
else if (exprp
|
} else if (exprp
|
||||||
&& VN_IS(exprp, VarRef)
|
&& VN_IS(exprp, VarRef)
|
||||||
&& VN_CAST(exprp, VarRef)->varp()
|
&& VN_CAST(exprp, VarRef)->varp()
|
||||||
&& VN_CAST(exprp, VarRef)->varp()->subDTypep()
|
&& VN_CAST(exprp, VarRef)->varp()->subDTypep()
|
||||||
&& VN_CAST(VN_CAST(exprp, VarRef)->varp()->subDTypep(), UnpackArrayDType)
|
&& VN_CAST(VN_CAST(exprp, VarRef)->varp()->subDTypep(), UnpackArrayDType)
|
||||||
&& VN_CAST(VN_CAST(exprp, VarRef)->varp()->subDTypep(), UnpackArrayDType)->subDTypep()
|
&& VN_CAST(VN_CAST(exprp, VarRef)->varp()->subDTypep(), UnpackArrayDType)->subDTypep()
|
||||||
&& VN_CAST(VN_CAST(VN_CAST(exprp, VarRef)->varp()->subDTypep(), UnpackArrayDType)->subDTypep(), IfaceRefDType))
|
&& VN_CAST(VN_CAST(VN_CAST(exprp, VarRef)->varp()->subDTypep(), UnpackArrayDType)->subDTypep(), IfaceRefDType)) {
|
||||||
pinIrefp = VN_CAST(VN_CAST(VN_CAST(exprp, VarRef)->varp()->subDTypep(), UnpackArrayDType)->subDTypep(), IfaceRefDType);
|
pinIrefp = VN_CAST(VN_CAST(VN_CAST(exprp, VarRef)->varp()->subDTypep(), UnpackArrayDType)->subDTypep(), IfaceRefDType);
|
||||||
|
}
|
||||||
|
|
||||||
UINFO(9," portIfaceRef "<<portIrefp<<endl);
|
UINFO(9," portIfaceRef "<<portIrefp<<endl);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ void V3ParseImp::lexFile(const string& modname) {
|
||||||
s_parsep = this;
|
s_parsep = this;
|
||||||
fileline()->warnResetDefault(); // Reenable warnings on each file
|
fileline()->warnResetDefault(); // Reenable warnings on each file
|
||||||
lexDestroy(); // Restart from clean slate.
|
lexDestroy(); // Restart from clean slate.
|
||||||
lexNew(debugFlex()>=9);
|
lexNew();
|
||||||
|
|
||||||
// Lex it
|
// Lex it
|
||||||
if (bisonParse()) v3fatal("Cannot continue\n");
|
if (bisonParse()) v3fatal("Cannot continue\n");
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ public:
|
||||||
int bisonParse();
|
int bisonParse();
|
||||||
|
|
||||||
// Interactions with lexer
|
// Interactions with lexer
|
||||||
void lexNew(int debug);
|
void lexNew();
|
||||||
void lexDestroy();
|
void lexDestroy();
|
||||||
void statePop(); // Parser -> lexer communication
|
void statePop(); // Parser -> lexer communication
|
||||||
static int stateVerilogRecent(); // Parser -> lexer communication
|
static int stateVerilogRecent(); // Parser -> lexer communication
|
||||||
|
|
|
||||||
|
|
@ -47,19 +47,22 @@ public:
|
||||||
~V3Lexer() {}
|
~V3Lexer() {}
|
||||||
// METHODS
|
// METHODS
|
||||||
void statePop() {
|
void statePop() {
|
||||||
yy_pop_state();
|
yy_pop_state();
|
||||||
}
|
}
|
||||||
void unputString(const char* textp, size_t length) {
|
void unputString(const char* textp, size_t length) {
|
||||||
// Add characters to input stream in back-to-front order
|
// Add characters to input stream in back-to-front order
|
||||||
const char* cp = textp;
|
const char* cp = textp;
|
||||||
for (cp += length - 1; length--; cp--) {
|
for (cp += length - 1; length--; cp--) {
|
||||||
unput(*cp);
|
unput(*cp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
void V3ParseImp::statePop() { parsep()->m_lexerp->statePop(); }
|
|
||||||
|
|
||||||
void V3ParseImp::unputString(const char* textp, size_t length) { parsep()->m_lexerp->unputString(textp, length); }
|
void V3ParseImp::statePop() { parsep()->m_lexerp->statePop(); }
|
||||||
|
|
||||||
|
void V3ParseImp::unputString(const char* textp, size_t length) {
|
||||||
|
parsep()->m_lexerp->unputString(textp, length);
|
||||||
|
}
|
||||||
|
|
||||||
int V3ParseImp::yylexReadTok() {
|
int V3ParseImp::yylexReadTok() {
|
||||||
// Call yylex() remembering last non-whitespace token
|
// Call yylex() remembering last non-whitespace token
|
||||||
|
|
@ -71,8 +74,8 @@ int V3ParseImp::yylexReadTok() {
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// Read class functions
|
// Read class functions
|
||||||
|
|
||||||
void V3ParseImp::lexNew(int debug) {
|
void V3ParseImp::lexNew() {
|
||||||
if (m_lexerp) delete m_lexerp; // Restart from clean slate.
|
if (m_lexerp) delete m_lexerp; // Restart from clean slate.
|
||||||
m_lexerp = new V3Lexer();
|
m_lexerp = new V3Lexer();
|
||||||
if (debugFlex()>=9) { m_lexerp->set_debug(~0); }
|
if (debugFlex()>=9) { m_lexerp->set_debug(~0); }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -551,7 +551,7 @@ public:
|
||||||
logcost = ceil(logcost);
|
logcost = ceil(logcost);
|
||||||
logcost = logcost / 20.0;
|
logcost = logcost / 20.0;
|
||||||
|
|
||||||
uint32_t stepCost = (uint32_t)(exp(logcost));
|
uint32_t stepCost = static_cast<uint32_t>(exp(logcost));
|
||||||
UASSERT_STATIC(stepCost >= cost, "stepped cost error exceeded");
|
UASSERT_STATIC(stepCost >= cost, "stepped cost error exceeded");
|
||||||
UASSERT_STATIC(stepCost <= ((cost * 11 / 10)), "stepped cost error exceeded");
|
UASSERT_STATIC(stepCost <= ((cost * 11 / 10)), "stepped cost error exceeded");
|
||||||
return stepCost;
|
return stepCost;
|
||||||
|
|
@ -822,8 +822,7 @@ class MTaskEdge : public V3GraphEdge, public MergeCandidate {
|
||||||
public:
|
public:
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
MTaskEdge(V3Graph* graphp, LogicMTask* fromp, LogicMTask* top, int weight)
|
MTaskEdge(V3Graph* graphp, LogicMTask* fromp, LogicMTask* top, int weight)
|
||||||
: V3GraphEdge(graphp, fromp, top, weight),
|
: V3GraphEdge(graphp, fromp, top, weight) {
|
||||||
MergeCandidate() {
|
|
||||||
fromp->addRelative(GraphWay::FORWARD, top);
|
fromp->addRelative(GraphWay::FORWARD, top);
|
||||||
top->addRelative(GraphWay::REVERSE, fromp);
|
top->addRelative(GraphWay::REVERSE, fromp);
|
||||||
}
|
}
|
||||||
|
|
@ -2204,10 +2203,10 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
PartPackMTasks(V3Graph* mtasksp,
|
explicit PartPackMTasks(V3Graph* mtasksp,
|
||||||
uint32_t nThreads = v3Global.opt.threads(),
|
uint32_t nThreads = v3Global.opt.threads(),
|
||||||
unsigned sandbagNumerator = 30,
|
unsigned sandbagNumerator = 30,
|
||||||
unsigned sandbagDenom = 100)
|
unsigned sandbagDenom = 100)
|
||||||
: m_mtasksp(mtasksp)
|
: m_mtasksp(mtasksp)
|
||||||
, m_nThreads(nThreads)
|
, m_nThreads(nThreads)
|
||||||
, m_sandbagNumerator(sandbagNumerator)
|
, m_sandbagNumerator(sandbagNumerator)
|
||||||
|
|
@ -2296,6 +2295,7 @@ public:
|
||||||
<<" on thread "<<th<<endl);
|
<<" on thread "<<th<<endl);
|
||||||
if ((timeBegin < bestTime)
|
if ((timeBegin < bestTime)
|
||||||
|| ((timeBegin == bestTime)
|
|| ((timeBegin == bestTime)
|
||||||
|
&& bestMtaskp // Redundant, but appeases static analysis tools
|
||||||
&& (taskp->priority() > bestMtaskp->priority()))) {
|
&& (taskp->priority() > bestMtaskp->priority()))) {
|
||||||
bestTime = timeBegin;
|
bestTime = timeBegin;
|
||||||
bestTh = th;
|
bestTh = th;
|
||||||
|
|
@ -2304,6 +2304,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!bestMtaskp) v3fatalSrc("Should have found some task");
|
||||||
UINFO(6, "Will schedule "<<bestMtaskp->name()
|
UINFO(6, "Will schedule "<<bestMtaskp->name()
|
||||||
<<" onto thread "<<bestTh<<endl);
|
<<" onto thread "<<bestTh<<endl);
|
||||||
uint32_t bestEndTime = bestTime + bestMtaskp->cost();
|
uint32_t bestEndTime = bestTime + bestMtaskp->cost();
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ public:
|
||||||
static void hashGraphDebug(const V3Graph* graphp, const char* debugName);
|
static void hashGraphDebug(const V3Graph* graphp, const char* debugName);
|
||||||
|
|
||||||
// Print debug stats about graphp whose nodes must be AbstractMTask's.
|
// Print debug stats about graphp whose nodes must be AbstractMTask's.
|
||||||
static void debugMTaskGraphStats(const V3Graph* graphp, const string& name);
|
static void debugMTaskGraphStats(const V3Graph* graphp, const string& stage);
|
||||||
|
|
||||||
// Operate on the final ExecMTask graph, immediately prior to code
|
// Operate on the final ExecMTask graph, immediately prior to code
|
||||||
// generation time.
|
// generation time.
|
||||||
|
|
|
||||||
|
|
@ -230,11 +230,11 @@ public:
|
||||||
string getline();
|
string getline();
|
||||||
void insertUnreadback(const string& text) { m_lineCmt += text; }
|
void insertUnreadback(const string& text) { m_lineCmt += text; }
|
||||||
void insertUnreadbackAtBol(const string& text);
|
void insertUnreadbackAtBol(const string& text);
|
||||||
void addLineComment(int enter_exit_level);
|
void addLineComment(int enterExit);
|
||||||
|
|
||||||
// METHODS, callbacks
|
// METHODS, callbacks
|
||||||
virtual void comment(const string& cmt); // Comment detected (if keepComments==2)
|
virtual void comment(const string& text); // Comment detected (if keepComments==2)
|
||||||
virtual void include(const string& filename); // Request a include file be processed
|
virtual void include(const string& filename); // Request a include file be processed
|
||||||
virtual void undef(const string& name);
|
virtual void undef(const string& name);
|
||||||
virtual void undefineall();
|
virtual void undefineall();
|
||||||
virtual void define(FileLine* fl, const string& name, const string& value,
|
virtual void define(FileLine* fl, const string& name, const string& value,
|
||||||
|
|
@ -242,7 +242,7 @@ public:
|
||||||
virtual string removeDefines(const string& text); // Remove defines in a text string
|
virtual string removeDefines(const string& text); // Remove defines in a text string
|
||||||
|
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
V3PreProcImp() : V3PreProc() {
|
V3PreProcImp() {
|
||||||
m_debug = 0;
|
m_debug = 0;
|
||||||
m_states.push(ps_TOP);
|
m_states.push(ps_TOP);
|
||||||
m_off = 0;
|
m_off = 0;
|
||||||
|
|
@ -299,8 +299,7 @@ void V3PreProcImp::undefineall() {
|
||||||
}
|
}
|
||||||
bool V3PreProcImp::defExists(const string& name) {
|
bool V3PreProcImp::defExists(const string& name) {
|
||||||
DefinesMap::iterator iter = m_defines.find(name);
|
DefinesMap::iterator iter = m_defines.find(name);
|
||||||
if (iter == m_defines.end()) return false;
|
return (iter != m_defines.end());
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
string V3PreProcImp::defValue(const string& name) {
|
string V3PreProcImp::defValue(const string& name) {
|
||||||
DefinesMap::iterator iter = m_defines.find(name);
|
DefinesMap::iterator iter = m_defines.find(name);
|
||||||
|
|
@ -338,9 +337,9 @@ void V3PreProcImp::define(FileLine* fl, const string& name, const string& value,
|
||||||
m_defines.insert(make_pair(name, V3Define(fl, value, params, cmdline)));
|
m_defines.insert(make_pair(name, V3Define(fl, value, params, cmdline)));
|
||||||
}
|
}
|
||||||
|
|
||||||
string V3PreProcImp::removeDefines(const string& sym) {
|
string V3PreProcImp::removeDefines(const string& text) {
|
||||||
string val = "0_never_match";
|
string val = "0_never_match";
|
||||||
string rtnsym = sym;
|
string rtnsym = text;
|
||||||
for (int loopprevent=0; loopprevent<100; loopprevent++) {
|
for (int loopprevent=0; loopprevent<100; loopprevent++) {
|
||||||
string xsym = rtnsym;
|
string xsym = rtnsym;
|
||||||
if (xsym.substr(0,1)=="`") xsym.replace(0,1,"");
|
if (xsym.substr(0,1)=="`") xsym.replace(0,1,"");
|
||||||
|
|
@ -793,9 +792,9 @@ void V3PreProcImp::insertUnreadbackAtBol(const string& text) {
|
||||||
insertUnreadback(text);
|
insertUnreadback(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3PreProcImp::addLineComment(int enter_exit_level) {
|
void V3PreProcImp::addLineComment(int enterExit) {
|
||||||
if (lineDirectives()) {
|
if (lineDirectives()) {
|
||||||
insertUnreadbackAtBol(m_lexp->curFilelinep()->lineDirectiveStrg(enter_exit_level));
|
insertUnreadbackAtBol(m_lexp->curFilelinep()->lineDirectiveStrg(enterExit));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -854,7 +853,8 @@ void V3PreProcImp::debugToken(int tok, const char* cmtp) {
|
||||||
while ((pos = buf.find('\r')) != string::npos) { buf.replace(pos, 1, "\\r"); }
|
while ((pos = buf.find('\r')) != string::npos) { buf.replace(pos, 1, "\\r"); }
|
||||||
fprintf(stderr, "%d: %s %s %s(%d) dr%d: <%d>%-10s: %s\n",
|
fprintf(stderr, "%d: %s %s %s(%d) dr%d: <%d>%-10s: %s\n",
|
||||||
m_lexp->m_tokFilelinep->lineno(), cmtp, m_off?"of":"on",
|
m_lexp->m_tokFilelinep->lineno(), cmtp, m_off?"of":"on",
|
||||||
procStateName(state()), (int)m_states.size(), (int)m_defRefs.size(),
|
procStateName(state()), static_cast<int>(m_states.size()),
|
||||||
|
static_cast<int>(m_defRefs.size()),
|
||||||
m_lexp->currentStartState(), tokenName(tok), buf.c_str());
|
m_lexp->currentStartState(), tokenName(tok), buf.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -889,7 +889,9 @@ int V3PreProcImp::getStateToken() {
|
||||||
// We're off or processed the comment specially. If there are newlines
|
// We're off or processed the comment specially. If there are newlines
|
||||||
// in it, we also return the newlines as TEXT so that the linenumber
|
// in it, we also return the newlines as TEXT so that the linenumber
|
||||||
// count is maintained for downstream tools
|
// count is maintained for downstream tools
|
||||||
for (size_t len=0; len<(size_t)yyourleng(); len++) { if (yyourtext()[len]=='\n') m_lineAdd++; }
|
for (size_t len=0; len<static_cast<size_t>(yyourleng()); len++) {
|
||||||
|
if (yyourtext()[len]=='\n') m_lineAdd++;
|
||||||
|
}
|
||||||
goto next_tok;
|
goto next_tok;
|
||||||
}
|
}
|
||||||
if (tok==VP_LINE) {
|
if (tok==VP_LINE) {
|
||||||
|
|
@ -1416,11 +1418,14 @@ int V3PreProcImp::getFinalToken(string& buf) {
|
||||||
if (m_finAtBol && !(tok==VP_TEXT && buf=="\n")
|
if (m_finAtBol && !(tok==VP_TEXT && buf=="\n")
|
||||||
&& m_preprocp->lineDirectives()) {
|
&& m_preprocp->lineDirectives()) {
|
||||||
if (int outBehind = m_lexp->m_tokFilelinep->lineno() - m_finFilelinep->lineno()) {
|
if (int outBehind = m_lexp->m_tokFilelinep->lineno() - m_finFilelinep->lineno()) {
|
||||||
if (debug()>=5) fprintf(stderr,"%d: FIN: readjust, fin at %d request at %d\n",
|
if (debug()>=5) {
|
||||||
m_lexp->m_tokFilelinep->lineno(),
|
fprintf(stderr, "%d: FIN: readjust, fin at %d request at %d\n",
|
||||||
m_finFilelinep->lineno(), m_lexp->m_tokFilelinep->lineno());
|
m_lexp->m_tokFilelinep->lineno(),
|
||||||
|
m_finFilelinep->lineno(), m_lexp->m_tokFilelinep->lineno());
|
||||||
|
}
|
||||||
m_finFilelinep = m_finFilelinep->create(m_lexp->m_tokFilelinep->filename(),m_lexp->m_tokFilelinep->lineno());
|
m_finFilelinep = m_finFilelinep->create(m_lexp->m_tokFilelinep->filename(),m_lexp->m_tokFilelinep->lineno());
|
||||||
if (outBehind > 0 && outBehind <= (int)V3PreProc::NEWLINES_VS_TICKLINE) {
|
if (outBehind > 0
|
||||||
|
&& (outBehind <= static_cast<int>(V3PreProc::NEWLINES_VS_TICKLINE))) {
|
||||||
// Output stream is behind, send newlines to get back in sync
|
// Output stream is behind, send newlines to get back in sync
|
||||||
// (Most likely because we're completing a disabled `endif)
|
// (Most likely because we're completing a disabled `endif)
|
||||||
if (m_preprocp->keepWhitespace()) {
|
if (m_preprocp->keepWhitespace()) {
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ protected:
|
||||||
};
|
};
|
||||||
void configure(FileLine* fl);
|
void configure(FileLine* fl);
|
||||||
public:
|
public:
|
||||||
static V3PreProc* createPreProc(FileLine* fileline);
|
static V3PreProc* createPreProc(FileLine* fl);
|
||||||
virtual ~V3PreProc() {}
|
virtual ~V3PreProc() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,9 @@ class V3PreShell {
|
||||||
// Static class for calling preprocessor
|
// Static class for calling preprocessor
|
||||||
public:
|
public:
|
||||||
static void boot(char** env);
|
static void boot(char** env);
|
||||||
static bool preproc(FileLine* fileline, const string& module, V3InFilter* filterp,
|
static bool preproc(FileLine* fl, const string& modname, V3InFilter* filterp,
|
||||||
V3ParseImp* parsep, const string& errmsg);
|
V3ParseImp* parsep, const string& errmsg);
|
||||||
static void preprocInclude(FileLine* fileline, const string& module);
|
static void preprocInclude(FileLine* fl, const string& modname);
|
||||||
static string dependFiles() { return ""; } // Perl only
|
static string dependFiles() { return ""; } // Perl only
|
||||||
static void defineCmdLine(const string& name, const string& value);
|
static void defineCmdLine(const string& name, const string& value);
|
||||||
static void undef(const string& name);
|
static void undef(const string& name);
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,9 @@ private:
|
||||||
UINFO(4," MOD AT "<<scopename<<" "<<nodep<<endl);
|
UINFO(4," MOD AT "<<scopename<<" "<<nodep<<endl);
|
||||||
AstNode::user1ClearTree();
|
AstNode::user1ClearTree();
|
||||||
|
|
||||||
m_scopep = new AstScope((m_aboveCellp?(AstNode*)m_aboveCellp:(AstNode*)nodep)->fileline(),
|
m_scopep = new AstScope((m_aboveCellp ? static_cast<AstNode*>(m_aboveCellp)
|
||||||
|
: static_cast<AstNode*>(nodep))
|
||||||
|
->fileline(),
|
||||||
nodep, scopename, m_aboveScopep, m_aboveCellp);
|
nodep, scopename, m_aboveScopep, m_aboveCellp);
|
||||||
if (VN_IS(nodep, Package)) m_packageScopes.insert(make_pair(VN_CAST(nodep, Package), m_scopep));
|
if (VN_IS(nodep, Package)) m_packageScopes.insert(make_pair(VN_CAST(nodep, Package), m_scopep));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -226,10 +226,10 @@ class SliceVisitor : public AstNVisitor {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// CONSTUCTORS
|
// CONSTUCTORS
|
||||||
explicit SliceVisitor(AstNetlist* rootp) {
|
explicit SliceVisitor(AstNetlist* nodep) {
|
||||||
m_assignp = NULL;
|
m_assignp = NULL;
|
||||||
m_assignError = false;
|
m_assignError = false;
|
||||||
iterate(rootp);
|
iterate(nodep);
|
||||||
}
|
}
|
||||||
virtual ~SliceVisitor() {}
|
virtual ~SliceVisitor() {}
|
||||||
};
|
};
|
||||||
|
|
@ -237,10 +237,10 @@ public:
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// Link class functions
|
// Link class functions
|
||||||
|
|
||||||
void V3Slice::sliceAll(AstNetlist* rootp) {
|
void V3Slice::sliceAll(AstNetlist* nodep) {
|
||||||
UINFO(2,__FUNCTION__<<": "<<endl);
|
UINFO(2,__FUNCTION__<<": "<<endl);
|
||||||
{
|
{
|
||||||
SliceVisitor visitor(rootp);
|
SliceVisitor visitor(nodep);
|
||||||
} // Destruct before checking
|
} // Destruct before checking
|
||||||
V3Global::dumpCheckGlobalTree("slice", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
|
V3Global::dumpCheckGlobalTree("slice", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -183,8 +183,7 @@ public:
|
||||||
static bool followCyclic(const V3GraphEdge* edgep) {
|
static bool followCyclic(const V3GraphEdge* edgep) {
|
||||||
const SplitEdge* oedgep = dynamic_cast<const SplitEdge*>(edgep);
|
const SplitEdge* oedgep = dynamic_cast<const SplitEdge*>(edgep);
|
||||||
if (!oedgep) v3fatalSrc("Following edge of non-SplitEdge type");
|
if (!oedgep) v3fatalSrc("Following edge of non-SplitEdge type");
|
||||||
if (oedgep->ignoreThisStep()) return false;
|
return (!oedgep->ignoreThisStep());
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
virtual string dotStyle() const {
|
virtual string dotStyle() const {
|
||||||
return ignoreThisStep() ? "dotted" : V3GraphEdge::dotStyle();
|
return ignoreThisStep() ? "dotted" : V3GraphEdge::dotStyle();
|
||||||
|
|
@ -335,7 +334,7 @@ protected:
|
||||||
if (!vertexp->outBeginp()
|
if (!vertexp->outBeginp()
|
||||||
&& dynamic_cast<SplitVarStdVertex*>(vertexp)) {
|
&& dynamic_cast<SplitVarStdVertex*>(vertexp)) {
|
||||||
if (debug() >= 9) {
|
if (debug() >= 9) {
|
||||||
SplitVarStdVertex* stdp = (SplitVarStdVertex*)(vertexp);
|
SplitVarStdVertex* stdp = static_cast<SplitVarStdVertex*>(vertexp);
|
||||||
UINFO(0, "Will prune deps on var "<<stdp->nodep()<<endl);
|
UINFO(0, "Will prune deps on var "<<stdp->nodep()<<endl);
|
||||||
stdp->nodep()->dumpTree(cout, "- ");
|
stdp->nodep()->dumpTree(cout, "- ");
|
||||||
}
|
}
|
||||||
|
|
@ -388,10 +387,10 @@ protected:
|
||||||
|
|
||||||
// Create vertexes for variable
|
// Create vertexes for variable
|
||||||
if (!vscp->user1p()) {
|
if (!vscp->user1p()) {
|
||||||
SplitVarStdVertex* vstdp = new SplitVarStdVertex(&m_graph, vscp);
|
SplitVarStdVertex* vstdp = new SplitVarStdVertex(&m_graph, vscp);
|
||||||
vscp->user1p(vstdp);
|
vscp->user1p(vstdp);
|
||||||
}
|
}
|
||||||
SplitVarStdVertex* vstdp = (SplitVarStdVertex*) vscp->user1p();
|
SplitVarStdVertex* vstdp = reinterpret_cast<SplitVarStdVertex*>(vscp->user1p());
|
||||||
|
|
||||||
// SPEEDUP: We add duplicate edges, that should be fixed
|
// SPEEDUP: We add duplicate edges, that should be fixed
|
||||||
if (m_inDly && nodep->lvalue()) {
|
if (m_inDly && nodep->lvalue()) {
|
||||||
|
|
@ -402,7 +401,8 @@ protected:
|
||||||
vscp->user2p(vpostp);
|
vscp->user2p(vpostp);
|
||||||
new SplitPostEdge(&m_graph, vstdp, vpostp);
|
new SplitPostEdge(&m_graph, vstdp, vpostp);
|
||||||
}
|
}
|
||||||
SplitVarPostVertex* vpostp = (SplitVarPostVertex*)vscp->user2p();
|
SplitVarPostVertex* vpostp
|
||||||
|
= reinterpret_cast<SplitVarPostVertex*>(vscp->user2p());
|
||||||
// Add edges
|
// Add edges
|
||||||
for (VStack::iterator it = m_stmtStackps.begin(); it != m_stmtStackps.end(); ++it) {
|
for (VStack::iterator it = m_stmtStackps.begin(); it != m_stmtStackps.end(); ++it) {
|
||||||
new SplitLVEdge(&m_graph, vpostp, *it);
|
new SplitLVEdge(&m_graph, vpostp, *it);
|
||||||
|
|
@ -451,11 +451,9 @@ private:
|
||||||
class ReorderVisitor : public SplitReorderBaseVisitor {
|
class ReorderVisitor : public SplitReorderBaseVisitor {
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
public:
|
public:
|
||||||
explicit ReorderVisitor(AstNetlist* nodep)
|
explicit ReorderVisitor(AstNetlist* nodep) {
|
||||||
: SplitReorderBaseVisitor() {
|
iterate(nodep);
|
||||||
iterate(nodep);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~ReorderVisitor() {}
|
virtual ~ReorderVisitor() {}
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
|
|
@ -480,7 +478,7 @@ protected:
|
||||||
// Vertex::m_user begin: true indicates logic for this step
|
// Vertex::m_user begin: true indicates logic for this step
|
||||||
m_graph.userClearVertices();
|
m_graph.userClearVertices();
|
||||||
for (AstNode* nextp=nodep; nextp; nextp=nextp->nextp()) {
|
for (AstNode* nextp=nodep; nextp; nextp=nextp->nextp()) {
|
||||||
SplitLogicVertex* vvertexp = (SplitLogicVertex*)nextp->user3p();
|
SplitLogicVertex* vvertexp = reinterpret_cast<SplitLogicVertex*>(nextp->user3p());
|
||||||
vvertexp->user(true);
|
vvertexp->user(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -513,7 +511,7 @@ protected:
|
||||||
// Add hard orderings between all nodes of same color, in the order they appeared
|
// Add hard orderings between all nodes of same color, in the order they appeared
|
||||||
vl_unordered_map<uint32_t, SplitLogicVertex*> lastOfColor;
|
vl_unordered_map<uint32_t, SplitLogicVertex*> lastOfColor;
|
||||||
for (AstNode* nextp=nodep; nextp; nextp=nextp->nextp()) {
|
for (AstNode* nextp=nodep; nextp; nextp=nextp->nextp()) {
|
||||||
SplitLogicVertex* vvertexp = (SplitLogicVertex*)nextp->user3p();
|
SplitLogicVertex* vvertexp = reinterpret_cast<SplitLogicVertex*>(nextp->user3p());
|
||||||
uint32_t color = vvertexp->color();
|
uint32_t color = vvertexp->color();
|
||||||
if (!color) nextp->v3fatalSrc("No node color assigned");
|
if (!color) nextp->v3fatalSrc("No node color assigned");
|
||||||
if (lastOfColor[color]) {
|
if (lastOfColor[color]) {
|
||||||
|
|
@ -539,7 +537,7 @@ protected:
|
||||||
RankNodeMap rankMap;
|
RankNodeMap rankMap;
|
||||||
int currOrder = 0; // Existing sequence number of assignment
|
int currOrder = 0; // Existing sequence number of assignment
|
||||||
for (AstNode* nextp=nodep; nextp; nextp=nextp->nextp()) {
|
for (AstNode* nextp=nodep; nextp; nextp=nextp->nextp()) {
|
||||||
SplitLogicVertex* vvertexp = (SplitLogicVertex*)nextp->user3p();
|
SplitLogicVertex* vvertexp = reinterpret_cast<SplitLogicVertex*>(nextp->user3p());
|
||||||
rankMap.insert(make_pair(vvertexp->rank(), nextp));
|
rankMap.insert(make_pair(vvertexp->rank(), nextp));
|
||||||
nextp->user4(++currOrder); // Record current ordering
|
nextp->user4(++currOrder); // Record current ordering
|
||||||
}
|
}
|
||||||
|
|
@ -593,9 +591,11 @@ protected:
|
||||||
cleanupBlockGraph(nodep);
|
cleanupBlockGraph(nodep);
|
||||||
reorderBlock(nodep);
|
reorderBlock(nodep);
|
||||||
// Delete old vertexes and edges only applying to this block
|
// Delete old vertexes and edges only applying to this block
|
||||||
while (firstp->backp()->nextp()==firstp) firstp = firstp->backp(); // Walk back to first in list
|
// First, walk back to first in list
|
||||||
|
while (firstp->backp()->nextp()==firstp) firstp = firstp->backp();
|
||||||
for (AstNode* nextp=firstp; nextp; nextp=nextp->nextp()) {
|
for (AstNode* nextp=firstp; nextp; nextp=nextp->nextp()) {
|
||||||
SplitLogicVertex* vvertexp = (SplitLogicVertex*)nextp->user3p();
|
SplitLogicVertex* vvertexp
|
||||||
|
= reinterpret_cast<SplitLogicVertex*>(nextp->user3p());
|
||||||
vvertexp->unlinkDelete(&m_graph);
|
vvertexp->unlinkDelete(&m_graph);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -662,7 +662,7 @@ protected:
|
||||||
|
|
||||||
virtual void visit(AstNode* nodep) {
|
virtual void visit(AstNode* nodep) {
|
||||||
if (nodep->user3p()) {
|
if (nodep->user3p()) {
|
||||||
SplitLogicVertex* vertexp = (SplitLogicVertex*)(nodep->user3p());
|
SplitLogicVertex* vertexp = reinterpret_cast<SplitLogicVertex*>(nodep->user3p());
|
||||||
uint32_t color = vertexp->color();
|
uint32_t color = vertexp->color();
|
||||||
m_colors.insert(color);
|
m_colors.insert(color);
|
||||||
UINFO(8, " SVL " << vertexp << " has color " << color << "\n");
|
UINFO(8, " SVL " << vertexp << " has color " << color << "\n");
|
||||||
|
|
@ -754,7 +754,7 @@ protected:
|
||||||
if (!nodep->user3p()) nodep->v3fatalSrc("null user3p in V3Split leaf");
|
if (!nodep->user3p()) nodep->v3fatalSrc("null user3p in V3Split leaf");
|
||||||
|
|
||||||
// Clone the leaf into its new always block
|
// Clone the leaf into its new always block
|
||||||
SplitLogicVertex* vxp = (SplitLogicVertex*)(nodep->user3p());
|
SplitLogicVertex* vxp = reinterpret_cast<SplitLogicVertex*>(nodep->user3p());
|
||||||
uint32_t color = vxp->color();
|
uint32_t color = vxp->color();
|
||||||
AstNode* clonedp = nodep->cloneTree(false);
|
AstNode* clonedp = nodep->cloneTree(false);
|
||||||
m_addAfter[color]->addNextHere(clonedp);
|
m_addAfter[color]->addNextHere(clonedp);
|
||||||
|
|
@ -846,8 +846,7 @@ private:
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
public:
|
public:
|
||||||
explicit SplitVisitor(AstNetlist* nodep)
|
explicit SplitVisitor(AstNetlist* nodep)
|
||||||
: SplitReorderBaseVisitor()
|
: m_curIfConditional(NULL) {
|
||||||
, m_curIfConditional(NULL) {
|
|
||||||
iterate(nodep);
|
iterate(nodep);
|
||||||
|
|
||||||
// Splice newly-split blocks into the tree. Remove placeholders
|
// Splice newly-split blocks into the tree. Remove placeholders
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class StatsReport {
|
||||||
os<<endl;
|
os<<endl;
|
||||||
|
|
||||||
os<<"Information:"<<endl;
|
os<<"Information:"<<endl;
|
||||||
os<<" "<<v3Global.opt.version()<<endl;
|
os<<" "<<V3Options::version()<<endl;
|
||||||
os<<" Arguments: "<<v3Global.opt.allArgsString()<<endl;
|
os<<" Arguments: "<<v3Global.opt.allArgsString()<<endl;
|
||||||
os<<endl;
|
os<<endl;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,11 @@ inline bool VString::wildmatchi(const char* s, const char* p) {
|
||||||
else {
|
else {
|
||||||
// Trailing star matches everything.
|
// Trailing star matches everything.
|
||||||
if (!*++p) return true;
|
if (!*++p) return true;
|
||||||
while (wildmatch(s, p) == false)
|
while (!wildmatch(s, p)) {
|
||||||
if (*++s == '\0')
|
if (*++s == '\0') {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -59,9 +61,11 @@ bool VString::wildmatch(const char* s, const char* p) {
|
||||||
else {
|
else {
|
||||||
// Trailing star matches everything.
|
// Trailing star matches everything.
|
||||||
if (!*++p) return true;
|
if (!*++p) return true;
|
||||||
while (wildmatchi(s, p) == false)
|
while (!wildmatchi(s, p)) {
|
||||||
if (*++s == '\0')
|
if (*++s == '\0') {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -149,15 +153,15 @@ void VHashSha1::insert(const void* datap, size_t length) {
|
||||||
int chunkLen;
|
int chunkLen;
|
||||||
const uint8_t* chunkp;
|
const uint8_t* chunkp;
|
||||||
if (m_remainder=="") {
|
if (m_remainder=="") {
|
||||||
chunkLen = length;
|
chunkLen = length;
|
||||||
chunkp = (const uint8_t*)datap;
|
chunkp = static_cast<const uint8_t*>(datap);
|
||||||
} else {
|
} else {
|
||||||
// If there are large inserts it would be more efficient to avoid this copy
|
// If there are large inserts it would be more efficient to avoid this copy
|
||||||
// by copying bytes in the loop below from either m_remainder or the data
|
// by copying bytes in the loop below from either m_remainder or the data
|
||||||
// as appropriate.
|
// as appropriate.
|
||||||
tempData = m_remainder + string((const char*)datap,length);
|
tempData = m_remainder + string(static_cast<const char*>(datap), length);
|
||||||
chunkLen = tempData.length();
|
chunkLen = tempData.length();
|
||||||
chunkp = (const uint8_t*)tempData.data();
|
chunkp = reinterpret_cast<const uint8_t*>(tempData.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
// See wikipedia SHA-1 algorithm summary
|
// See wikipedia SHA-1 algorithm summary
|
||||||
|
|
@ -170,15 +174,15 @@ void VHashSha1::insert(const void* datap, size_t length) {
|
||||||
posEnd = posBegin + 64;
|
posEnd = posBegin + 64;
|
||||||
// 64 byte round input data, being careful to swap on big, keep on little
|
// 64 byte round input data, being careful to swap on big, keep on little
|
||||||
for (int roundByte = 0; posBegin < posEnd; posBegin += 4) {
|
for (int roundByte = 0; posBegin < posEnd; posBegin += 4) {
|
||||||
w[roundByte++] = ((uint32_t) chunkp[posBegin + 3]
|
w[roundByte++] = (static_cast<uint32_t>(chunkp[posBegin + 3])
|
||||||
| (((uint32_t) chunkp[posBegin + 2]) << 8)
|
| (static_cast<uint32_t>(chunkp[posBegin + 2]) << 8)
|
||||||
| (((uint32_t) chunkp[posBegin + 1]) << 16)
|
| (static_cast<uint32_t>(chunkp[posBegin + 1]) << 16)
|
||||||
| (((uint32_t) chunkp[posBegin]) << 24));
|
| (static_cast<uint32_t>(chunkp[posBegin]) << 24));
|
||||||
}
|
}
|
||||||
sha1Block(m_inthash, w);
|
sha1Block(m_inthash, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_remainder = string((const char*)(chunkp+posBegin), chunkLen-posEnd);
|
m_remainder = string(reinterpret_cast<const char*>(chunkp+posBegin), chunkLen-posEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VHashSha1::finalize() {
|
void VHashSha1::finalize() {
|
||||||
|
|
@ -192,7 +196,8 @@ void VHashSha1::finalize() {
|
||||||
for (int i=0; i<16; ++i) w[i] = 0;
|
for (int i=0; i<16; ++i) w[i] = 0;
|
||||||
size_t blockPos = 0;
|
size_t blockPos = 0;
|
||||||
for (; blockPos < m_remainder.length(); ++blockPos) {
|
for (; blockPos < m_remainder.length(); ++blockPos) {
|
||||||
w[blockPos >> 2] |= ((uint32_t) m_remainder[blockPos]) << ((3 - (blockPos & 3)) << 3);
|
w[blockPos >> 2] |= ((static_cast<uint32_t>(m_remainder[blockPos]))
|
||||||
|
<< ((3 - (blockPos & 3)) << 3));
|
||||||
}
|
}
|
||||||
w[blockPos >> 2] |= 0x80 << ((3 - (blockPos & 3)) << 3);
|
w[blockPos >> 2] |= 0x80 << ((3 - (blockPos & 3)) << 3);
|
||||||
if (m_remainder.length() >= 56) {
|
if (m_remainder.length() >= 56) {
|
||||||
|
|
@ -248,9 +253,9 @@ string VHashSha1::digestSymbol() {
|
||||||
for (; pos < (160/8) - 2; pos += 3) {
|
for (; pos < (160/8) - 2; pos += 3) {
|
||||||
out += digits[((binhash[pos] >> 2) & 0x3f)];
|
out += digits[((binhash[pos] >> 2) & 0x3f)];
|
||||||
out += digits[((binhash[pos] & 0x3) << 4)
|
out += digits[((binhash[pos] & 0x3) << 4)
|
||||||
| ((int) (binhash[pos + 1] & 0xf0) >> 4)];
|
| (static_cast<int>(binhash[pos + 1] & 0xf0) >> 4)];
|
||||||
out += digits[((binhash[pos + 1] & 0xf) << 2)
|
out += digits[((binhash[pos + 1] & 0xf) << 2)
|
||||||
| ((int) (binhash[pos + 2] & 0xc0) >> 6)];
|
| (static_cast<int>(binhash[pos + 2] & 0xc0) >> 6)];
|
||||||
out += digits[((binhash[pos + 2] & 0x3f))];
|
out += digits[((binhash[pos + 2] & 0x3f))];
|
||||||
}
|
}
|
||||||
if (0) { // Not needed for 160 bit hash
|
if (0) { // Not needed for 160 bit hash
|
||||||
|
|
@ -260,7 +265,7 @@ string VHashSha1::digestSymbol() {
|
||||||
else {
|
else {
|
||||||
out += digits[((binhash[pos] >> 2) & 0x3f)];
|
out += digits[((binhash[pos] >> 2) & 0x3f)];
|
||||||
out += digits[((binhash[pos] & 0x3) << 4)
|
out += digits[((binhash[pos] & 0x3) << 4)
|
||||||
| ((int) (binhash[pos + 1] & 0xf0) >> 4)];
|
| (static_cast<int>(binhash[pos + 1] & 0xf0) >> 4)];
|
||||||
out += digits[((binhash[pos + 1] & 0xf) << 2)];
|
out += digits[((binhash[pos + 1] & 0xf) << 2)];
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,6 @@ public:
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
explicit SubstVarEntry(AstVar* varp) { // Construction for when a var is used
|
explicit SubstVarEntry(AstVar* varp) { // Construction for when a var is used
|
||||||
m_varp = varp;
|
m_varp = varp;
|
||||||
m_whole.m_use = false;
|
|
||||||
m_wordAssign = false;
|
m_wordAssign = false;
|
||||||
m_wordUse = false;
|
m_wordUse = false;
|
||||||
m_words.resize(varp->widthWords());
|
m_words.resize(varp->widthWords());
|
||||||
|
|
@ -116,11 +115,11 @@ public:
|
||||||
m_words[word].m_step = step;
|
m_words[word].m_step = step;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void assignWordComplex(int step, int word) {
|
void assignWordComplex(int word) {
|
||||||
if (!wordNumOk(word) || getWordAssignp(word) || m_words[word].m_complex) m_whole.m_complex = true;
|
if (!wordNumOk(word) || getWordAssignp(word) || m_words[word].m_complex) m_whole.m_complex = true;
|
||||||
m_words[word].m_complex = true;
|
m_words[word].m_complex = true;
|
||||||
}
|
}
|
||||||
void assignComplex(int step) {
|
void assignComplex() {
|
||||||
m_whole.m_complex = true;
|
m_whole.m_complex = true;
|
||||||
}
|
}
|
||||||
void consumeWhole() { //==consumeComplex as we don't know the difference
|
void consumeWhole() { //==consumeComplex as we don't know the difference
|
||||||
|
|
@ -187,7 +186,7 @@ private:
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
SubstVarEntry* findEntryp(AstVarRef* nodep) {
|
SubstVarEntry* findEntryp(AstVarRef* nodep) {
|
||||||
return (SubstVarEntry*)(nodep->varp()->user1p()); // Might be NULL
|
return reinterpret_cast<SubstVarEntry*>(nodep->varp()->user1p()); // Might be NULL
|
||||||
}
|
}
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstVarRef* nodep) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
|
|
@ -249,7 +248,7 @@ private:
|
||||||
nodep->varp()->user1p(entryp);
|
nodep->varp()->user1p(entryp);
|
||||||
return entryp;
|
return entryp;
|
||||||
} else {
|
} else {
|
||||||
SubstVarEntry* entryp = (SubstVarEntry*)(nodep->varp()->user1p());
|
SubstVarEntry* entryp = reinterpret_cast<SubstVarEntry*>(nodep->varp()->user1p());
|
||||||
return entryp;
|
return entryp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -269,7 +268,7 @@ private:
|
||||||
hit = true;
|
hit = true;
|
||||||
if (m_ops > SUBST_MAX_OPS_SUBST) {
|
if (m_ops > SUBST_MAX_OPS_SUBST) {
|
||||||
UINFO(8," ASSIGNtooDeep "<<varrefp<<endl);
|
UINFO(8," ASSIGNtooDeep "<<varrefp<<endl);
|
||||||
entryp->assignComplex(m_assignStep);
|
entryp->assignComplex();
|
||||||
} else {
|
} else {
|
||||||
UINFO(8," ASSIGNwhole "<<varrefp<<endl);
|
UINFO(8," ASSIGNwhole "<<varrefp<<endl);
|
||||||
entryp->assignWhole(m_assignStep, nodep);
|
entryp->assignWhole(m_assignStep, nodep);
|
||||||
|
|
@ -285,7 +284,7 @@ private:
|
||||||
hit = true;
|
hit = true;
|
||||||
if (m_ops > SUBST_MAX_OPS_SUBST) {
|
if (m_ops > SUBST_MAX_OPS_SUBST) {
|
||||||
UINFO(8," ASSIGNtooDeep "<<varrefp<<endl);
|
UINFO(8," ASSIGNtooDeep "<<varrefp<<endl);
|
||||||
entryp->assignWordComplex(m_assignStep, word);
|
entryp->assignWordComplex(word);
|
||||||
} else {
|
} else {
|
||||||
UINFO(8," ASSIGNword"<<word<<" "<<varrefp<<endl);
|
UINFO(8," ASSIGNword"<<word<<" "<<varrefp<<endl);
|
||||||
entryp->assignWord(m_assignStep, word, nodep);
|
entryp->assignWord(m_assignStep, word, nodep);
|
||||||
|
|
@ -346,7 +345,7 @@ private:
|
||||||
SubstVarEntry* entryp = getEntryp(nodep);
|
SubstVarEntry* entryp = getEntryp(nodep);
|
||||||
if (nodep->lvalue()) {
|
if (nodep->lvalue()) {
|
||||||
UINFO(8," ASSIGNcpx "<<nodep<<endl);
|
UINFO(8," ASSIGNcpx "<<nodep<<endl);
|
||||||
entryp->assignComplex(m_assignStep);
|
entryp->assignComplex();
|
||||||
} else if (AstNode* substp = entryp->substWhole(nodep)) {
|
} else if (AstNode* substp = entryp->substWhole(nodep)) {
|
||||||
// Check that the RHS hasn't changed value since we recorded it.
|
// Check that the RHS hasn't changed value since we recorded it.
|
||||||
SubstUseVisitor visitor (substp, entryp->getWholeStep());
|
SubstUseVisitor visitor (substp, entryp->getWholeStep());
|
||||||
|
|
|
||||||
|
|
@ -430,7 +430,7 @@ void V3TSP::tspSort(const V3TSP::StateVec& states, V3TSP::StateVec* resultp) {
|
||||||
// Make this TSP implementation work for graphs of size 0 or 1
|
// Make this TSP implementation work for graphs of size 0 or 1
|
||||||
// which, unfortunately, is a special case as the following
|
// which, unfortunately, is a special case as the following
|
||||||
// code assumes >= 2 nodes.
|
// code assumes >= 2 nodes.
|
||||||
if (states.size() == 0) {
|
if (states.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (states.size() == 1) {
|
if (states.size() == 1) {
|
||||||
|
|
@ -550,7 +550,7 @@ public:
|
||||||
unsigned xabs, yabs;
|
unsigned xabs, yabs;
|
||||||
xabs = diff(otherp->m_xpos, m_xpos);
|
xabs = diff(otherp->m_xpos, m_xpos);
|
||||||
yabs = diff(otherp->m_ypos, m_ypos);
|
yabs = diff(otherp->m_ypos, m_ypos);
|
||||||
return (int)(0.5 + sqrt(xabs*xabs + yabs*yabs));
|
return lround(sqrt(xabs*xabs + yabs*yabs));
|
||||||
}
|
}
|
||||||
unsigned xpos() const {
|
unsigned xpos() const {
|
||||||
return m_xpos;
|
return m_xpos;
|
||||||
|
|
|
||||||
|
|
@ -119,8 +119,8 @@ private:
|
||||||
// Calc data storage in bytes
|
// Calc data storage in bytes
|
||||||
size_t chgWidth = m_outVarps.size(); // Width of one change-it-vector
|
size_t chgWidth = m_outVarps.size(); // Width of one change-it-vector
|
||||||
if (chgWidth<8) chgWidth = 8;
|
if (chgWidth<8) chgWidth = 8;
|
||||||
double space = (pow((double)2,((double)(m_inWidth)))
|
double space = (pow(static_cast<double>(2.0), static_cast<double>(m_inWidth))
|
||||||
*(double)(m_outWidth+chgWidth));
|
* static_cast<double>(m_outWidth + chgWidth));
|
||||||
// Instruction count bytes (ok, it's space also not time :)
|
// Instruction count bytes (ok, it's space also not time :)
|
||||||
double bytesPerInst = 4;
|
double bytesPerInst = 4;
|
||||||
double time = (chkvis.instrCount()*bytesPerInst + chkvis.dataCount()) + 1; // +1 so won't div by zero
|
double time = (chkvis.instrCount()*bytesPerInst + chkvis.dataCount()) + 1; // +1 so won't div by zero
|
||||||
|
|
@ -377,9 +377,10 @@ private:
|
||||||
AstNode* arhsp = new AstArraySel(nodep->fileline(),
|
AstNode* arhsp = new AstArraySel(nodep->fileline(),
|
||||||
new AstVarRef(nodep->fileline(), m_tableVarps[outnum], false),
|
new AstVarRef(nodep->fileline(), m_tableVarps[outnum], false),
|
||||||
new AstVarRef(nodep->fileline(), indexVscp, false));
|
new AstVarRef(nodep->fileline(), indexVscp, false));
|
||||||
AstNode* outasnp = (m_assignDly
|
AstNode* outasnp
|
||||||
? (AstNode*)(new AstAssignDly(nodep->fileline(), alhsp, arhsp))
|
= (m_assignDly
|
||||||
: (AstNode*)(new AstAssign(nodep->fileline(), alhsp, arhsp)));
|
? static_cast<AstNode*>(new AstAssignDly(nodep->fileline(), alhsp, arhsp))
|
||||||
|
: static_cast<AstNode*>(new AstAssign(nodep->fileline(), alhsp, arhsp)));
|
||||||
AstNode* outsetp = outasnp;
|
AstNode* outsetp = outasnp;
|
||||||
|
|
||||||
// Is the value set in only some branches of the table?
|
// Is the value set in only some branches of the table?
|
||||||
|
|
|
||||||
|
|
@ -767,7 +767,7 @@ private:
|
||||||
string stmt = "return "+rtnvarp->name()+";\n";
|
string stmt = "return "+rtnvarp->name()+";\n";
|
||||||
dpip->addStmtsp(new AstCStmt(nodep->fileline(), stmt));
|
dpip->addStmtsp(new AstCStmt(nodep->fileline(), stmt));
|
||||||
}
|
}
|
||||||
makePortList(nodep, rtnvarp, dpip);
|
makePortList(nodep, dpip);
|
||||||
}
|
}
|
||||||
|
|
||||||
void makeDpiImportProto(AstNodeFTask* nodep, AstVar* rtnvarp) {
|
void makeDpiImportProto(AstNodeFTask* nodep, AstVar* rtnvarp) {
|
||||||
|
|
@ -789,7 +789,7 @@ private:
|
||||||
dpip->dpiImport(true);
|
dpip->dpiImport(true);
|
||||||
// Add DPI reference to top, since it's a global function
|
// Add DPI reference to top, since it's a global function
|
||||||
m_topScopep->scopep()->addActivep(dpip);
|
m_topScopep->scopep()->addActivep(dpip);
|
||||||
makePortList(nodep, rtnvarp, dpip);
|
makePortList(nodep, dpip);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool duplicatedDpiProto(AstNodeFTask* nodep, const string& dpiproto) {
|
bool duplicatedDpiProto(AstNodeFTask* nodep, const string& dpiproto) {
|
||||||
|
|
@ -811,7 +811,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void makePortList(AstNodeFTask* nodep, AstVar* rtnvarp, AstCFunc* dpip) {
|
void makePortList(AstNodeFTask* nodep, AstCFunc* dpip) {
|
||||||
// Copy nodep's list of function I/O to the new dpip c function
|
// Copy nodep's list of function I/O to the new dpip c function
|
||||||
for (AstNode* stmtp = nodep->stmtsp(); stmtp; stmtp=stmtp->nextp()) {
|
for (AstNode* stmtp = nodep->stmtsp(); stmtp; stmtp=stmtp->nextp()) {
|
||||||
if (AstVar* portp = VN_CAST(stmtp, Var)) {
|
if (AstVar* portp = VN_CAST(stmtp, Var)) {
|
||||||
|
|
@ -963,7 +963,7 @@ private:
|
||||||
rtnvarp->user2p(rtnvscp);
|
rtnvarp->user2p(rtnvscp);
|
||||||
}
|
}
|
||||||
|
|
||||||
string prefix = "";
|
string prefix;
|
||||||
if (nodep->dpiImport()) prefix = "__Vdpiimwrap_";
|
if (nodep->dpiImport()) prefix = "__Vdpiimwrap_";
|
||||||
else if (nodep->dpiExport()) prefix = "__Vdpiexp_";
|
else if (nodep->dpiExport()) prefix = "__Vdpiexp_";
|
||||||
else if (ftaskNoInline) prefix = "__VnoInFunc_";
|
else if (ftaskNoInline) prefix = "__VnoInFunc_";
|
||||||
|
|
@ -1292,7 +1292,7 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp)
|
||||||
for (AstNode* stmtp = taskStmtsp; stmtp; stmtp=stmtp->nextp()) {
|
for (AstNode* stmtp = taskStmtsp; stmtp; stmtp=stmtp->nextp()) {
|
||||||
if (AstVar* portp = VN_CAST(stmtp, Var)) {
|
if (AstVar* portp = VN_CAST(stmtp, Var)) {
|
||||||
if (portp->isIO()) {
|
if (portp->isIO()) {
|
||||||
tconnects.push_back(make_pair(portp, (AstArg*)NULL));
|
tconnects.push_back(make_pair(portp, static_cast<AstArg*>(NULL)));
|
||||||
nameToIndex.insert(make_pair(portp->name(), tpinnum)); // For name based connections
|
nameToIndex.insert(make_pair(portp->name(), tpinnum)); // For name based connections
|
||||||
tpinnum++;
|
tpinnum++;
|
||||||
if (portp->attrSFormat()) {
|
if (portp->attrSFormat()) {
|
||||||
|
|
@ -1330,7 +1330,7 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp)
|
||||||
} else { // By pin number
|
} else { // By pin number
|
||||||
if (ppinnum >= tpinnum) {
|
if (ppinnum >= tpinnum) {
|
||||||
if (sformatp) {
|
if (sformatp) {
|
||||||
tconnects.push_back(make_pair(sformatp, (AstArg*)NULL));
|
tconnects.push_back(make_pair(sformatp, static_cast<AstArg*>(NULL)));
|
||||||
tconnects[ppinnum].second = argp;
|
tconnects[ppinnum].second = argp;
|
||||||
tpinnum++;
|
tpinnum++;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ private:
|
||||||
}
|
}
|
||||||
else if (!v3Global.opt.traceUnderscore()) {
|
else if (!v3Global.opt.traceUnderscore()) {
|
||||||
string prettyName = varp->prettyName();
|
string prettyName = varp->prettyName();
|
||||||
if (prettyName.size()>=1 && prettyName[0] == '_')
|
if (!prettyName.empty() && prettyName[0] == '_')
|
||||||
return "Leading underscore";
|
return "Leading underscore";
|
||||||
if (prettyName.find("._") != string::npos)
|
if (prettyName.find("._") != string::npos)
|
||||||
return "Inlined leading underscore";
|
return "Inlined leading underscore";
|
||||||
|
|
@ -192,7 +192,7 @@ private:
|
||||||
virtual void visit(AstUnpackArrayDType* nodep) {
|
virtual void visit(AstUnpackArrayDType* nodep) {
|
||||||
// Note more specific dtypes above
|
// Note more specific dtypes above
|
||||||
if (m_traVscp) {
|
if (m_traVscp) {
|
||||||
if ((int)nodep->arrayUnpackedElements() > v3Global.opt.traceMaxArray()) {
|
if (static_cast<int>(nodep->arrayUnpackedElements()) > v3Global.opt.traceMaxArray()) {
|
||||||
addIgnore("Wide memory > --trace-max-array ents");
|
addIgnore("Wide memory > --trace-max-array ents");
|
||||||
} else if (VN_IS(nodep->subDTypep()->skipRefp(), BasicDType) // Nothing lower than this array
|
} else if (VN_IS(nodep->subDTypep()->skipRefp(), BasicDType) // Nothing lower than this array
|
||||||
&& m_traVscp->dtypep()->skipRefp() == nodep) { // Nothing above this array
|
&& m_traVscp->dtypep()->skipRefp() == nodep) { // Nothing above this array
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ private:
|
||||||
VL_DEBUG_FUNC; // Declare debug()
|
VL_DEBUG_FUNC; // Declare debug()
|
||||||
|
|
||||||
TristateVertex* makeVertex(AstNode* nodep) {
|
TristateVertex* makeVertex(AstNode* nodep) {
|
||||||
TristateVertex* vertexp = (TristateVertex*)(nodep->user5p());
|
TristateVertex* vertexp = reinterpret_cast<TristateVertex*>(nodep->user5p());
|
||||||
if (!vertexp) {
|
if (!vertexp) {
|
||||||
UINFO(6," New vertex "<<nodep<<endl);
|
UINFO(6," New vertex "<<nodep<<endl);
|
||||||
vertexp = new TristateVertex(&m_graph, nodep);
|
vertexp = new TristateVertex(&m_graph, nodep);
|
||||||
|
|
@ -224,10 +224,10 @@ public:
|
||||||
//if (debug()>=9) m_graph.dumpDotFilePrefixed("tri_pre__"+nodep->name());
|
//if (debug()>=9) m_graph.dumpDotFilePrefixed("tri_pre__"+nodep->name());
|
||||||
UINFO(9," Walking "<<nodep<<endl);
|
UINFO(9," Walking "<<nodep<<endl);
|
||||||
for (V3GraphVertex* itp = m_graph.verticesBeginp(); itp; itp=itp->verticesNextp()) {
|
for (V3GraphVertex* itp = m_graph.verticesBeginp(); itp; itp=itp->verticesNextp()) {
|
||||||
graphWalkRecurseFwd((TristateVertex*)itp, 0);
|
graphWalkRecurseFwd(static_cast<TristateVertex*>(itp), 0);
|
||||||
}
|
}
|
||||||
for (V3GraphVertex* itp = m_graph.verticesBeginp(); itp; itp=itp->verticesNextp()) {
|
for (V3GraphVertex* itp = m_graph.verticesBeginp(); itp; itp=itp->verticesNextp()) {
|
||||||
graphWalkRecurseBack((TristateVertex*)itp, 0);
|
graphWalkRecurseBack(static_cast<TristateVertex*>(itp), 0);
|
||||||
}
|
}
|
||||||
if (debug()>=9) m_graph.dumpDotFilePrefixed("tri_pos__"+nodep->name());
|
if (debug()>=9) m_graph.dumpDotFilePrefixed("tri_pos__"+nodep->name());
|
||||||
}
|
}
|
||||||
|
|
@ -238,15 +238,15 @@ public:
|
||||||
new V3GraphEdge(&m_graph, makeVertex(fromp), makeVertex(top), 1);
|
new V3GraphEdge(&m_graph, makeVertex(fromp), makeVertex(top), 1);
|
||||||
}
|
}
|
||||||
bool isTristate(AstNode* nodep) {
|
bool isTristate(AstNode* nodep) {
|
||||||
TristateVertex* vertexp = (TristateVertex*)(nodep->user5p());
|
TristateVertex* vertexp = reinterpret_cast<TristateVertex*>(nodep->user5p());
|
||||||
return vertexp && vertexp->isTristate();
|
return vertexp && vertexp->isTristate();
|
||||||
}
|
}
|
||||||
bool feedsTri(AstNode* nodep) {
|
bool feedsTri(AstNode* nodep) {
|
||||||
TristateVertex* vertexp = (TristateVertex*)(nodep->user5p());
|
TristateVertex* vertexp = reinterpret_cast<TristateVertex*>(nodep->user5p());
|
||||||
return vertexp && vertexp->feedsTri();
|
return vertexp && vertexp->feedsTri();
|
||||||
}
|
}
|
||||||
void didProcess(AstNode* nodep) {
|
void didProcess(AstNode* nodep) {
|
||||||
TristateVertex* vertexp = (TristateVertex*)(nodep->user5p());
|
TristateVertex* vertexp = reinterpret_cast<TristateVertex*>(nodep->user5p());
|
||||||
if (!vertexp) {
|
if (!vertexp) {
|
||||||
// Not v3errorSrc as no reason to stop the world
|
// Not v3errorSrc as no reason to stop the world
|
||||||
nodep->v3error("Unsupported tristate construct (not in propagation graph): "<<nodep->prettyTypeName());
|
nodep->v3error("Unsupported tristate construct (not in propagation graph): "<<nodep->prettyTypeName());
|
||||||
|
|
@ -441,7 +441,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPullDirection(AstVar* varp, AstPull* pullp) {
|
void setPullDirection(AstVar* varp, AstPull* pullp) {
|
||||||
AstPull* oldpullp = (AstPull*)varp->user3p();
|
AstPull* oldpullp = static_cast<AstPull*>(varp->user3p());
|
||||||
if (!oldpullp) {
|
if (!oldpullp) {
|
||||||
varp->user3p(pullp); //save off to indicate the pull direction
|
varp->user3p(pullp); //save off to indicate the pull direction
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -599,7 +599,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
// This is the final resolution of the tristate, so we apply
|
// This is the final resolution of the tristate, so we apply
|
||||||
// the pull direction to any undriven pins.
|
// the pull direction to any undriven pins.
|
||||||
V3Number pull(invarp->fileline(), lhsp->width());
|
V3Number pull(invarp->fileline(), lhsp->width());
|
||||||
AstPull* pullp = (AstPull*)lhsp->user3p();
|
AstPull* pullp = static_cast<AstPull*>(lhsp->user3p());
|
||||||
if (pullp && pullp->direction() == 1) {
|
if (pullp && pullp->direction() == 1) {
|
||||||
pull.setAllBits1();
|
pull.setAllBits1();
|
||||||
UINFO(9,"Has pullup "<<pullp<<endl);
|
UINFO(9,"Has pullup "<<pullp<<endl);
|
||||||
|
|
@ -1054,7 +1054,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
if (nodep->user2() & U2_GRAPHING) return; // This pin is already expanded
|
if (nodep->user2() & U2_GRAPHING) return; // This pin is already expanded
|
||||||
nodep->user2(U2_GRAPHING);
|
nodep->user2(U2_GRAPHING);
|
||||||
// Find child module's new variables.
|
// Find child module's new variables.
|
||||||
AstVar* enModVarp = (AstVar*) nodep->modVarp()->user1p();
|
AstVar* enModVarp = static_cast<AstVar*>(nodep->modVarp()->user1p());
|
||||||
if (!enModVarp) {
|
if (!enModVarp) {
|
||||||
if (nodep->exprp()) {
|
if (nodep->exprp()) {
|
||||||
// May have an output only that later connects to a tristate, so simplify now.
|
// May have an output only that later connects to a tristate, so simplify now.
|
||||||
|
|
@ -1116,7 +1116,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
// Create new output pin
|
// Create new output pin
|
||||||
AstAssignW* outAssignp = NULL; // If reconnected, the related assignment
|
AstAssignW* outAssignp = NULL; // If reconnected, the related assignment
|
||||||
AstPin* outpinp = NULL;
|
AstPin* outpinp = NULL;
|
||||||
AstVar* outModVarp = (AstVar*) nodep->modVarp()->user4p();
|
AstVar* outModVarp = static_cast<AstVar*>(nodep->modVarp()->user4p());
|
||||||
if (!outModVarp) {
|
if (!outModVarp) {
|
||||||
// At top, no need for __out as might be input only. Otherwise resolvable.
|
// At top, no need for __out as might be input only. Otherwise resolvable.
|
||||||
if (!m_modp->isTop()) nodep->v3fatalSrc("Unlinked");
|
if (!m_modp->isTop()) nodep->v3fatalSrc("Unlinked");
|
||||||
|
|
@ -1176,7 +1176,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
|
|
||||||
// Propagate any pullups/pulldowns upwards if necessary
|
// Propagate any pullups/pulldowns upwards if necessary
|
||||||
if (exprrefp) {
|
if (exprrefp) {
|
||||||
if (AstPull* pullp = (AstPull*) nodep->modVarp()->user3p()) {
|
if (AstPull* pullp = static_cast<AstPull*>(nodep->modVarp()->user3p())) {
|
||||||
UINFO(9, "propagate pull on "<<exprrefp<<endl);
|
UINFO(9, "propagate pull on "<<exprrefp<<endl);
|
||||||
setPullDirection(exprrefp->varp(), pullp);
|
setPullDirection(exprrefp->varp(), pullp);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// METHODS
|
// METHODS
|
||||||
inline bool bitNumOk(int bit) const { return bit>=0 && (bit*FLAGS_PER_BIT < (int)m_flags.size()); }
|
inline bool bitNumOk(int bit) const { return bit>=0
|
||||||
|
&& (bit*FLAGS_PER_BIT < static_cast<int>(m_flags.size())); }
|
||||||
inline bool usedFlag(int bit) const { return m_usedWhole || m_flags[bit*FLAGS_PER_BIT + FLAG_USED]; }
|
inline bool usedFlag(int bit) const { return m_usedWhole || m_flags[bit*FLAGS_PER_BIT + FLAG_USED]; }
|
||||||
inline bool drivenFlag(int bit) const { return m_drivenWhole || m_flags[bit*FLAGS_PER_BIT + FLAG_DRIVEN]; }
|
inline bool drivenFlag(int bit) const { return m_drivenWhole || m_flags[bit*FLAGS_PER_BIT + FLAG_DRIVEN]; }
|
||||||
enum BitNamesWhich { BN_UNUSED, BN_UNDRIVEN, BN_BOTH };
|
enum BitNamesWhich { BN_UNUSED, BN_UNDRIVEN, BN_BOTH };
|
||||||
|
|
@ -248,7 +249,8 @@ private:
|
||||||
else nodep->v3fatalSrc("Bad case");
|
else nodep->v3fatalSrc("Bad case");
|
||||||
return entryp;
|
return entryp;
|
||||||
} else {
|
} else {
|
||||||
UndrivenVarEntry* entryp = (UndrivenVarEntry*)(which_user==1 ? nodep->user1p() : nodep->user2p());
|
UndrivenVarEntry* entryp = reinterpret_cast<UndrivenVarEntry*>
|
||||||
|
(which_user==1 ? nodep->user1p() : nodep->user2p());
|
||||||
return entryp;
|
return entryp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -190,9 +190,9 @@ private:
|
||||||
lhsp->deleteTree(); VL_DANGLING(lhsp);
|
lhsp->deleteTree(); VL_DANGLING(lhsp);
|
||||||
rhsp->deleteTree(); VL_DANGLING(rhsp);
|
rhsp->deleteTree(); VL_DANGLING(rhsp);
|
||||||
} else {
|
} else {
|
||||||
if (VN_IS(nodep, EqCase))
|
if (VN_IS(nodep, EqCase)) {
|
||||||
newp = new AstEq(nodep->fileline(), lhsp, rhsp);
|
newp = new AstEq(nodep->fileline(), lhsp, rhsp);
|
||||||
else newp = new AstNeq(nodep->fileline(), lhsp, rhsp);
|
} else { newp = new AstNeq(nodep->fileline(), lhsp, rhsp); }
|
||||||
}
|
}
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
|
|
@ -225,9 +225,9 @@ private:
|
||||||
AstNode* and1p = new AstAnd(nodep->fileline(), lhsp,
|
AstNode* and1p = new AstAnd(nodep->fileline(), lhsp,
|
||||||
new AstConst(nodep->fileline(), nummask));
|
new AstConst(nodep->fileline(), nummask));
|
||||||
AstNode* and2p = new AstConst(nodep->fileline(), numval);
|
AstNode* and2p = new AstConst(nodep->fileline(), numval);
|
||||||
if (VN_IS(nodep, EqWild))
|
if (VN_IS(nodep, EqWild)) {
|
||||||
newp = new AstEq(nodep->fileline(), and1p, and2p);
|
newp = new AstEq(nodep->fileline(), and1p, and2p);
|
||||||
else newp = new AstNeq(nodep->fileline(), and1p, and2p);
|
} else { newp = new AstNeq(nodep->fileline(), and1p, and2p); }
|
||||||
rhsp->deleteTree(); VL_DANGLING(rhsp);
|
rhsp->deleteTree(); VL_DANGLING(rhsp);
|
||||||
}
|
}
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,9 @@
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|
||||||
enum Stage { PRELIM=1,FINAL=2,BOTH=3 }; // Numbers are a bitmask <0>=prelim, <1>=final
|
enum Stage { PRELIM=1,FINAL=2,BOTH=3 }; // Numbers are a bitmask <0>=prelim, <1>=final
|
||||||
std::ostream& operator<<(std::ostream& str, const Stage& rhs) { return str<<("-PFB"[(int)rhs]); }
|
std::ostream& operator<<(std::ostream& str, const Stage& rhs) {
|
||||||
|
return str<<("-PFB"[static_cast<int>(rhs)]);
|
||||||
|
}
|
||||||
|
|
||||||
enum Determ {
|
enum Determ {
|
||||||
SELF, // Self-determined
|
SELF, // Self-determined
|
||||||
|
|
@ -1644,9 +1646,9 @@ private:
|
||||||
for (int i = 0; i < arrayType->elementsConst(); ++i) {
|
for (int i = 0; i < arrayType->elementsConst(); ++i) {
|
||||||
AstNode* arrayRef = nodep->fromp()->cloneTree(false);
|
AstNode* arrayRef = nodep->fromp()->cloneTree(false);
|
||||||
AstNode* selector = new AstArraySel(fl, arrayRef, i);
|
AstNode* selector = new AstArraySel(fl, arrayRef, i);
|
||||||
if (!newp)
|
if (!newp) {
|
||||||
newp = selector;
|
newp = selector;
|
||||||
else {
|
} else {
|
||||||
switch (methodId) {
|
switch (methodId) {
|
||||||
case ARRAY_OR: newp = new AstOr(fl, newp, selector); break;
|
case ARRAY_OR: newp = new AstOr(fl, newp, selector); break;
|
||||||
case ARRAY_AND: newp = new AstAnd(fl, newp, selector); break;
|
case ARRAY_AND: newp = new AstAnd(fl, newp, selector); break;
|
||||||
|
|
|
||||||
|
|
@ -69,11 +69,11 @@ private:
|
||||||
AstNode* m_errp; // Node that was found, for error reporting if not known type
|
AstNode* m_errp; // Node that was found, for error reporting if not known type
|
||||||
AstNodeDType* m_dtypep; // Data type for the 'from' slice
|
AstNodeDType* m_dtypep; // Data type for the 'from' slice
|
||||||
VNumRange m_fromRange; // Numeric range bounds for the 'from' slice
|
VNumRange m_fromRange; // Numeric range bounds for the 'from' slice
|
||||||
FromData(AstNode* errp, AstNodeDType* dtypep, VNumRange fromRange)
|
FromData(AstNode* errp, AstNodeDType* dtypep, const VNumRange& fromRange)
|
||||||
{ m_errp=errp; m_dtypep=dtypep; m_fromRange=fromRange; }
|
{ m_errp=errp; m_dtypep=dtypep; m_fromRange=fromRange; }
|
||||||
~FromData() {}
|
~FromData() {}
|
||||||
};
|
};
|
||||||
FromData fromDataForArray(AstNode* nodep, AstNode* basefromp, bool rangedSelect) {
|
FromData fromDataForArray(AstNode* nodep, AstNode* basefromp) {
|
||||||
// What is the data type and information for this SEL-ish's from()?
|
// What is the data type and information for this SEL-ish's from()?
|
||||||
UINFO(9," fromData start ddtypep = "<<basefromp<<endl);
|
UINFO(9," fromData start ddtypep = "<<basefromp<<endl);
|
||||||
VNumRange fromRange; // constructs to isRanged(false)
|
VNumRange fromRange; // constructs to isRanged(false)
|
||||||
|
|
@ -198,7 +198,7 @@ private:
|
||||||
AstNode* fromp = nodep->lhsp()->unlinkFrBack();
|
AstNode* fromp = nodep->lhsp()->unlinkFrBack();
|
||||||
AstNode* rhsp = nodep->rhsp()->unlinkFrBack(); // bit we're extracting
|
AstNode* rhsp = nodep->rhsp()->unlinkFrBack(); // bit we're extracting
|
||||||
if (debug()>=9) nodep->dumpTree(cout,"--SELBT2: ");
|
if (debug()>=9) nodep->dumpTree(cout,"--SELBT2: ");
|
||||||
FromData fromdata = fromDataForArray(nodep, fromp, false);
|
FromData fromdata = fromDataForArray(nodep, fromp);
|
||||||
AstNodeDType* ddtypep = fromdata.m_dtypep;
|
AstNodeDType* ddtypep = fromdata.m_dtypep;
|
||||||
VNumRange fromRange = fromdata.m_fromRange;
|
VNumRange fromRange = fromdata.m_fromRange;
|
||||||
UINFO(6," ddtypep "<<ddtypep<<endl);
|
UINFO(6," ddtypep "<<ddtypep<<endl);
|
||||||
|
|
@ -290,7 +290,7 @@ private:
|
||||||
vlsint32_t msb = VN_CAST(msbp, Const)->toSInt();
|
vlsint32_t msb = VN_CAST(msbp, Const)->toSInt();
|
||||||
vlsint32_t lsb = VN_CAST(lsbp, Const)->toSInt();
|
vlsint32_t lsb = VN_CAST(lsbp, Const)->toSInt();
|
||||||
vlsint32_t elem = (msb>lsb) ? (msb-lsb+1) : (lsb-msb+1);
|
vlsint32_t elem = (msb>lsb) ? (msb-lsb+1) : (lsb-msb+1);
|
||||||
FromData fromdata = fromDataForArray(nodep, fromp, false);
|
FromData fromdata = fromDataForArray(nodep, fromp);
|
||||||
AstNodeDType* ddtypep = fromdata.m_dtypep;
|
AstNodeDType* ddtypep = fromdata.m_dtypep;
|
||||||
VNumRange fromRange = fromdata.m_fromRange;
|
VNumRange fromRange = fromdata.m_fromRange;
|
||||||
if (VN_IS(ddtypep, UnpackArrayDType)) {
|
if (VN_IS(ddtypep, UnpackArrayDType)) {
|
||||||
|
|
@ -331,7 +331,7 @@ private:
|
||||||
newp->declElWidth(elwidth);
|
newp->declElWidth(elwidth);
|
||||||
newp->dtypeFrom(sliceDType(adtypep, msb, lsb));
|
newp->dtypeFrom(sliceDType(adtypep, msb, lsb));
|
||||||
//if (debug()>=9) newp->dumpTree(cout,"--EXTBTn: ");
|
//if (debug()>=9) newp->dumpTree(cout,"--EXTBTn: ");
|
||||||
if (newp->widthMin()!=(int)newp->widthConst()) nodep->v3fatalSrc("Width mismatch");
|
if (newp->widthMin() != newp->widthConst()) nodep->v3fatalSrc("Width mismatch");
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
else if (VN_IS(ddtypep, BasicDType)) {
|
else if (VN_IS(ddtypep, BasicDType)) {
|
||||||
|
|
@ -402,7 +402,7 @@ private:
|
||||||
int width = VN_CAST(widthp, Const)->toSInt();
|
int width = VN_CAST(widthp, Const)->toSInt();
|
||||||
if (width > (1<<28)) nodep->v3error("Width of :+ or :- is huge; vector of over 1billion bits: "<<widthp->prettyName());
|
if (width > (1<<28)) nodep->v3error("Width of :+ or :- is huge; vector of over 1billion bits: "<<widthp->prettyName());
|
||||||
if (width<0) nodep->v3error("Width of :+ or :- is < 0: "<<widthp->prettyName());
|
if (width<0) nodep->v3error("Width of :+ or :- is < 0: "<<widthp->prettyName());
|
||||||
FromData fromdata = fromDataForArray(nodep, fromp, width!=1);
|
FromData fromdata = fromDataForArray(nodep, fromp);
|
||||||
AstNodeDType* ddtypep = fromdata.m_dtypep;
|
AstNodeDType* ddtypep = fromdata.m_dtypep;
|
||||||
VNumRange fromRange = fromdata.m_fromRange;
|
VNumRange fromRange = fromdata.m_fromRange;
|
||||||
if (VN_IS(ddtypep, BasicDType)
|
if (VN_IS(ddtypep, BasicDType)
|
||||||
|
|
|
||||||
|
|
@ -566,7 +566,7 @@ int main(int argc, char** argv, char** env) {
|
||||||
|
|
||||||
time_t randseed;
|
time_t randseed;
|
||||||
time(&randseed);
|
time(&randseed);
|
||||||
srand( (int) randseed);
|
srand(static_cast<int>(randseed));
|
||||||
|
|
||||||
// Post-constructor initialization of netlists
|
// Post-constructor initialization of netlists
|
||||||
v3Global.boot();
|
v3Global.boot();
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ int main(int argc, char** argv, char** env) {
|
||||||
}
|
}
|
||||||
|
|
||||||
V3Error::abortIfWarnings();
|
V3Error::abortIfWarnings();
|
||||||
if (top.opt.annotateOut() != "") {
|
if (!top.opt.annotateOut().empty()) {
|
||||||
top.annotate(top.opt.annotateOut());
|
top.annotate(top.opt.annotateOut());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,7 +180,7 @@ int main(int argc, char** argv, char** env) {
|
||||||
top.tests().dump(false);
|
top.tests().dump(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (top.opt.writeFile() != "") {
|
if (!top.opt.writeFile().empty()) {
|
||||||
top.writeCoverage(top.opt.writeFile());
|
top.writeCoverage(top.opt.writeFile());
|
||||||
V3Error::abortIfWarnings();
|
V3Error::abortIfWarnings();
|
||||||
if (top.opt.unlink()) {
|
if (top.opt.unlink()) {
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@
|
||||||
|
|
||||||
#include "config_rev.h"
|
#include "config_rev.h"
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// V3Options - Command line options
|
// V3Options - Command line options
|
||||||
|
|
|
||||||
|
|
@ -150,11 +150,11 @@ void VlcTop::annotateCalc() {
|
||||||
const VlcPoint& point = m_points.pointNumber(it->second);
|
const VlcPoint& point = m_points.pointNumber(it->second);
|
||||||
string filename = point.filename();
|
string filename = point.filename();
|
||||||
int lineno = point.lineno();
|
int lineno = point.lineno();
|
||||||
if (filename!="" && lineno!=0) {
|
if (!filename.empty() && lineno!=0) {
|
||||||
int column = point.column();
|
int column = point.column();
|
||||||
VlcSource& source = sources().findNewSource(filename);
|
VlcSource& source = sources().findNewSource(filename);
|
||||||
string threshStr = point.thresh();
|
string threshStr = point.thresh();
|
||||||
unsigned thresh = (threshStr!="") ? atoi(threshStr.c_str()) : opt.annotateMin();
|
unsigned thresh = (!threshStr.empty()) ? atoi(threshStr.c_str()) : opt.annotateMin();
|
||||||
bool ok = (point.count() >= thresh);
|
bool ok = (point.count() >= thresh);
|
||||||
UINFO(9, "AnnoCalc count "<<filename<<" "<<lineno<<" "<<point.count()<<endl);
|
UINFO(9, "AnnoCalc count "<<filename<<" "<<lineno<<" "<<point.count()<<endl);
|
||||||
source.incCount(lineno, column, point.count(), ok);
|
source.incCount(lineno, column, point.count(), ok);
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,13 @@ if (!-r "$root/.git") {
|
||||||
print " Inserts tabs\n" if $Self->{verbose} && !$btab;
|
print " Inserts tabs\n" if $Self->{verbose} && !$btab;
|
||||||
$btab = 1;
|
$btab = 1;
|
||||||
}
|
}
|
||||||
|
elsif ($line =~ m!^\+(.*)!) {
|
||||||
|
my $len = length($1);
|
||||||
|
if ($len >= 100) {
|
||||||
|
print" Wide $line\n" if $Self->{verbose};
|
||||||
|
$warns{$file} = "File modification adds a new >100 column line: $file";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (keys %warns) {
|
if (keys %warns) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue