How to type cast a list of uint to a list of vr_ahb_data in Specman?

71 Views Asked by At

I have A which is a list of uint(bits:20) and B which is a list of vr_ahb_data. I also have a method that takes in 2 lists of vr_ahb_data and compares each item between the two lists.

type vr_ahb_data : uint(bits: VR_AHB_DATA_WIDTH); // defined in vr_ahb_types.e

// below are in my test bench environment
A : list of uint(bits:20);
B : list of vr_ahb_data;

data_check(act: list of vr_ahb_data, exp: list of vr_ahb_data) is {
    // compare each item in both lists
};

How do I type cast A to make it acceptable to the data_check() method ? I cannot change the method since it is a common utility.

1

There are 1 best solutions below

1
user3467290 On BEST ANSWER

assuming that vr_ahb_data is some kind of an int, that is - defined something like this -

type vr_ahb_data : uint(bits : VR_AHB_DATA_WIDTH);

you can do the casting in the call

        data_check(A.as_a(list of vr_ahb_data), B);