I need to pass the contents of a dynamic array of enumerated types from a function in one class to another class. This is what I have on the class that defines the function:
typedef enum int {HOST2DEV,DEV2HOST,DEV2DEV,HOST2DEVS} all_transactions_t;
typedef all_transactions_t dev_tx_transactions_t[];
all_transactions_t all_transactions[];
rand bit [3:0] HOST2DEV_dev_addr[];
rand bit [3:0] HOST2DEVS_dev_addr[];
// Constraints for all_transactions, HOST2DEV_dev_addr, and HOST2DEVS_dev_addr done here, but not shown
function dev_tx_transactions_t dev_tx_transactions(bit[3:0] dev_addr);
int index = 0;
foreach (all_transactions[i]) begin
case (all_transactions[i])
HOST2DEV : begin
if (HOST2DEV_dev_addr[i] == dev_addr)begin
dev_tx_transactions = new[dev_tx_transactions.size() + 1] (dev_tx_transactions);
dev_tx_transactions[index] = all_transactions[i];
index++;
end
end
HOST2DEVS : begin
if (HOST2DEVS_dev_addr[i] == dev_addr)begin
dev_tx_transactions = new[dev_tx_transactions.size() + 1] (dev_tx_transactions);
dev_tx_transactions[index] = all_transactions[i];
index++;
end
end
endcase
end
endfunction
This is how I call the function and pass the array to another class:
dev0_isr_sequence_h.dev_tx_transactions = host_data_sequence_h.dev_tx_transactions(4'h0);
dev1_isr_sequence_h.dev_tx_transactions = host_data_sequence_h.dev_tx_transactions(4'h1);
Inside the dev0_isr_sequence class, I have:
typedef enum int {HOST2DEV,DEV2HOST,DEV2DEV,HOST2DEVS} all_transactions_t;
typedef all_transactions_t dev_tx_transactions_t[];
dev_tx_transactions_t dev_tx_transactions;
However, when I run it, I get a Suppressible vsim-7034 Array assignment or comparision to type 'enum int....... from type 'enum int...transactions_t$[]' error.
Any ideas what I am doing wrong?