Repository navigation
Add partial support for size constraints (#5582 partial) - #5611
Merged
wsnyder merged 19 commits intoNov 15, 2024
Merged
Conversation
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
wsnyder
reviewed
Nov 15, 2024
wsnyder
left a comment
Member
There was a problem hiding this comment.
Great! Please make sure you are up-to-date with master, and also add to this commit:
diff --git a/test_regress/t/uvm/uvm_pkg_todo.svh b/test_regress/t/uvm/uvm_pkg_todo.svh
index 0ef277ddb..65c2d0b3d 100644
--- a/test_regress/t/uvm/uvm_pkg_todo.svh
+++ b/test_regress/t/uvm/uvm_pkg_todo.svh
@@ -22444,9 +22444,7 @@ class uvm_reg_item extends uvm_sequence_item;
uvm_elem_kind_e element_kind;
uvm_object element;
rand uvm_access_e kind;
- //TODO issue-5582 - Rand constraint with .size
- //TODO %Warning-CONSTRAINTIGN: t/t_uvm_pkg_todo.vh:#:#: Unsupported: randomizing this expression, treating as state
- /*rand*/ uvm_reg_data_t value[];
+ rand uvm_reg_data_t value[];
constraint max_values { value.size() > 0 && value.size() < 1000; }
rand uvm_reg_addr_t offset;
uvm_status_e status;
@@ -26866,9 +26864,7 @@ class uvm_reg_fifo extends uvm_reg;
local uvm_reg_field value;
local int m_set_cnt;
local int unsigned m_size;
- //TODO issue-5582 - Rand constraint with .size
- //TODO %Warning-CONSTRAINTIGN: t/t_uvm_pkg_todo.vh:#:#: Unsupported: randomizing this expression, treating as state
- /*rand*/ uvm_reg_data_t fifo[$];
+ rand uvm_reg_data_t fifo[$];
constraint valid_fifo_size {
fifo.size() <= m_size;
}
Co-authored-by: Wilson Snyder <wsnyder@wsnyder.org>
Co-authored-by: Wilson Snyder <wsnyder@wsnyder.org>
Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
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.
It adds partial support for size constraints of queues and dynamic arrays.
I added it by replacing
size()method with a normalrandvariable. Then this variable is passed to the constraint solver and the array is resized before the unconstrained randomization.Currently, it doesn't work when:
randomizeis not smaller than the size specified in the constraint),withclause ofrandomize, because in such a case, the unconstrained randomization is done before the constrained,