Common RAL method implemetation

Hi ,

Thank you for reading this post. I have some question regarding string to integer casting.

Below is the example which I have

1.if(str == “RAL_SINGLE”) begin
2. value = regmodel.reg_name.get();
3.end else begin
4. value = regmodel.reg_name[idx].get
5.end

In the above code , I want to get the mirror value of some register named reg_name. Register name “reg_name” is a single register in some ral model and array of register in some other ral model which is in the else part.

Question : If I use the same above code when ral_model has only register reg_name, tool will throw an error in line no:4 indicating that slice operation on register reg_name cannot be used? I don’t want to use `ifdef. Is there any way to sort out this issue ?