Skip to content

Commit 51a784b

Browse files
committed
[csrng/lint] Waive VAR_INDEX_RANGE warning shown in new tool versions
The corresponding RTL is okay, the computed index is always valid. Otherwise, we end up in a different branch and the index is not used. It's okay to waive this warning. Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
1 parent 0e745b4 commit 51a784b

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

hw/ip/csrng/lint/csrng.waiver

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ waive -rules {ONE_BIT_MEM_WIDTH} -location {prim_arbiter_ppc.sv} -regexp {.*has
88
-comment "Usage case specific to CSRNG and how the arbiter is used."
99
waive -rules {LHS_TOO_SHORT} -location {aes_cipher_control_fsm.sv aes_cipher_core.sv aes_key_expand.sv aes_sbox.sv} -regexp {Bitlength mismatch between 'unused_assert_static_lint_error' length 1 and.*} \
1010
-comment "CSRNG intentionally uses an unmasked AES implementation."
11+
waive -rules {VAR_INDEX_RANGE} -location {csrng_ctr_drbg.sv} -regexp {'\(NumBlkPerUpd - 1 - concat_ctr_q\) \* BlkLen \+: BlkLen' minimum value -128 is too small for 'concat_key_v_d' range.*} \
12+
-comment "concat_ctr_q must be lower than NumBlkPerUpd, otherwise concat_ctr_done is set and we end up in the other if/else branch, the index into concat_key_v_d is always valid."

hw/ip/csrng/rtl/csrng_ctr_drbg.sv

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ module csrng_ctr_drbg import csrng_pkg::*; (
285285
concat_key_v_d = '0;
286286
end else if (concat_ctr_inc) begin
287287
concat_ctr_d = concat_ctr_q + 1;
288-
// Steer the v-response from block encrypt to the correct lane, MSB down
288+
// Steer the v-response from block encrypt to the correct lane, MSB down.
289+
// concat_ctr_q must be lower than NumBlkPerUpd, otherwise concat_ctr_done is set and we end
290+
// up in the if branch above, i.e., the index into concat_key_v_d is always valid.
289291
concat_key_v_d[(NumBlkPerUpd - 1 - concat_ctr_q) * BlkLen +: BlkLen]
290292
= block_encrypt_rsp_data_i;
291293
end

0 commit comments

Comments
 (0)