Jump to content

Recommended Posts

Posted

Hi Guys,

I have buitl a scoreboard using the uvm_in_order_comparator. But it always shows the data match even in the case of mismatch, I reviewed the code ,code is fine. I don't know doe's it's a UVM issue or my code have any problem code is given below

import uvm_pkg::*;

`include "uvm_macros.svh"

class pkt extends uvm_object;

int a;

function new(string name=" ");

super.new(name);

endfunction // new

function string convert2string();

convert2string={$sformatf("a=%d",a), super.convert2string};

endfunction

endclass

class my_comp1 extends uvm_component ;

uvm_analysis_port#(pkt) my_port;

pkt temp_pkt;

`uvm_component_utils(my_comp1)

function new(string name ,uvm_component parent=null);

super.new(name,parent);

my_port=new("my_port",this);

endfunction

task run_phase(uvm_phase phase);

phase.raise_objection(this);

for(int i=0 ; i<=100 ;i++)

begin

temp_pkt=new($sformatf("ins=%-d",i));

temp_pkt.a=9;

my_port.write(temp_pkt);

end

phase.drop_objection(this);

endtask

endclass

class my_comp2 extends uvm_component ;

uvm_analysis_port#(pkt) my_port1;

pkt temp_pkt ;

`uvm_component_utils(my_comp2)

function new(string name ,uvm_component parent=null);

super.new(name,parent);

my_port1=new("my_port1",this);

endfunction

task run_phase(uvm_phase phase);

phase.raise_objection(this);

temp_pkt=new("i");

for (int i=0 ; i<=100 ;i++)

begin

temp_pkt=new($sformatf("ins=%d",i));

temp_pkt.a=100;

my_port1.write(temp_pkt);

end

phase.drop_objection(this);

endtask

endclass // my_comp2

class my_comp3 extends uvm_component ;

// uvm_analysis_port#(pkt) my_port1;

pkt temp_pkt ;

`uvm_component_utils(my_comp3)

uvm_in_order_comparator # (pkt ,uvm_class_comp#(pkt),uvm_class_converter#(pkt)) my_comparator ;

//uvm_in_order_comparartor my_comparator ;

function new(string name ,uvm_component parent=null);

super.new(name,parent);

my_comparator=new("my_comparator",this);

// my_port1=new("my_port",this);

endfunction

endclass // my_comp2

class test extends uvm_test ;

my_comp1 comp1;

my_comp2 comp2 ;

my_comp3 comp3;

`uvm_component_utils(test)

function new(string name ,uvm_component parent=null);

super.new(name,parent);

endfunction // new

function void build_phase(uvm_phase phase);

comp1=my_comp1::type_id::create("my_comp1",this);

comp2=my_comp2::type_id::create("my_comp2",this);

comp3=my_comp3::type_id::create("my_comp3",this);

endfunction // build_phase

function void connect_phase (uvm_phase phase);

comp1.my_port.connect(comp3.my_comparator.after_export);

comp2.my_port1.connect(comp3.my_comparator.before_export);

endfunction // connect_phase

task run_phase(uvm_phase phase);

phase.raise_objection(this);

phase.drop_objection(this);

endtask // run_phase

endclass // test

module top ;

initial

run_test("test");

endmodule

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...