Skip to content

Add "=" (l : array_type; r : element_type) return boolean; for all array types by default.

Capability/request summary

Provide "=" function for all array types where an array object is compared to a single 'element type to see if an array contains all of the same value

Current Status

Currently, if someone wants to check that all values of a *_vector are equal to a specific value, the user usually needs to write the following:

-- assume bit_vector
if bv = (bv'range => '1') then  -- check all bits are '1'

this can look a bit cumbersome when bv is replaced by longer object names or complex record structures.

if this_is_the_first_record.some_internal_record.some_bit_vector_with_a_long_name = (this_is_the_first_record.some_internal_record.some_bit_vector_with_a_long_name'range = '1') then
    -- cumbersome

Use Models | Code Examples

Proposed changes

Create "=" and "/=" functions for all array types where the object can be compared to a single item of the 'element type

if this_is_the_first_record.some_internal_record.some_bit_vector_with_a_long_name = '1' then
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information