Skip to content

Commit

Permalink
Raise error on blackboxes with type parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
povik committed Nov 1, 2024
1 parent 54f0cf5 commit 45aaf76
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/diag.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace diag {
slang::DiagCode BadInlinedPortConnection(slang::DiagSubsystem::Netlist, 1035);
slang::DiagCode NoParamsOnUnkBboxes(slang::DiagSubsystem::Netlist, 1037);
slang::DiagCode ConnNameRequiredOnUnkBboxes(slang::DiagSubsystem::Netlist, 1038);
slang::DiagCode BboxTypeParameter(slang::DiagSubsystem::Netlist, 1039);

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

engine.setMessage(ConnNameRequiredOnUnkBboxes, "port name required in connections on unknown blackboxes");
engine.setSeverity(ConnNameRequiredOnUnkBboxes, slang::DiagnosticSeverity::Error);

engine.setMessage(BboxTypeParameter, "blackbox cannot have a type parameter");
engine.setSeverity(BboxTypeParameter, slang::DiagnosticSeverity::Error);
}
};
};
1 change: 1 addition & 0 deletions src/diag.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ extern slang::DiagCode AloadOne;
extern slang::DiagCode BadInlinedPortConnection;
extern slang::DiagCode NoParamsOnUnkBboxes;
extern slang::DiagCode ConnNameRequiredOnUnkBboxes;
extern slang::DiagCode BboxTypeParameter;
void setup_messages(slang::DiagnosticEngine &engine);
};
};
2 changes: 2 additions & 0 deletions src/slang_frontend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2505,6 +2505,8 @@ struct PopulateNetlist : public TimingPatternInterpretor, public ast::ASTVisitor

sym.body.visit(ast::makeVisitor([&](auto&, const ast::ParameterSymbol &symbol) {
cell->setParam(RTLIL::escape_id(std::string(symbol.name)), convert_const(symbol.getValue()));
}, [&](auto&, const ast::TypeParameterSymbol &symbol) {
sym.body.addDiag(diag::BboxTypeParameter, symbol.location);
}, [&](auto&, const ast::InstanceSymbol&) {
// no-op
}));
Expand Down

0 comments on commit 45aaf76

Please sign in to comment.