# UVM monitor error

**URL:** <https://verificationacademy.com/forums/t/uvm-monitor-error/36634>\
**Category:** UVM\
**Tags:** UVM, error, monitor-to-scoreboard\
**Created:** [October 6, 2019, 7:19am UTC](https://verificationacademy.com/forums/t/uvm-monitor-error/36634 "2019-10-06T07:19:29Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shubhv26](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@Shubhv26](https://verificationacademy.com/forums/u/Shubhv26)\
**Post date:** [October 6, 2019, 7:19am UTC](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/1 "2019-10-06T07:19:29Z")

</div>

Hello Everyone,  
I created a DUT for a simple memory system along with its UVM testbench. I am unable to detect the problem that why my monitor is providing an incorrect data. It is displaying the “zero” value for the first set of Driver inputs. I have attached the link for my code, I will be grateful if you can detect the error for me.

Sincere Regards,

> **[EDA Playground](https://www.edaplayground.com/x/59MD)**
>
> Edit, save, simulate, synthesize SystemVerilog, Verilog, VHDL and other HDLs from your web browser.

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [October 6, 2019, 10:04am UTC](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/2 "2019-10-06T10:04:13Z")

</div>

_In reply to [SV26](https://verificationacademy.com/forums/t/uvm-monitor-error/36634):_

THis happens because you are driving @0 data, but there is still the reset active, resetting all data.

---

<div class="post-metadata">

**Author:** ![Shubhv26](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@Shubhv26](https://verificationacademy.com/forums/u/Shubhv26)\
**Post date:** [October 7, 2019, 7:43am UTC](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/3 "2019-10-07T07:43:49Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/2):_

Thank you for the response, but I am still unable to rectify the problem. Can you please pinpoint the main position of error.

Regards,

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [October 7, 2019, 8:06am UTC](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/4 "2019-10-07T08:06:06Z")

</div>

_In reply to [SV26](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/3):_  
This is the first entry from the driver:  
UVM\_INFO my\_pkg.sv(46) @ 0: uvm\_test\_top.env.agnt.sqncr@@seq [my\_sequence] Starting the sequence  
UVM\_INFO @ 30000: uvm\_test\_top.env.agnt.driv [DRIV] Driving data across DUT:  
wr= 1  
addr= 1  
data= 24  
It is from runtime 0 (see @0). What you are printing is the content of your seq\_item. At that time the reset is active in your DUT. This resets the mem to ‘0’ and the driver data do not show-up here. Thjis results in the monitor values of:  
UVM\_INFO my\_pkg.sv(135) @ 50000: uvm\_test\_top.env.agnt.mon [MON] Monitor received data for WR operation  
UVM\_INFO @ 50000: uvm\_test\_top.env.agnt.mon [MONITOR] Monitoring data:  
wr= 0  
addr= 0  
data= 0

And you had a few weaknesses in your code tolerated by VCS.  
See how it works here:

> **[EDA Playground](https://www.edaplayground.com/x/42DF)**
>
> Edit, save, simulate, synthesize SystemVerilog, Verilog, VHDL and other HDLs from your web browser.

---

<div class="post-metadata">

**Author:** ![Shubhv26](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@Shubhv26](https://verificationacademy.com/forums/u/Shubhv26)\
**Post date:** [October 7, 2019, 6:21pm UTC](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/5 "2019-10-07T18:21:26Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/4):_

Thank you so much. I really appreciate the help.

---

<div class="post-metadata">

**Author:** ![Shubhv26](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@Shubhv26](https://verificationacademy.com/forums/u/Shubhv26)\
**Post date:** [October 9, 2019, 12:45am UTC](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/6 "2019-10-09T00:45:11Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/5):_  
Sir,  
So far I understood my previous error and I am getting positive results for the write operation. But, for the read operation, the value at vif.rdata is 0 for each case. I tried everything but was unable to correct the code.

---

<div class="post-metadata">

**Author:** ![PedroCavalcante](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/pedrocavalcante/32/4095_2.png) [@PedroCavalcante](https://verificationacademy.com/forums/u/PedroCavalcante)\
**Post date:** [October 9, 2019, 1:30am UTC](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/7 "2019-10-09T01:30:57Z")

</div>

Hi,

There are inconsistencies that should be resolved in your test bench.

1. In testbench.sv

You forgot to set the reset to 1 after you change it to 0, so your memory is always resenting all registers.

…  
initial begin  
rst = 1;

# 10 rst = 0;

# 10 rst = 1; //======= Add in your code

end  
…

1. In driver:

In your reading task you use non-blocking assignments,

```
     vif.driver_cb.wr <= req.wr;
     vif.driver_cb.addr <= req.addr;
     req.rdata <= vif.driver_cb.rdata;

```

So your rdata is the current interface rdata and not the read from the requested address, since all three assignments occur in parallel. But switching them to blocking assignments is not enough, since your DUT needs a clock pulse to answer a read request. So to resolve this you should wait a clock pulse before copying rdata.

…  
@ (vif.driver\_cb)  
req.rdata = vif.driver\_cb.rdata;  
…

This solves your reading problem, I hope I helped.

---

<div class="post-metadata">

**Author:** ![Shubhv26](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@Shubhv26](https://verificationacademy.com/forums/u/Shubhv26)\
**Post date:** [October 9, 2019, 5:58am UTC](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/8 "2019-10-09T05:58:29Z")

</div>

_In reply to [PedroCavalcante](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/7):_

Hi,  
Thank you for replying to my problem. I did the reset thing but even after changing the driver, it is still showing the same error, infact, now the monitor output is increased by 4 redundant display.

> **[EDA Playground](https://www.edaplayground.com/x/59MD)**
>
> Edit, save, simulate, synthesize SystemVerilog, Verilog, VHDL and other HDLs from your web browser.

---

<div class="post-metadata">

**Author:** ![PedroCavalcante](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/pedrocavalcante/32/4095_2.png) [@PedroCavalcante](https://verificationacademy.com/forums/u/PedroCavalcante)\
**Post date:** [October 9, 2019, 7:20am UTC](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/9 "2019-10-09T07:20:55Z")

</div>

_In reply to [SV26](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/8):_

The variables driver\_cb.addr and driver\_cb.wr is illegally driven by a  
blocking assignment.

A simple solution is to change only the code displayed in my previous post to look like this:

```
     vif.driver_cb.wr <= req.wr;
     vif.driver_cb.addr <= req.addr;
     @ (vif.driver_cb)
     req.rdata = vif.driver_cb.rdata;

```

It is not a good practice to use blocking and nonblocking assignment in the same task but it solves your problem.

---

<div class="post-metadata">

**Author:** ![Shubhv26](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@Shubhv26](https://verificationacademy.com/forums/u/Shubhv26)\
**Post date:** [October 9, 2019, 7:39am UTC](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/10 "2019-10-09T07:39:05Z")

</div>

_In reply to [PedroCavalcante](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/9):_

Yes, you are right and I already did that before, but still the problem remains intact.

Look at this,

UVM\_INFO my\_pkg.sv(142) @ 90000: uvm\_test\_top.env.agnt.mon [MON] Monitor received data for WR operation  
UVM\_INFO @ 90000: uvm\_test\_top.env.agnt.mon [MONITOR] Monitoring data:  
wr= 1  
addr= 2  
data= 3f  
UVM\_INFO @ 90000: uvm\_test\_top.env.scb [SCOREBOARD] Data in Scoreboard:  
wr= 1  
addr= 2  
data= 3f  
UVM\_INFO my\_pkg.sv(149) @ 130000: uvm\_test\_top.env.agnt.mon [MON] Monitor received data for RD operation  
UVM\_INFO @ 130000: uvm\_test\_top.env.agnt.mon [MONITOR] Monitoring data:  
wr= 0  
addr= 2  
rdata= 0  
UVM\_INFO @ 130000: uvm\_test\_top.env.scb [SCOREBOARD] Data in Scoreboard:  
wr= 0  
addr= 2  
rdata= 0  
UVM\_INFO my\_pkg.sv(110) @ 130000: uvm\_test\_top.env.agnt.driv [DRIV] Need Data from the memory:  
wr = 0  
addr = 2  
rdata = 0

also,for 10 random inputs, monitor is displaying 14 outputs,

\*\* Report counts by id  
[DRIV] 10  
[MON] 14  
[MONITOR] 14  
[RNTST] 1  
[SCOREBOARD] 14  
[TEST\_DONE] 1  
[UVM/RELNOTES] 1  
[UVMTOP] 1  
[my\_sequence] 2

---

<div class="post-metadata">

**Author:** ![PedroCavalcante](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/pedrocavalcante/32/4095_2.png) [@PedroCavalcante](https://verificationacademy.com/forums/u/PedroCavalcante)\
**Post date:** [October 9, 2019, 7:54am UTC](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/11 "2019-10-09T07:54:35Z")

</div>

_In reply to [SV26](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/10):_

On the monitor you should also wait for a clock pulse after you get the address to just get the rdata.

seq\_item.wr=vif.monitor\_cb.wr;  
seq\_item.addr=vif.monitor\_cb.addr;  
@(vif.monitor\_cb);  
seq\_item.rdata=vif.monitor\_cb.rdata;

---

<div class="post-metadata">

**Author:** ![Shubhv26](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@Shubhv26](https://verificationacademy.com/forums/u/Shubhv26)\
**Post date:** [October 9, 2019, 8:19am UTC](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/12 "2019-10-09T08:19:24Z")

</div>

_In reply to [PedroCavalcante](https://verificationacademy.com/forums/t/uvm-monitor-error/36634/11):_

Thankyou very much, that clears my problem.
