verif.ier
Newbie level 4
The following is a working code snippet for read/write operation using spi protocol to a slave with addr address. Could anyone explain what is the function of the part marked in bold?
Code:
task TmspiCmd(bit [13:0] addr, bit rwb=0,inout bit [15:0] data,input bit reg_size=0, input int check =0,input bit[15:0] expData = 0, int tlead =0 );
//..
if(rwb)
begin
[B]spiw.data[0] = {2'b00,addr};
spiw.data[1] = 16'b0;[/B]
end
else
begin
[B]spiw.data[0] = {2'b10,addr};
spiw.data[1] = data;[/B]
end
//...
if(rwb)
begin
TempData = 0;
TempData = spiw.resp_data;
for(int index=0; index <16; index++)
TempData[index] = spiw.resp_data[15-index];
if (reg_size)
begin
[B] if (addr %2)
data = TempData[15:8];
else
data = TempData[7:0];[/B]
end
else
[B] data = TempData;[/B]
`uvm_info("TMSPI:Response=> ",$sformatf("Addr %h [%h = %h ] [%h]", addr,data,TempData,spiw.resp_data), UVM_LOW);
// ..