# Faulty data from DUT

**URL:** <https://verificationacademy.com/forums/t/faulty-data-from-dut/49668>\
**Category:** UVM\
**Created:** [February 19, 2025, 7:01am UTC](https://verificationacademy.com/forums/t/faulty-data-from-dut/49668 "2025-02-19T07:01:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![omertonbuloglu](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/o/eada6e/32.png) [@omertonbuloglu](https://verificationacademy.com/forums/u/omertonbuloglu)\
**Post date:** [February 19, 2025, 7:01am UTC](https://verificationacademy.com/forums/t/faulty-data-from-dut/49668/1 "2025-02-19T07:01:42Z")

</div>

The value generated by the sequence is first sent to the monitor and then to the interface. However, it does not match the value observed on the monitor and scoreboard. What should I do in this case?  
 ![image](https://verificationacademy.com/forums/uploads/default/original/2X/f/f250f572e828173b841a8ff597eaf4fc448dcd56.png)

---

<div class="post-metadata">

**Author:** ![MichaelP](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@MichaelP](https://verificationacademy.com/forums/u/MichaelP)\
**Post date:** [February 19, 2025, 7:54am UTC](https://verificationacademy.com/forums/t/faulty-data-from-dut/49668/2 "2025-02-19T07:54:14Z")

</div>

Simplified order of stages:

1. Sequence is randomized, and pushed to the agent Sequencer’s queue.
2. The driver of the agent gets/pulls the sequence from the Sequencer queue, and drives it on the DUT ports (also may be named “pin wiggle”).
3. The Monitor collects the transaction which was pushed by the Driver to the DUT through the Interface.

So if the monitor collected/captured Date: 00  
It is either a bug in the Driver code of the pin wiggle, or in the Monitor code which collects the transaction from the pins/ports.

---

<div class="post-metadata">

**Author:** ![omertonbuloglu](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/o/eada6e/32.png) [@omertonbuloglu](https://verificationacademy.com/forums/u/omertonbuloglu)\
**Post date:** [February 19, 2025, 8:17am UTC](https://verificationacademy.com/forums/t/faulty-data-from-dut/49668/3 "2025-02-19T08:17:48Z")

</div>

First of all, thank you for your answer. I reviewed the classes you specified again but I did not see any mistakes. I added the codes of the relevant classes below. Can you take a look? `include "uvm_macros.svh" import uvm_pkg::*; `include “seq\_item.sv”

class dff\_driver extends uvm\_driver#(dff\_seq\_item);

`uvm\_component\_utils(dff\_driver);

virtual dff\_intf intf;  
dff\_seq\_item tx;

function new(string name = “dff\_driver”, uvm\_component parent);  
super.new(name, parent);  
`uvm\_info(“Driver Class”, “constructor”, UVM\_MEDIUM)  
endfunction : new

function void build\_phase(uvm\_phase phase);  
super.build\_phase(phase);  
if(!uvm\_config\_db#(virtual dff\_intf)::get(this, “”, “vintf”, intf))  
`uvm\_fatal(“no\_inif in driver”,“virtual interface get failed from config db”);  
endfunction : build\_phase

task run\_phase(uvm\_phase phase);

```
  `uvm_info("driver Class", "run_phase", UVM_MEDIUM)
  tx = dff_seq_item::type_id::create("tx"); 

  seq_item_port.get_next_item(tx);
  @(posedge intf.clk)
  intf.data <= tx.data;
  seq_item_port.item_done();
  `uvm_info("Driver Class", $sformatf("Sending Data: %h", tx.data), UVM_MEDIUM)

```

endtask

endclass

`include "uvm_macros.svh" import uvm_pkg::*; `include “seq\_item.sv”

class dff\_monitor extends uvm\_monitor;

`uvm\_component\_utils(dff\_monitor);

virtual dff\_intf intf;  
uvm\_analysis\_port #(dff\_seq\_item) item\_collected\_port;

dff\_seq\_item tx;

function new(string name = “dff\_monitor”, uvm\_component parent);  
super.new(name, parent);  
item\_collected\_port = new(“item\_collected\_port”, this);  
`uvm\_info(“Monitor Class”, “constructor”, UVM\_MEDIUM)  
endfunction : new

function void build\_phase(uvm\_phase phase);  
super.build\_phase(phase);

if(!uvm\_config\_db#(virtual dff\_intf)::get(this, “”, “vintf”, intf))  
`uvm\_fatal(“no\_inif in driver”,“virtual interface get failed from config db”);

`uvm\_info(get\_name(), $sformatf("In the monitor build phase "),UVM\_LOW)  
endfunction : build\_phase

task run\_phase(uvm\_phase phase);

```
tx = dff_seq_item::type_id::create("tx"); 

phase.raise_objection(this);

@(posedge intf.clk)
tx.data = intf.data;

item_collected_port.write(tx);
phase.drop_objection(this);

`uvm_info("Monitor Class", $sformatf("Captured Data from DUT: %h", tx.data), UVM_MEDIUM)

```

endtask

endclass

---

<div class="post-metadata">

**Author:** ![MichaelP](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@MichaelP](https://verificationacademy.com/forums/u/MichaelP)\
**Post date:** [February 19, 2025, 9:52am UTC](https://verificationacademy.com/forums/t/faulty-data-from-dut/49668/4 "2025-02-19T09:52:43Z")

</div>

> [@Please format your code with markdown tags](https://verificationacademy.com/forums/t/please-format-your-code-with-markdown-or-code-code-tags/28078):
>
> See [Formatting in Posts](https://markdown-it.github.io/) for all formatting options Your source code will be much easier to read when it is formatted nice and pretty like this: class packet; rand bit [31:0] address; rand bit [7:0] length; rand bit [7:0] data[]; constraint max\_length { length == data.size(); } endclass: packet instead of: class packet; rand bit [31:0] address; rand bit [7:0] length; rand bit [7:0] data; constraint max\_length { length == data.size(); } endclass: packet All you ha…

please read this post and format your code, for better readability.

---

<div class="post-metadata">

**Author:** ![omertonbuloglu](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/o/eada6e/32.png) [@omertonbuloglu](https://verificationacademy.com/forums/u/omertonbuloglu)\
**Post date:** [February 19, 2025, 10:12am UTC](https://verificationacademy.com/forums/t/faulty-data-from-dut/49668/5 "2025-02-19T10:12:59Z")

</div>

```auto
`include "uvm_macros.svh" 
import uvm_pkg::*; 
`include "seq_item.sv"

class dff_driver extends uvm_driver#(dff_seq_item); 

`uvm_component_utils(dff_driver); 

virtual dff_intf intf;
dff_seq_item tx;

function new(string name = "dff_driver", uvm_component parent); 
   super.new(name, parent);
   `uvm_info("Driver Class", "constructor", UVM_MEDIUM)
endfunction : new 

function void build_phase(uvm_phase phase);
   super.build_phase(phase);
   if(!uvm_config_db#(virtual dff_intf)::get(this, "", "vintf", intf))
      `uvm_fatal("no_inif in driver","virtual interface get failed from config db");
endfunction : build_phase

task run_phase(uvm_phase phase);
    //forever begin
      `uvm_info("driver Class", "run_phase", UVM_MEDIUM)
      tx = dff_seq_item::type_id::create("tx"); 

      seq_item_port.get_next_item(tx);
      @(posedge intf.clk)
      intf.data <= tx.data;
      seq_item_port.item_done();
      `uvm_info("Driver Class", $sformatf("Sending Data: %h", tx.data), UVM_MEDIUM)
    //end
endtask

endclass

```

---

<div class="post-metadata">

**Author:** ![omertonbuloglu](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/o/eada6e/32.png) [@omertonbuloglu](https://verificationacademy.com/forums/u/omertonbuloglu)\
**Post date:** [February 19, 2025, 10:14am UTC](https://verificationacademy.com/forums/t/faulty-data-from-dut/49668/6 "2025-02-19T10:14:59Z")

</div>

```auto
`include "uvm_macros.svh" 
import uvm_pkg::*; 
`include "seq_item.sv"

class dff_monitor extends uvm_monitor; 

`uvm_component_utils(dff_monitor); 

virtual dff_intf intf;
uvm_analysis_port #(dff_seq_item) item_collected_port; 

dff_seq_item tx;

function new(string name = "dff_monitor", uvm_component parent); 
   super.new(name, parent);
   item_collected_port = new("item_collected_port", this);
   `uvm_info("Monitor Class", "constructor", UVM_MEDIUM)
endfunction : new

function void build_phase(uvm_phase phase);
   super.build_phase(phase);
   
   if(!uvm_config_db#(virtual dff_intf)::get(this, "", "vintf", intf))
      `uvm_fatal("no_inif in driver","virtual interface get failed from config db");
   
   `uvm_info(get_name(), $sformatf("In the monitor build phase "),UVM_LOW)
endfunction : build_phase

task run_phase(uvm_phase phase);

    tx = dff_seq_item::type_id::create("tx"); 
    
    phase.raise_objection(this);

    @(posedge intf.clk)
    tx.data = intf.data;

    item_collected_port.write(tx);
    phase.drop_objection(this);

    `uvm_info("Monitor Class", $sformatf("Captured Data from DUT: %h", tx.data), UVM_MEDIUM)

endtask

endclass

```

I added the codes as you requested.

---

<div class="post-metadata">

**Author:** ![MichaelP](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@MichaelP](https://verificationacademy.com/forums/u/MichaelP)\
**Post date:** [February 19, 2025, 12:43pm UTC](https://verificationacademy.com/forums/t/faulty-data-from-dut/49668/7 "2025-02-19T12:43:54Z")

</div>

> [@omertonbuloglu](#):
>
> ```auto
> task run_phase(uvm_phase phase);
> 
> tx = dff_seq_item::type_id::create("tx"); 
>     
> phase.raise_objection(this);
> 
> @(posedge intf.clk)
> tx.data = intf.data;
> 
> item_collected_port.write(tx);
> phase.drop_objection(this);
> 
> `uvm_info("Monitor Class", $sformatf("Captured Data from DUT: %h", tx.data), UVM_MEDIUM)
> 
> endtask
> 
> ```

Please pay attention your monitor runs only once.  
it is not iterative.

---

<div class="post-metadata">

**Author:** ![omertonbuloglu](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/o/eada6e/32.png) [@omertonbuloglu](https://verificationacademy.com/forums/u/omertonbuloglu)\
**Post date:** [February 19, 2025, 1:01pm UTC](https://verificationacademy.com/forums/t/faulty-data-from-dut/49668/8 "2025-02-19T13:01:53Z")

</div>

I used the forever structure for the relevant part of the solution, but the result did not change. Now I will add the DUT and top module codes below, would you take a look at them?

```auto
library ieee;
use ieee.std_logic_1164.all;

entity uart_transmitter is
generic(baud_rate : integer := 9600);
port(
	send : in std_logic; 
   	clk : in std_logic;
	data : in std_logic_vector (7 downto 0);
	ready : out std_logic;
	uart_tx : out std_logic
);
end entity;

architecture uart_transmit of uart_transmitter is

constant baud_timer : integer := 100000000 / baud_rate;
constant bit_index_max : integer := 10;

type state_type is (RDY, LOAD_BIT, SEND_BIT);

signal state : state_type := RDY;
signal timer : integer := 0;
signal tx_data : std_logic_vector (9 downto 0);
signal bitIndex : integer range 0 TO bit_index_max := 0;
signal txBit : std_logic := '1';

begin
process(clk)
begin 
if rising_edge(clk) then

case state is 

when RDY => 
	if send = '1' then 
	tx_data <= '1' & data & '0';
	state <= LOAD_BIT;
	end if;
	timer <= 0;
	bitIndex <= 0; 
	txBit <= '1';
when LOAD_BIT =>
	state <= SEND_BIT;
	bitIndex <= bitIndex + 1;
	txBit <= tx_data(bitIndex);	
when SEND_BIT =>
	if(timer = baud_timer) then
	timer <= 0;
	if(bitIndex = bit_index_max) then
	state <= RDY;
	else state <= LOAD_BIT;
	end if;
	else timer <= timer + 1;
	end if;	

end case;
end if;
end process;

uart_tx <= txBit;
ready <= '1' when (state = RDY) else '0';

end uart_transmit;

```

```auto
`timescale 1ns/1ns

`include "uvm_macros.svh"
import uvm_pkg::*;
`include "interface.sv"
`include "test.sv"

module top;

logic clk;
logic [7:0] data;
logic send;
logic ready;
logic uart_tx;

dff_intf intf(.clk(clk));

uart_transmitter dut( 
      .clk(intf.clk),
      .send(intf.send),
      .data(intf.data),
      .ready(intf.ready),
      .uart_tx(intf.uart_tx)
);

initial begin
   clk = 0;
   forever #10 clk = ~clk;
end

initial begin
     #100; 
     send = 1;
     #20; 
     send = 0;
  end

initial begin
   uvm_config_db#(virtual dff_intf)::set(null,"*","vintf",intf);
   $dumpfile("dump.vcd");  
   $dumpvars(0, top);  
   run_test("dff_test");

end
endmodule 

```

---

<div class="post-metadata">

**Author:** ![cgales](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@cgales](https://verificationacademy.com/forums/u/cgales)\
**Post date:** [February 19, 2025, 1:40pm UTC](https://verificationacademy.com/forums/t/faulty-data-from-dut/49668/9 "2025-02-19T13:40:20Z")

</div>

Please post your entire environment, preferably on [EDA Playground](https://edaplayground.com/), which demonstrates your issue.

It is difficult to piece together what you are doing from the multiple posts you have made.

---

<div class="post-metadata">

**Author:** ![omertonbuloglu](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/o/eada6e/32.png) [@omertonbuloglu](https://verificationacademy.com/forums/u/omertonbuloglu)\
**Post date:** [February 20, 2025, 5:46am UTC](https://verificationacademy.com/forums/t/faulty-data-from-dut/49668/10 "2025-02-20T05:46:00Z")

</div>

I added my code to the EDA Playground simulator.

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

---

<div class="post-metadata">

**Author:** ![cgales](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@cgales](https://verificationacademy.com/forums/u/cgales)\
**Post date:** [February 20, 2025, 4:29pm UTC](https://verificationacademy.com/forums/t/faulty-data-from-dut/49668/11 "2025-02-20T16:29:49Z")

</div>

Some comments:

- Only raise objections in your test. Do not raise/drop objections in any other components
- Your driver needs a forever loop in the run\_phase() so that it will get all the transactions from the sequencer. If you don’t have this loop, your sequence will never finish and your test will never end.
- You want to use blocking assignments in your driver and monitor. Using non-blocking assignments will result in incorrect behavior.
