UVM Driver to Monitor communication in a single agent

Hi All,

I have 2 doubt regarding additional variables that i can put in SystemVerilog Interface.

First doubt:

In my case of Verification of I2C-slave, I need to somehow indicate Monitor start-of-serial-data(or address) (which monitor should convert to 8-Bit parallel-data) and store it in a Queue and compare during next read cycle.

What i’m doing is, I’m using additional variable in Interface (called bit[1:0] S2P_CTRL) and sharing this across the UVM structure

bit[1:0] S2P_CTRL;

// Instruction to monitor whether to push into queue or not
// 00 - Do nothing
// 01 - Write addr convertion from s2p
// 10 - Write data convertion from s2p
// 11 - Read data convertion from s2p

Can you please tell me is this good way programming? Can i pass a signal from Driver to Monitor through interface ??
If not, please guide me with better way of achieving my goal!!

P.S: I’m not connecting this interface-variable to DUT it used only to send signals to monitor from driver!!
Problem here is, In Read cycle, Driver should drive the address and data is RECEIVED from the slave so this is what Im trying to do via UVM!

**Second doubt:
**
Regarding Bidirectonal-Bus in an interface (SDA )

I have declared it as ‘wire’ in my interface, how can i use it during READ cycle of I2C, where i can Write Address from Driver and then Read after few cycles.
While Reading, what will the driver be driving ??
How do i drive ‘Z’ from driver while I’m Reading from Slave??

Thanks in advance!!

In reply to MLearner:

You should avoid driver-monitor communication as you can reuse your monitor when driving is not required. For e.g. as intermediate monitor/checker at integration level.

You can receive read data by observing SCL interface along with SDA. Go through I2C write and read waveforms once and see if you can come up with monitoring by observing only SCL, SDA and no driver!

In reply to mayurkubavat:

Thanks Mayur for your response, Just to get clarity on what you are trying to say,

  1. Should i count the number of bits/ticks of SCL and then read ??
    Because that’s only data that monitor can read.
  2. If its a Burst read or back to back read after address, how will monirot know whether its a single read or back2back ?? (So in this case we need to check for ACK is it?? )

I am familiar about the I2C protocol, but I need some clarity w.r.t its verification particularly in UVM

Coming to my second part of query in my first post, can you please let me know your views ??

While Reading SDA, what will the driver be driving ??
How do i drive ‘Z’ from driver while I’m Reading from Slave??

Thanks a lot for your time !!

In reply to MLearner:

Hi,

  • Yes. To collect each frame you need to count SCL. You should also collect address along with data, to update memory model inside monitor. Having memory model in monitor is good way to check data integrity.

  • If you only want to collect data, then observe start condition from monitor and count SCL.

  • For back to back read also, once you monitor START condition, collect data on every positive transition of SCL until STOP condition/SCL count.

  • You are correct there. While reading ‘Z’ should be driven from driver after first frame. After driving Address and Read bit, you can have ‘Z’ assignment.

In reply to mayurkubavat:

It’s clear regarding READ-recoding in monitor.
Thanks a ton for your clarification, Mayur.

Regardsing driving ‘Z’ in driver, while reading,

//Pseudo code:


//Inside Interface.sv

wire		SDA;	
..
clocking driver_cb @ (posedge clk);
default input #1ns output #1ns;
inout 	SDA;  // since its bi-directional
endclocking: driver_cb


// Inside Driver.sv
vif.driver_cb.SDA = req.sda; // is made as 'Z', with the help of 'req.sda' variable in sequence

Is this implimentation right ?

I’m sorry if I’m getting in detail, this will be my last query regarding this!
I really wanted some clarification on these 2 things to proceed further!

Thanks again!!

In reply to MLearner:

No need to use variable for ‘Z’ assignment,

You can do something like this in driver,


vif.driver_cb.SDA = req.read_write;
@(vif.driver_cb)
vif.driver_cb.SDA = 1'bZ;

In reply to mayurkubavat:

Agreed Sir!
Thanks a lot for your patient response, I think I take it from here!
Have a great day !