hi
bit[31:0] mem [int];
i want to store :- address ={address , id} in associative array…
how can i do that and then how can i read it… as i want to compare my id and then want to read data stored on that address.
hi
bit[31:0] mem [int];
i want to store :- address ={address , id} in associative array…
how can i do that and then how can i read it… as i want to compare my id and then want to read data stored on that address.
In reply to Er. Shipra:
You started out by answering your own question, except you probably want to define the size of id in terms of bits
bit [31:0] id_mapping[bit [15:0]];
Even better is to use typedefs.
typedef bit [31:0] address_t;
typedef bit [15:0] id_t;
typedef bit [7:0] data_t;
address_t address;
id_t id;
data_t data;
data_t mem[address_t];
address_t id_mapping[id_t];
...
id = some_value;
address = id_mapping[id];
data = mem[address];