Fix bounds check in VL_SEL_IWII (#2910)
This commit is contained in:
parent
53d9c30277
commit
5290062549
|
|
@ -2705,7 +2705,7 @@ static inline IData VL_BITSEL_IWII(int, int lbits, int, int, WDataInP lwp, IData
|
|||
static inline IData VL_SEL_IWII(int, int lbits, int, int, WDataInP lwp, IData lsb,
|
||||
IData width) VL_MT_SAFE {
|
||||
int msb = lsb + width - 1;
|
||||
if (VL_UNLIKELY(msb > lbits)) {
|
||||
if (VL_UNLIKELY(msb >= lbits)) {
|
||||
return ~0; // Spec says you can go outside the range of a array. Don't coredump if so.
|
||||
} else if (VL_BITWORD_E(msb) == VL_BITWORD_E(static_cast<int>(lsb))) {
|
||||
return VL_BITRSHIFT_W(lwp, lsb);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ module t (/*AUTOARG*/
|
|||
^ bytehash(w17));
|
||||
// verilator lint_on WIDTH
|
||||
|
||||
`define EXPECTED_SUM 64'hb6fdb64085fc17f5
|
||||
`define EXPECTED_SUM 64'h2bc7c2a98a302891
|
||||
|
||||
// Test loop
|
||||
always @ (posedge clk) begin
|
||||
|
|
|
|||
Loading…
Reference in New Issue