// Base Virtual Sequence Class class base_vseq extends uvm_sequence #(uvm_sequence_item); `uvm_object_utils(base_vseq) // Target Agent Sequencers uvm_sequencer #(ahb_txn) SQR_AHB; uvm_sequencer #(axi_txn) SQR_AXI; // Constructor function new (string name = "base_vseq"); super.new(name); endfunction: new endclass: vseq_base // Virtual Sequence Class class my_vseq extends base_vseq; `uvm_object_utils(my_vseq) // Constructor function new (string name = "my_vseq"); super.new(name); endfunction: new // Sequence Body Task task body(); ahb_seqeunce ahb_seq; axi_sequence axi_seq; ahb_seq = ahb_sequence::type_id::create("ahb_seq"); axi_seq = axi_sequence::type_id::create("axi_seq"); fork abh_seq.start(SQR_AHB); axi_seq.start(SQR_AXI); join endtask endclass: my_vseq // Base Test Class class base_test extends uvm_test; `uvm_component_utils(base_test); // Environment Class Instantiation top_env Env; // Constructor function new (string name = "base_test", uvm_component parent = null); super.new(name, parent); endfunction: new // Build Phase function void build_phase (uvm_phase phase); Env = top_env::type_id::create("Env"); endfunction: build_phase // Method to Connect Sequencer Handles in VSEQ function void init_vseq (base_vseq vseq); vseq.SQR_AHB = test.env.ahb_agent.SQR_AHB; vseq.SQR_AXI = test.env.axi_agent.SQR_AXI; endfunction: init_vseq endclass: base_test // Main Test class test extends base_test; `uvm_component_utils(test) // Constructor function new (string name = "test", uvm_component parent = null); super.new(name, parent); endfunction: new // Run Phase task run_phase (uvm_phase phase); // Create the Virtual Sequence my_vseq vseq = my_vseq::type_id::create("vseq"); phase.raise_objection(this); // Virtual Sequence Initialization init_vseq(vseq); // Start the Virtual Sequence vseq.start(null); phase.drop_objection(this); endtask: run_phase endclass: test
Sunday, October 30, 2016
UVM Virtual Sequence Example.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment