UVM RAL :: Am trying to access 8 bits out of 16bits of a register , But entire 16 bit data are being written

Hi ,

I have a 16 bit register out of which i am trying to access 8 bits ,, but i am getting following warning : 

UVM_WARNING verilog_src/uvm-1.1d/src/reg/uvm_reg_field.svh(1804) @ 16666400: reporter [RegModel] Target bus does not support byte enabling, and the field ‘reg_block_h.RX_REG.ONE’ is not the only field within the entire bus width. Individual field access will not be available. Accessing complete register instead.

I have written 'h1234 to register then i want to change only least significant byte via register write with 'hFF and am expecting to get 'h12FF when i read it but i am getting 'hff …

Does anybody know what is the fix for this issue ?

In reply to Girisha A B:

It would be helpful to see the model of this register. It seems you have a few reg fields inside.

this is the build function of that registers it has two fields

function void RX__REG::build();
ONE = uvm_reg_field::type_id::create(“ONE”);
TWO = uvm_reg_field::type_id::create(“TWO”);
ONE.configure(this,8,0,“RW”,0,'d59,1,1,1);
TWO.configure(this,8,8,“RW”,0,'d68,1,1,1);
endfunction

in reg block

 reg_map = create_map("reg_map",0,2,UVM_LITTLE_ENDIAN,1);
 default_map = reg_map;
     reg_map.add_reg(RX_REG,'d56,"RW");

In reply to Girisha A B:

OK. Thanks. You want to access one of your 2 data fields, right?
You have to perform for instance first a set on the corresponding filed and afterwards performing a get.
What are your commands you are executing?

Hi
Following are the commands used for writing and reading

 reg_block_h.RX_REG.read(status,value);
 reg_block_h.RX_REG.write(status,data);// data = 'h1234
 reg_block_h.RX_REG.read(status,value);// value = 'h1234
 reg_block_h.RX_REG.ONE.write(status,'hFF);// 
 reg_block_h.RX_REG.read(status,value);// value = 'hff ..

In reply to Girisha A B:

Have you configured your register adapter class to support byte enables (supports_byte_enable = 1)?
If not, see “Implementing An Adapter” in the UVM Cookbook.

In reply to chr_sue:

Hi ,

I used set and update methods , now its working as expected.
first I updated m_desired value using set method for the required field in the register 
then I used update method  for the register only that field got updated .

Thanks

In reply to Girisha A B:

When happens the error, during read or write?
The last read should be also on reg field ONE?

In reply to chr_sue:

Error was occuring when i use only write method to the field … am trying to read the entire register not that field alone …

In reply to dhserfer:

Hi ,
In adapter i have made supports_byte_enable = 1 …

In reply to Girisha A B:

I don’t see a problem with the code you provided. Writing a single byte works for me.

In reply to chr_sue:

Hi ,
read , set a particular filed then update the entire register works , if i dont read before set , result is not as expected .

read ← 1234
set ← 55
update ← 1255

set ← 55
update ← 0055 (default of the register is 1234 )

am expecting to see 1255 after set and update ? Is there any fix for this ?

In reply to Girisha A B:

Please show the UVM code (register commands in the sequence) for the entire test case. Please indicate if there is more than one test case. Your code earlier in the post does not match later in the post, it’s not clear what you are trying to do or what the results are.

Also, did you reset your register model?

In reply to dhserfer:

 reg_block_h.RX_REG.read(status,value); // 1234
 reg_block_h.RX_REG.ONE.set(.value('h55)); // 
 reg_block_h.RX_REG.update(status); // 1255

 reg_block_h.RX_REG.ONE.set(.value('h55)); // default value is 1234 
 reg_block_h.RX_REG.update(status); // 0055 

 Is there a way to update only the field ONE  ?

In reply to dhserfer:

hi can you please provide me the code for accessing particular byte in reg feild