Skip to content

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

@ghost

Description

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
            )
        )
    };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions