I would like to convert a class object to/from unbound byte array.
typedef enum {data_transaction, control_transaction} tr_type_en;
typedef byte dynamic_array_t[];
class transaction;
tr_type_en tr_type;
logic ctrl1;
logic [1023:0] data;
// methods
function dynamic_array_t to_bytes();
dynamic_array_t arr = new[1];
arr = dynamic_array'(this);
return arr;
endfunction
endclass
The code fails complaining that
Cadence XCelium 20.09
- A class type is not currently supported as source type in bit stream casting.
Any ideas why it doesn’t work?
Questa 2021 seems to work fine.
OK, probably not supported yet, though bitstreaming classes is in the 2017 LRM.