//main transaction class consist common response signals of read and write transactions
class axi_slave_transaction #(ADDR_WIDTH=32);
typedef enum bit [1:0] {OKAY,EXOKAY,SLVERR,DECERR} response_sig;
//typedef variable declared for response signal
rand response_sig w_resp_t;
//signals which are common in read and write transaction
bit [ADDR_WIDTH-1:0]ADDR;
bit [7:0]LEN;
bit [2:0]SIZE;
bit [1:0]BURST;
endclass:axi_slave_transaction
//read transaction class
class read_transaction extends axi_slave_transaction;
//typedef declartion of queue having variable size depending on SIZE
typedef bit [1023:0]r_data_queue_t[$]; // (want to implement) -> typedef bit [((2**SIZE)*8)-1:0] R_DATA_QUEUE_T
//read data from memory and store into queue
function r_data_queue_t read_data_from_memory(r_data_queue_t r_data_q,input ADDR);
repeat (LEN)
begin
r_data_q.push_back(MEM[ADDR++]);
end
return r_data_q;
endfunction:read_data_from_memory
endclass:read_transaction
I want to use the queue(here R_DATA_QUEUE_T) width equal to the variable “SIZE” width. and I want that queue(here R_DATA_QUEUE_T) to be defined using a typedef construct to be used as a return type of function. but the width should be constant inside the typedef construct.
how can I achieve this requirement?
please help me out!
Thanks & Regards