From a2c832f72c796572dfb355af1b9f5c81bdea5cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Thu, 21 Nov 2024 16:23:10 +0100 Subject: [PATCH] Raise error on unsupported port scenario --- src/diag.cc | 4 ++++ src/diag.h | 1 + src/slang_frontend.cc | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/diag.cc b/src/diag.cc index 8bd7e49..ec9fada 100644 --- a/src/diag.cc +++ b/src/diag.cc @@ -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}); @@ -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); } }; }; diff --git a/src/diag.h b/src/diag.h index 9957e93..2f209cc 100644 --- a/src/diag.h +++ b/src/diag.h @@ -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); }; }; diff --git a/src/slang_frontend.cc b/src/slang_frontend.cc index f54c5c4..5fad0ba 100644 --- a/src/slang_frontend.cc +++ b/src/slang_frontend.cc @@ -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; }