[chip,dv] Define sw_logger_if::wait_for_log_message - #31395
Open
rswarbrick wants to merge 1 commit into
Open
rswarbrick wants to merge 1 commit into
rswarbrick wants to merge 1 commit into
Conversation
This was triggered by warning messages when building chip-level
testbenches. The motivating example is the uses in
chip_sw_keymgr_dpe_key_derivation_vseq.
The existing code had lines like the following:
`DV_WAIT(cfg.sw_logger_vif.printed_log ==
$sformatf("KeymgrDpe generated AES output from DPE context in slot %0d", derived_key_slot_idx))
This generates warnings because printed_log is a bit vector of some
length (1024 characters), so the EDA tool suggests the comparisons
should be cast, giving something like this:
`DV_WAIT(string'(cfg.sw_logger_vif.printed_log) ==
$sformatf("KeymgrDpe generated AES output from DPE context in slot %0d", derived_key_slot_idx))
This is rather ugly, and ends up with users having to reason about the
implementation of the interface. With the new version of the code,
this can be simplified to
cfg.sw_logger_vif.wait_for_log_message(
$sformatf("KeymgrDpe generated AES output from DPE context in slot %0d", derived_key_slot_idx))
The wait_for_log_message task has a default timeout, which I've
actually copied manually from csr_utils_pkg: it doesn't feel like
sw_logger_if should depend on that core.
It also has the option of describing the thing that's being waited
for, which lets the caller be a bit more specific about what should be
in an error message.
The change described above squashes some warnings, which is nice, but
the code is still rather hard to read (a long string literal and a
call to $sformatf). To improve things, this commit pulls some of that
repeated code into some helper tasks in the virtual sequence, so this
eventually becomes:
wait_for_keymgr_dpe_gen_output_slot_msg("AES", derived_key_slot_idx);
Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was triggered by warning messages when building chip-level testbenches. The motivating example is the uses in
chip_sw_keymgr_dpe_key_derivation_vseq.The existing code had lines like the following:
This generates warnings because printed_log is a bit vector of some length (1024 characters), so the EDA tool suggests the comparisons should be cast, giving something like this:
This is rather ugly, and ends up with users having to reason about the implementation of the interface. With the new version of the code, this can be simplified to
The
wait_for_log_messagetask has a default timeout, which I've actually copied manually fromcsr_utils_pkg: it doesn't feel likesw_logger_ifshould depend on that core.It also has the option of describing the thing that's being waited for, which lets the caller be a bit more specific about what should be in an error message.
The change described above squashes some warnings, which is nice, but the code is still rather hard to read (a long string literal and a call to
$sformatf). To improve things, this commit pulls some of that repeated code into some helper tasks in the virtual sequence, so this eventually becomes: