Skip to content

Commit

Permalink
Merge pull request #3912 from alainmarcel/alainmarcel-patch-1
Browse files Browse the repository at this point in the history
new lint checks
  • Loading branch information
alaindargelas authored Oct 19, 2023
2 parents da30da8 + 7f5b18c commit 5060eb6
Show file tree
Hide file tree
Showing 14 changed files with 927 additions and 19 deletions.
4 changes: 3 additions & 1 deletion include/Surelog/ErrorReporting/ErrorDefinition.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class ErrorDefinition {
ELAB_SYSTEM_ERROR = 547,
ELAB_SYSTEM_WARNING = 548,
ELAB_SYSTEM_INFO = 549,
ELAB_UNKNOWN_PORT = 550,
LIB_FILE_MAPS_TO_MULTIPLE_LIBS = 600,
UHDM_UNSUPPORTED_EXPR = 700,
UHDM_UNSUPPORTED_STMT = 701,
Expand Down Expand Up @@ -276,7 +277,8 @@ class ErrorDefinition {
UHDM_INVALID_CASE_STMT_VALUE = 727,
UHDM_UNSUPPORTED_TYPESPEC = 728,
UHDM_UNRESOLVED_PROPERTY = 729,
UHDM_NON_TEMPORAL_SEQUENCE_USE = 730
UHDM_NON_TEMPORAL_SEQUENCE_USE = 730,
UHDM_NON_POSITIVE_VALUE = 731
};

class ErrorInfo {
Expand Down
34 changes: 34 additions & 0 deletions src/DesignCompile/NetlistElaboration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,9 +807,11 @@ bool NetlistElaboration::high_conn_(ModuleInstance* instance) {
signals = &comp->getPorts();
}
std::map<std::string_view, Signal*> allSignals;
std::map<std::string_view, Signal*> allSignalsConst;
if (signals) {
for (Signal* s : *signals) {
allSignals.emplace(s->getName(), s);
allSignalsConst.emplace(s->getName(), s);
}
}
if ((inst_type == VObjectType::paUdp_instantiation) ||
Expand Down Expand Up @@ -1178,6 +1180,24 @@ bool NetlistElaboration::high_conn_(ModuleInstance* instance) {
p = s.MakePort();
ports->push_back(p);
p->VpiName(formalName);
fC->populateCoreMembers(formalId, formalId, p);
if (!allSignalsConst.empty()) {
auto found = allSignalsConst.find(p->VpiName());
if (found == allSignalsConst.end()) {
SymbolTable* symbols =
m_compileDesign->getCompiler()->getSymbolTable();
ErrorContainer* errors =
m_compileDesign->getCompiler()->getErrorContainer();
Location loc(
fileSystem->toPathId(
p->VpiFile(),
m_compileDesign->getCompiler()->getSymbolTable()),
p->VpiLineNo(), p->VpiColumnNo(),
symbols->registerSymbol(p->VpiName()));
Error err(ErrorDefinition::ELAB_UNKNOWN_PORT, loc);
errors->addError(err);
}
}
}
} else {
ports = s.MakePortVec();
Expand All @@ -1198,6 +1218,20 @@ bool NetlistElaboration::high_conn_(ModuleInstance* instance) {
VObjectType::paExpression) { // .p(s) connection by name
sigId = tmp;
Expression = tmp;
if (!allSignalsConst.empty()) {
auto found = allSignalsConst.find(formalName);
if (found == allSignalsConst.end()) {
SymbolTable* symbols =
m_compileDesign->getCompiler()->getSymbolTable();
ErrorContainer* errors =
m_compileDesign->getCompiler()->getErrorContainer();
Location loc(fC->getFileId(formalId), fC->Line(formalId),
fC->Column(formalId),
symbols->registerSymbol(formalName));
Error err(ErrorDefinition::ELAB_UNKNOWN_PORT, loc);
errors->addError(err);
}
}
}
} // else .p implicit connection
}
Expand Down
3 changes: 3 additions & 0 deletions src/ErrorReporting/ErrorDefinition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ bool ErrorDefinition::init() {
"Skipping blackboxed instance \"%s\"");
rec(ELAB_INVALID_CASE_STMT_VALUE, ERROR, ELAB,
"Invalid generate case stmt value");
rec(ELAB_UNKNOWN_PORT, ERROR, ELAB, "Unknown port \"%s\"");
rec(ELAB_SYSTEM_FATAL, FATAL, ELAB, "Fatal elaboration %s");
rec(ELAB_SYSTEM_ERROR, ERROR, ELAB, "Elaboration error %s");
rec(ELAB_SYSTEM_WARNING, WARNING, ELAB, "Elaboration warning %s");
Expand Down Expand Up @@ -477,6 +478,8 @@ bool ErrorDefinition::init() {
rec(UHDM_UNRESOLVED_PROPERTY, ERROR, UHDM, "Unresolved property \"%s\"");
rec(UHDM_NON_TEMPORAL_SEQUENCE_USE, ERROR, UHDM,
"Sequence used in non-temporal context \"%s\"");
rec(UHDM_NON_POSITIVE_VALUE, ERROR, UHDM,
"Required positive value (>=1), \"%s\" given");
return true;
}

Expand Down
Loading

0 comments on commit 5060eb6

Please sign in to comment.