Skip to content

Commit

Permalink
Raise error on unsupported port scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
povik committed Nov 21, 2024
1 parent 4bd09eb commit a2c832f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/diag.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace diag {
slang::DiagCode BboxTypeParameter(slang::DiagSubsystem::Netlist, 1039);
slang::DiagCode BboxExportPortWidths(slang::DiagSubsystem::Netlist, 1040);
slang::DiagCode NoteIgnoreInitial(slang::DiagSubsystem::Netlist, 1041);
slang::DiagCode PortCorrespondence(slang::DiagSubsystem::Netlist, 1042);

slang::DiagGroup unsynthesizable("unsynthesizable", {IffUnsupported, GenericTimingUnsyn, BothEdgesUnsupported, ExpectingIfElseAload,
IfElseAloadPolarity, IfElseAloadMismatch});
Expand Down Expand Up @@ -159,6 +160,9 @@ namespace diag {

engine.setMessage(NoteIgnoreInitial, "use option '--ignore-initial' to ignore initial blocks");
engine.setSeverity(NoteIgnoreInitial, slang::DiagnosticSeverity::Note);

engine.setMessage(PortCorrespondence, "ports without direct correspondence to an internal net/variable unsupported");
engine.setSeverity(PortCorrespondence, slang::DiagnosticSeverity::Error);
}
};
};
1 change: 1 addition & 0 deletions src/diag.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ extern slang::DiagCode ConnNameRequiredOnUnkBboxes;
extern slang::DiagCode BboxTypeParameter;
extern slang::DiagCode BboxExportPortWidths;
extern slang::DiagCode NoteIgnoreInitial;
extern slang::DiagCode PortCorrespondence;
void setup_messages(slang::DiagnosticEngine &engine);
};
};
4 changes: 2 additions & 2 deletions src/slang_frontend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2409,8 +2409,8 @@ struct PopulateNetlist : public TimingPatternInterpretor, public ast::ASTVisitor
if (sym.getParentScope()->getContainingInstance() != &netlist.realm)
return;

if (!sym.internalSymbol) {
// This can happen in case of a compilation error.
if (!sym.internalSymbol || sym.internalSymbol->name.compare(sym.name)) {
sym.getParentScope()->addDiag(diag::PortCorrespondence, sym.location);
return;
}

Expand Down

0 comments on commit a2c832f

Please sign in to comment.