Skip to content

Commit 914194e

Browse files
committed
[9.6.1 Bit-selects] Print error when access out-of-bounds
1 parent b2f6fe3 commit 914194e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/PSSIntInst.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ public PSSVal toVal () {
4949

5050
@Override
5151
public PSSInst indexOf (PSSVal index) {
52+
/** [9.6.1 Bit-selects]: It shall be illegal for a bit-select to access on out-of-bounds bit index. */
53+
if (index.toInt() > m_width) {
54+
String errObj = "'" + getHierarchyId() + "[" + index.getText() + "]" + "'";
55+
String errMsg = "Bit-selects access out-of-bounds bit index.";
56+
String errExt = "sizeof(" + getHierarchyId() + ") = " + m_width;
57+
PSSMessage.Error("ILLEGAL USAGE", errObj + " " + errMsg + " //" + errExt);
58+
}
59+
5260
m_BitSelect = new PSSIntVal(index.toBigInteger());
5361
return this;
5462
}

0 commit comments

Comments
 (0)