Professional Documents
Culture Documents
Testplan Apb
Testplan Apb
Version <1.0>
<02/21/2019>
2
VERSION HISTORY
1 INTRODUCTION
2 VERIFICATION STRATEGY
3 TESTBENCH ARCHITECTURE
3.1 PACKET.TXT
The packet for APB protocol consists of:
rand bit [31:0] paddr;
rand bit [31:0] pwdata ;
bit [31:0] prdata;
bit pwrite;
bit psel;
bit penable;
bit prstn;
bit pclk;
5
bit pready;
bit pslver;
constraint p1 { paddr < 256 }:slave address will be less than 256
3.2 TOP.SV
module top;
bit clk;
inter dut_if(clk);
slave d1 (.clk (dut_if.clk),……..) //instantiation of dut and interface
initial
begin
clk=0;
forever #5 clk=~clk; // clock generation
end
initial begin
uvm_config_db #(virtual inter)::set(null,"uvm_test_top","vif",dut_if);
run_test("apb_test"); //run base test
end
endmodule
3.3 APB_TEST
class counter_test extends uvm_test;
`uvm_component_utils (apb_test) //factory registration
apb_env env;
virtual inter vif;
APB_sequence seq;
virtual function void build_phase (uvm_phase phase);
////////////////////////////////////////////////////////////
create env instance
/////////////////////////////////////////////////////////////
endfunction
task run_phase( uvm_phase phase );
seq = counter_sequence::type_id::create("seq");
phase.raise_objection( this, "Starting sequence");
seq.start(m_top_env.cnt_agnt1.sequencer);
phase.drop_objection( this , "Finished sequence" );
endtask: run_phase
6
3.4 APB_ENV
it consists of two agents and a scoreboard
class apb_env extends uvm_env ;
`uvm_component_utils (apb_env)
apb_agent act_agnt1;
apb_agent pass_agnt2;// passive agent
apb_scoreboard m_scbd;
3.3 APB_AGENT
end
//creates monitor
endfunction : build_phase
3.3 APB_SEQUENCER
The sequencer control the flow of request and response sequence items
between sequences and the driver.
3.3 APB_DRIVER
Three tasks
1. one for write: task write;
3.4 APB_MONITOR.V
A Monitor is a functional block in a testbench, two monitors are used.
One for Captures the response at the output pins of the DUT & one Creates a packet out of
captured response information
@(negedge vif.rst);
fork
monitor_data();
join_none
@(posedge vif.rst);
disable fork;
9
end
endtask
endclass
3.5 APB_SCOREBOARD.V
• A Scoreboard is a functional block in the testbench that does the following: receives
response data from the monitor block
• Fetches expected results and compares with the response data received from the monitor
block
• Generates results and stores them for each test case. This aids in generating reports
3.6 ABP_SEQUENCE
A task is used to randomize the packet.txt
task body ();
abp_pkt pkt;
pkt = apb_pkt::type_id::create ("pkt");
repeat(5)
begin
start_item (pkt);
assert (pkt.randomize());
10
finish_item(pkt);
end
endtask
3.6 FUNCTIONAL COVERAGE
prstn INPUT
pselx INPUT
penable INPUT
paddr INPUT
pwrite INPUT
pwdata INPUT
pclk INPUT
prdata OUTPUT
pslver OUTPUT
pready OUTPUT
TESTCASE SCENARIOS
Appendix A: References
13
[Insert the name, version number, description, and physical location of any
documents referenced in this document. Add rows to the table as necessary.]
The following table summarizes the documents referenced in this document.
Document Description Location
Name and
Version
<Document [Provide description of the <URL or Network path where
Name and document] document is located>
Version
Number>
14