AHB RAM 验证【二】
AHB VIP及TB的框架构建
本次要验证的BRAM是一个符合AHB协议的RAM,它是一个slave。那么要验证此ram,我们就要模拟一个ahb_master_agent来对其进行验证。
ahb_agent框架搭建
1.在ahb_pkg中导入vip文件:
`ifndef LVC_AHB_PKG_SV
`define LVC_AHB_PKG_SV
package lvc_ahb_pkg;
import uvm_pkg::*;
`include "uvm_macros.svh"
`include "lvc_ahb_defines.svh"
`include "lvc_ahb_types.sv"
`include "lvc_ahb_transaction.sv"
`include "lvc_ahb_sequencer.sv"
`include "lvc_ahb_driver.sv"
`include "lvc_ahb_monitor.sv"
`include "lvc_ahb_master_transaction.sv"
`include "lvc_ahb_master_sequencer.sv"
`include "lvc_ahb_master_driver.sv"
`include "lvc_ahb_master_monitor.sv"
`include "lvc_ahb_master_agent.sv"
endpackage
`endif // LVC_AHB_PKG_SV
2.lvc_ahb_driver & lvc_ahb_master_driver
`ifndef LVC_AHB_DRIVER_SV
`define LVC_AHB_DRIVER_SV
class lvc_ahb_driver #(type REQ = lvc_ahb_transaction, type RSP = REQ) extends uvm_driver #(REQ, RSP);
`uvm_component_utils(lvc_ahb_driver)
function new (string name = "lvc_ahb_driver", uvm_component parent = null);
super.new(name, parent);
endfunction
function build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction
function connect_phase(uvm_phase phase);
super.connect_phase(phase);
endfunction
task run_phase(uvm_phase phase);
super.run_phase(phase);
phase.raise_objection(phase);
phase.drop_objection(phase);
endtask
endclass
`endif // LVC_AHB_DRIVER_SV
`ifndef LVC_AHB_MASTER_DRIVER_SV
`define LVC_AHB_MASTER_DRIVER_SV
class lvc_ahb_master_driver extends lvc_ahb_driver;
`uvm_component_utils(lvc_ahb_master_driver)
function new (string name = "lvc_ahb_master_driver", uvm_component parent = null);
super.new(name, parent);
endfunction
function build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction
function connect_phase(uvm_phase phase);
super.connect_phase(phase);
endfunction
task run_phase(uvm_phase phase);
super.run_phase(phase);
phase.raise_objection(phase);
phase.drop_objection(phase);
endtask
endclass
`endif // LVC_AHB_MASTER_DRIVER_SV
3.lvc_ahb_sequencer & lvc_ahb_master_sequencer
`ifndef LVC_AHB_SEQUENCER_SV
`define LVC_AHB_SEQUENCER_SV
class lvc_ahb_sequencer #(type REQ = lvc_ahb_transaction, type RSP = REQ) extends uvm_sequencer #(REQ, RSP);
`uvm_component_utils(lvc_ahb_sequencer)
function new (string name = "lvc_ahb_sequencer", uvm_component parent = null);
super.new(name,parent);
endfunction
function void build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction
function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
endfunction
task run_phase(uvm_phase phase);
super.run_phase(phase);
endtask
endclass
`endif // LVC_AHB_SEQUENCER_SV
`ifndef LVC_AHB_MASTER_SEQUENCER_SV
`define LVC_AHB_MASTER_SEQUENCER_SV
class lvc_ahb_master_sequencer extends lvc_ahb_sequencer;
`uvm_component_utils(lvc_ahb_master_sequencer)
function new (string name = "lvc_ahb_master_sequencer", uvm_component parent = null);
super.new(name,parent);
endfunction
function void build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction
function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
endfunction
task run_phase(uvm_phase phase);
super.run_phase(phase);
endtask
endclass
`endif // LVC_AHB_MASTER_SEQUENCER_SV
4.lvc_ahb_monitor & lvc_ahb_master_monitor
`ifndef LVC_AHB_MONITOR_SV
`define LVC_AHB_MONITOR_SV
class lvc_ahb_monitor extends uvm_monitor;
`uvm_component_utils(ahb_monitor)
function new (string name = "lvc_ahb_monitor", uvm_component parent = null);
super.new(name,parent);
endfunction
function void build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction
function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
endfunction
task run_phase(uvm_phase phase);
super.run_phase(phase);
endtask
endclass
`endif // LVC_AHB_MONITOR_SV
`ifndef LVC_AHB_MASTER_MONITOR_SV
`define LVC_AHB_MASTER_MONITOR_SV
class lvc_ahb_master_monitor extends lvc_ahb_monitor;
`uvm_component_utils(lvc_ahb_master_monitor)
function new (string name = "lvc_ahb_master_monitor", uvm_component parent = null);
super.new(name, parent);
endfunction
function void build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction
function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
endfunction
task run_phase(uvm_phase phase);
super.run_phase(phase);
endtask
endclass
`endif // LVC_AHB_MASTER_MONITOR_SV
5.lvc_ahb_configuration及lvc_ahb_agent_configuration
`ifndef LVC_AHB_CONFIGURATION_SV
`define LVC_AHB_CONFIGURATION_SV
class lvc_ahb_configuration extends uvm_object;
`uvm_object_utils_begin(lvc_ahb_configuration)
`uvm_object_utils_end
function new (string name = "lvc_ahb_configuration");
super.new(name);
endfunction
endclass
`endif // LVC_AHB_CONFIGURATION_SV
`ifndef LVC_AHB_AGENT_CONFIGURATION_SV
`define LVC_AHB_AGENT_CONFIGURATION_SV
class lvc_ahb_agent_configuration extends uvm_object;
`uvm_object_utils_begin(lvc_ahb_agent_configuration)
`uvm_object_utils_end
function new (string name = "lvc_ahb_agent_configuration");
super.new(name);
endfunction
endclass
`endif // LVC_AHB_AENGT_CONFIGURATION_SV
6.lvc_ahb_transaction & lvc_ahb_master_transaction
`ifndef LVC_AHB_TRANSACTION_SV
`define LVC_AHB_TRANSACTION_SV
class lvc_ahb_transaction extends uvm_sequence_item;
`uvm_object_utils_begin(lvc_ahb_transaction)
`uvm_object_utils_end
function new (string name = "lvc_ahb_transaction");
super.new(name);
endfunction
endclass
`endif // LVC_AHB_TRANSACTION_SV
`ifndef LVC_AHB_MASTER_TRANSACTION_SV
`define LVC_AHB_MASTER_TRANSACTION_SV
class lvc_ahb_master_transaction extends lvc_ahb_transaction;
`uvm_object_utils_begin(lvc_ahb_master_transaction)
`uvm_object_utils_end
function new (string name = "lvc_ahb_master_transaction");
super.new(name);
endfunction
endclass
`endif // LVC_AHB_MASTER_TRANSACTION_SV
验证框图


浙公网安备 33010602011771号