I have a long list defines defining with numerous properties for these registers. I'd like to have a function that takes the string of the register name and concatenates the bigdefine name and evaluates the `define int value upon process.
A simple function called liked the following:
PrintRegInfor(REGA);
Here's the class code that doesnt work:
`define CHIP_REGA_ADDR 16'h0000
`define CHIP_REGA_RESET_VAL 0
`define CHIP_REGB_ADDR 16'h0100
`define CHIP_REGB_RESET_VAL 1
.
.
`define CHIP_REGZ_ADDR 16'h1000
`define CHIP_REGZ_RESET_VAL 0
clase module;
function PrintRegInfo(string reg_name)
string reg_reset_string;
string reg_addr_string;
int reg_reset_int;
int reg_addr_int;
reg_reset_string = {"`CHIP_",reg_name,"_RESET_VAL"};
reg_addr_string = {"`CHIP_",reg_name,"_ADDR"};
reg_reset_int = reg_reset_string;
reg_add_int = reg_add_string;
$display("Reg %s at address 0x%x has a reset value of 0x%x\n",reg_name, reg_add_int,reg_reset_int);
endfunction
endclass
It looks like the conversion of string to int is converting the actual string from the ascii value into int. I'd like it to evaluate the `define of the string created. Is this possible?
I would like to get:
Reg Rega at address 0x0000 has a reset value of 0x0
I get something like: Reg Rega at address 0x3478 has a reset value of 0x8373
Thanks!