Cadence example
`include "uvm_pkg.sv"
module test;
import uvm_pkg::*;
`include "uvm_macros.svh"
class street extends uvm_component;
`uvm_component_utils(street)
function new(string name="street", uvm_component parent);
super.new(name, parent);
endfunction : new
task run ();
`uvm_info("INFO1", "I vacationed here in 2010", UVM_LOW)
endtask : run
endclass : street
class city extends uvm_component;
street Main_St;
`uvm_component_utils(city)
function new(string name="city", uvm_component parent);
super.new(name, parent);
endfunction : new
function void build();
super.build();
Main_St = street::type_id::create("Main_St", this);
endfunction : build
task run ();
uvm_component child, parent;
string pr, ch;
child=get_child("Main_St");
parent=get_parent();
pr = parent.get_full_name();
ch = child.get_name();
`uvm_info(get_type_name(), $psprintf("Parent:%s Child:%s", pr, ch), UVM_LOW)
endtask : run
endclass : city
class state extends uvm_component;
city Capital_city;
`uvm_component_utils(state)
function new(string name="state", uvm_component parent);
super.new(name, parent);
endfunction : new
function void build();
super.build();
Capital_city = city::type_id::create("Capital_city", this);
endfunction : build
function void end_of_elaboration();
this.print();
endfunction : end_of_elaboration
endclass : state
state Florida = state::type_id::create("Florida", null);
state New_York = state::type_id::create("New_York", null);
// Start UVM Phases
initial run_test();
initial #100 global_stop_request();
endmodule : test
沒有留言:
張貼留言