UVM Commands

🧪 UVM Commands – Base Classes

TopicQuestionAnswer
UVMInclude UVM `include "uvm_macros.svh"
UVMImport UVMimport uvm_pkg::*;
UVMUVM objectclass name extends uvm_object;
UVMUVM componentclass name extends uvm_component;
UVMUVM testclass name extends uvm_test;
UVMUVM envclass name extends uvm_env;
UVMUVM agentclass name extends uvm_agent;
UVMUVM driverclass name extends uvm_driver#(trans_type);
UVMUVM monitorclass name extends uvm_monitor;
UVMUVM sequencerclass name extends uvm_sequencer#(trans_type);
UVMUVM sequenceclass name extends uvm_sequence#(trans_type);
UVMUVM sequence itemclass name extends uvm_sequence_item;
UVMUVM scoreboardclass name extends uvm_scoreboard;
UVMUVM subscriberclass name extends uvm_subscriber#(trans_type);

🧪 UVM Commands – Factory & Macros

TopicQuestionAnswer
UVMRegister component `uvm_component_utils(class_name)
UVMRegister object `uvm_object_utils(class_name)
UVMUtils begin `uvm_component_utils_begin(name)
UVMUtils end `uvm_component_utils_end
UVMField int `uvm_field_int(field_name, UVM_ALL_ON)
UVMField object `uvm_field_object(field_name, UVM_ALL_ON)
UVMField string `uvm_field_string(field_name, UVM_ALL_ON)
UVMField enum `uvm_field_enum(type, field_name, UVM_ALL_ON)
UVMField array int `uvm_field_array_int(field_name, UVM_ALL_ON)
UVMField sarray int `uvm_field_sarray_int(field_name, UVM_ALL_ON)
UVMField queue int `uvm_field_queue_int(field_name, UVM_ALL_ON)
UVMField aa int string `uvm_field_aa_int_string(field_name, UVM_ALL_ON)
UVMComponent param utils `uvm_component_param_utils(class_name#(T))
UVMObject param utils `uvm_object_param_utils(class_name#(T))

🧪 UVM Commands – Constructor & Phases

TopicQuestionAnswer
UVMComponent constructorfunction new(string name, uvm_component parent); super.new(name, parent); endfunction
UVMObject constructorfunction new(string name=""); super.new(name); endfunction
UVMBuild phasefunction void build_phase(uvm_phase phase); super.build_phase(phase); endfunction
UVMConnect phasefunction void connect_phase(uvm_phase phase); super.connect_phase(phase); endfunction
UVMEnd of elaborationfunction void end_of_elaboration_phase(uvm_phase phase);
UVMStart of simulationfunction void start_of_simulation_phase(uvm_phase phase);
UVMRun phasetask run_phase(uvm_phase phase); endtask
UVMPre-reset phasetask pre_reset_phase(uvm_phase phase); endtask
UVMReset phasetask reset_phase(uvm_phase phase); endtask
UVMPost-reset phasetask post_reset_phase(uvm_phase phase); endtask
UVMPre-configure phasetask pre_configure_phase(uvm_phase phase); endtask
UVMConfigure phasetask configure_phase(uvm_phase phase); endtask
UVMPost-configure phasetask post_configure_phase(uvm_phase phase); endtask
UVMPre-main phasetask pre_main_phase(uvm_phase phase); endtask
UVMMain phasetask main_phase(uvm_phase phase); endtask
UVMPost-main phasetask post_main_phase(uvm_phase phase); endtask
UVMPre-shutdown phasetask pre_shutdown_phase(uvm_phase phase); endtask
UVMShutdown phasetask shutdown_phase(uvm_phase phase); endtask
UVMPost-shutdown phasetask post_shutdown_phase(uvm_phase phase); endtask
UVMExtract phasefunction void extract_phase(uvm_phase phase);
UVMCheck phasefunction void check_phase(uvm_phase phase);
UVMReport phasefunction void report_phase(uvm_phase phase);
UVMFinal phasefunction void final_phase(uvm_phase phase);

🧪 UVM Commands – Factory & Creation

TopicQuestionAnswer
UVMCreate objectobj = class_name::type_id::create("obj_name");
UVMCreate componentcomp = class_name::type_id::create("name", this);
UVMSet type overrideclass_name::type_id::set_type_override(override_type::get_type());
UVMSet inst overrideset_inst_override_by_type("inst_name", orig_type::get_type(), override_type::get_type());
UVMSet override by nameset_type_override_by_name("original", "override");
UVMFactory printfactory.print();

🧪 UVM Commands – Configuration & Resources

TopicQuestionAnswer
UVMConfig DB setuvm_config_db#(int)::set(this, "*", "field", value);
UVMConfig DB getif (!uvm_config_db#(int)::get(this, "", "field", value))
UVMConfig DB set objectuvm_config_db#(obj_type)::set(this, "path", "field", obj);
UVMConfig DB virtual ifuvm_config_db#(virtual interface_type)::set(null, "*", "vif", vif);
UVMResource DB setuvm_resource_db#(int)::set("scope", "name", value);
UVMResource DB getuvm_resource_db#(int)::read_by_name("scope", "name", value);
UVMSet config intset_config_int("*", "field", value);
UVMSet config objectset_config_object("*", "field", obj);

🧪 UVM Commands – Sequences & Sequencer

TopicQuestionAnswer
UVMBody tasktask body(); endtask
UVMStart sequenceseq.start(sequencer);
UVMStart on sequencerseq_name.start(m_sequencer);
UVMCreate sequence itemreq = trans_type::type_id::create("req");
UVMStart itemstart_item(req);
UVMFinish itemfinish_item(req);
UVMWait for grantwait_for_grant();
UVMSend requestsend_request(req);
UVMWait for item donewait_for_item_done();
UVMGet responseget_response(rsp);
UVMGet next itemseq_item_port.get_next_item(req);
UVMItem doneseq_item_port.item_done();
UVMItem done with responseseq_item_port.item_done(rsp);
UVMPut responseseq_item_port.put_response(rsp);
UVMPeek requestseq_item_port.peek(req);
UVMGrab sequencergrab();
UVMUngrab sequencerungrab();
UVMIs grabbedif (is_grabbed())
UVMLock sequencerlock(sequencer);
UVMUnlock sequencerunlock(sequencer);

🧪 UVM Commands – Objections & Phasing

TopicQuestionAnswer
UVMRaise objectionphase.raise_objection(this);
UVMDrop objectionphase.drop_objection(this);
UVMRaise with countphase.raise_objection(this, "description", count);
UVMDrop with countphase.drop_objection(this, "description", count);
UVMSet drain timephase.phase_done.set_drain_time(this, 100ns);
UVMGet objectionuvm_objection obj = phase.get_objection();
UVMAll droppedobj.all_dropped(...);

🧪 UVM Commands – TLM Ports & Exports

TopicQuestionAnswer
UVMAnalysis portuvm_analysis_port#(trans_type) ap;
UVMAnalysis exportuvm_analysis_export#(trans_type) ae;
UVMAnalysis impuvm_analysis_imp#(trans_type, class_type) ai;
UVMWrite implementationfunction void write(trans_type t); endfunction
UVMBlocking put portuvm_blocking_put_port#(trans_type) put_port;
UVMBlocking get portuvm_blocking_get_port#(trans_type) get_port;
UVMNonblocking put portuvm_nonblocking_put_port#(trans_type) put_port;
UVMNonblocking get portuvm_nonblocking_get_port#(trans_type) get_port;
UVMPut exportuvm_put_export#(trans_type) put_export;
UVMGet exportuvm_get_export#(trans_type) get_export;
UVMTLM FIFOuvm_tlm_fifo#(trans_type) fifo;
UVMPort connectport.connect(export);
UVMAnalysis writeap.write(transaction);
UVMBlocking putput_port.put(item);
UVMBlocking getget_port.get(item);
UVMTry putif (put_port.try_put(item))
UVMTry getif (get_port.try_get(item))
UVMCan putif (put_port.can_put())
UVMCan getif (get_port.can_get())

🧪 UVM Commands – Reporting & Messages

TopicQuestionAnswer
UVMInfo message `uvm_info("TAG", "Message", UVM_LOW)
UVMWarning message `uvm_warning("TAG", "Warning message")
UVMError message `uvm_error("TAG", "Error message")
UVMFatal message `uvm_fatal("TAG", "Fatal error")
UVMInfo with verbosity `uvm_info("TAG", $sformatf("Value=%0d", val), UVM_MEDIUM)
UVMSet verbosityset_report_verbosity_level(UVM_HIGH);
UVMSet hier verbosityuvm_top.set_report_verbosity_level_hier(UVM_HIGH);
UVMSet severity actionset_report_severity_action(UVM_ERROR, UVM_DISPLAY | UVM_LOG);
UVMSet id actionset_report_id_action("TAG", UVM_DISPLAY);
UVMSet max quit countset_report_max_quit_count(10);
UVMReport handleruvm_report_handler handler = get_report_handler();

🧪 UVM Commands – Utilities & Misc

TopicQuestionAnswer
UVMRun testrun_test("test_name");
UVMRun test defaultrun_test(); (uses +UVM_TESTNAME)
UVMPrint topologyuvm_top.print_topology();
UVMSet timeoutuvm_top.set_timeout(1000ns);
UVMGlobal timeoutuvm_top.set_timeout(1ms, 0);
UVMGet parentparent = get_parent();
UVMGet full namename = get_full_name();
UVMGet type nametype_name = get_type_name();
UVMGet namename = get_name();
UVMPrint objectobj.print();
UVMSprint objectstring s = obj.sprint();
UVMCopy objectdest.copy(src);
UVMCompare objectsif (obj1.compare(obj2))
UVMClone objectobj2 = obj1.clone();
UVMPackobj.pack(packer);
UVMUnpackobj.unpack(packer);
UVMRecordobj.record(recorder);
UVMDo packfunction void do_pack(uvm_packer packer);
UVMDo unpackfunction void do_unpack(uvm_packer packer);
UVMDo copyfunction void do_copy(uvm_object rhs);
UVMDo comparefunction bit do_compare(uvm_object rhs, uvm_comparer comparer);
UVMDo printfunction void do_print(uvm_printer printer);
UVMConvert2stringfunction string convert2string();
UVMCallbacks adduvm_callbacks#(T, CB)::add(obj, cb);
UVMCallbacks deleteuvm_callbacks#(T, CB)::delete(obj, cb);
UVMEvent pooluvm_event_pool pool = uvm_event_pool::get_global_pool();
UVMBarrieruvm_barrier barrier = new("barrier", 3);
UVMWait for barrierbarrier.wait_for();
UVMHeartbeatuvm_heartbeat hb;
UVMRegister modelclass name extends uvm_reg_block;
UVMRegisterclass name extends uvm_reg;
UVMRegister fieldrand uvm_reg_field field_name;

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top