systemc: Check the maximum port size when finializing bindings.
authorGabe Black <gabeblack@google.com>
Sun, 7 Oct 2018 08:38:41 +0000 (01:38 -0700)
committerGabe Black <gabeblack@google.com>
Tue, 16 Oct 2018 01:10:42 +0000 (01:10 +0000)
Change-Id: Ie7d704547bb8523a3c44479a89d2af4fcce6e8b6
Reviewed-on: https://gem5-review.googlesource.com/c/13326
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

src/systemc/core/port.cc

index c1d77d9d0e743c80e68f5cb6b1ed7cad97eeec3e..e8a78323126732de1aa3f7f71ad881b283344b69 100644 (file)
@@ -125,6 +125,14 @@ Port::finalize()
 
     resets.clear();
 
+    if (size() > maxSize()) {
+        std::ostringstream ss;
+        ss << size() << " binds exceeds maximum of " << maxSize() <<
+            " allowed";
+        portBase->report_error(
+                "(E109) complete binding failed", ss.str().c_str());
+    }
+
     switch (portBase->_portPolicy()) {
       case sc_core::SC_ONE_OR_MORE_BOUND:
         if (size() == 0)