Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector Constraint with if_then_else not working when if statement is about a separate random variable #10

Open
ghost opened this issue Aug 19, 2021 · 0 comments

Comments

@ghost
Copy link

ghost commented Aug 19, 2021

Hi,

I am trying to randomize the elements of a crv_vector depending on the value of a separate crv_variable. When trying to use a different crv_variable in the if-statement of the if-then-else construct, I am getting a segmentation fault. Using GDB, this fault is occurring at Line 48 of VectorGenerator.cpp (Line 48 if the accellera-contribution branch) and it seems like it is trying to dereference a NULL pointer.

How can I use a CRAVE variable ( crv_variable <enum_data_type> size ) in an if-then-else for a vector constraint for randomizing each vector element? See "c_len_vec" constraint below, specifically the last foreach loop.

c_num_mcs = {
num_mcs() >= 1,
if_then_else(
size() == TYPE_SIZE_LONG, //This works, and so we assumed that this would work for a vector (see below)
num_mcs() <= this->max_mcs_long,
num_mcs() <= this->max_mcs_short
)
};

    c_len_vec = {
        len_vec().size() == num_mcs(),
        foreach(len_vec(), len_vec()[_i] >= 1),

    //This foreach loop results in a segmentation fault.
        foreach(len_vec(),
            if_then_else(
                size() == TYPE_SIZE_LONG,                        // This line results in a Segmentation Fault.
                len_vec()[_i] <= this->max_mcs_len_long,
                len_vec()[_i] <= this->max_mcs_len_short
            )
        )
    };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants