init
This commit is contained in:
21
code/vezba6_7/verif/Agent/calc_agent_pkg.sv
Normal file
21
code/vezba6_7/verif/Agent/calc_agent_pkg.sv
Normal file
@@ -0,0 +1,21 @@
|
||||
`ifndef CALC_AGENT_PKG
|
||||
`define CALC_AGENT_PKG
|
||||
|
||||
package calc_agent_pkg;
|
||||
|
||||
import uvm_pkg::*;
|
||||
`include "uvm_macros.svh"
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
// include Agent components : driver,monitor,sequencer
|
||||
/////////////////////////////////////////////////////////
|
||||
`include "calc_seq_item.sv"
|
||||
`include "calc_sequencer.sv"
|
||||
`include "calc_driver.sv"
|
||||
|
||||
endpackage
|
||||
|
||||
`endif
|
||||
|
||||
|
||||
|
||||
41
code/vezba6_7/verif/Agent/calc_driver.sv
Normal file
41
code/vezba6_7/verif/Agent/calc_driver.sv
Normal file
@@ -0,0 +1,41 @@
|
||||
`ifndef CALC_DRIVER_SV
|
||||
`define CALC_DRIVER_SV
|
||||
class calc_driver extends uvm_driver#(calc_seq_item);
|
||||
|
||||
`uvm_component_utils(calc_driver)
|
||||
virtual interface calc_if vif;
|
||||
function new(string name = "calc_driver", uvm_component parent = null);
|
||||
super.new(name,parent);
|
||||
endfunction // new
|
||||
|
||||
function void build_phase(uvm_phase phase);
|
||||
if (!uvm_config_db#(virtual calc_if)::get(null, "*", "calc_if", vif))
|
||||
`uvm_fatal("NOVIF",{"virtual interface must be set:",get_full_name(),".vif"})
|
||||
|
||||
endfunction // build_phase
|
||||
|
||||
task main_phase(uvm_phase phase);
|
||||
forever begin
|
||||
@(posedge vif.clk);
|
||||
if (!vif.rst)
|
||||
begin
|
||||
seq_item_port.get_next_item(req);
|
||||
|
||||
`uvm_info(get_type_name(),
|
||||
$sformatf("Driver sending...\n%s", req.sprint()),
|
||||
UVM_HIGH)
|
||||
vif.req1_data_in = req.operand1;
|
||||
vif.req1_cmd_in = req.cmd;
|
||||
@(posedge vif.clk);
|
||||
vif.req1_data_in = req.operand2;
|
||||
vif.req1_cmd_in = 0;
|
||||
|
||||
seq_item_port.item_done();
|
||||
end
|
||||
end
|
||||
endtask : main_phase
|
||||
|
||||
endclass : calc_driver
|
||||
|
||||
`endif
|
||||
|
||||
20
code/vezba6_7/verif/Agent/calc_seq_item.sv
Normal file
20
code/vezba6_7/verif/Agent/calc_seq_item.sv
Normal file
@@ -0,0 +1,20 @@
|
||||
`ifndef CALC_SEQ_ITEM_SV
|
||||
`define CALC_SEQ_ITEM_SV
|
||||
|
||||
class calc_seq_item extends uvm_sequence_item;
|
||||
|
||||
rand logic [31:0] operand1;
|
||||
rand logic [31:0] operand2;
|
||||
rand logic [3:0] cmd;
|
||||
|
||||
|
||||
`uvm_object_utils_begin(calc_seq_item)
|
||||
`uvm_object_utils_end
|
||||
|
||||
function new (string name = "calc_seq_item");
|
||||
super.new(name);
|
||||
endfunction // new
|
||||
|
||||
endclass : calc_seq_item
|
||||
|
||||
`endif
|
||||
15
code/vezba6_7/verif/Agent/calc_sequencer.sv
Normal file
15
code/vezba6_7/verif/Agent/calc_sequencer.sv
Normal file
@@ -0,0 +1,15 @@
|
||||
`ifndef CALC_SEQUENCER_SV
|
||||
`define CALC_SEQUENCER_SV
|
||||
|
||||
class calc_sequencer extends uvm_sequencer#(calc_seq_item);
|
||||
|
||||
`uvm_component_utils(calc_sequencer)
|
||||
|
||||
function new(string name = "calc_sequencer", uvm_component parent = null);
|
||||
super.new(name,parent);
|
||||
endfunction
|
||||
|
||||
endclass : calc_sequencer
|
||||
|
||||
`endif
|
||||
|
||||
Reference in New Issue
Block a user