Advanced Peripheral Bus 3 : Verification IP

Overview

This is a simple case study on the APB3 VIP which I built in my spare time. The architecture will be similar to some models you might have seen online, but mostly it is different but still easy to understand. I'll start with explaining the testplan, checkplan, then the architecture of the UVM VIP itself and then we'll move onto the file structure of the VIP. Also, it will give you an idea of how a test plan is supposed to look like.




Advice to any new reader : If you are feeling this is too overwhelming, then these are the things I recommentd you follow in order to understand this VIP.

1. Go through the VIP Package file ( HERE ) to understand the order of compilation
2. Understand the VIP Architecture and review the TOP FILE ( HERE ) to understand how the VIP and the RTL are interacting with each other.
3. Finally, take a simple test as a reference and review the code for all the components

APB3 VIP UVM Architecture
Example UVM Testbench Architecture
VIP File Structure
/*
    vip_amba_apb_ms_uvm ( parent-directory )
    |- common ( dir )
    |   |- include ( dir )
    |   |   |- vip_amba_apb_common_defines.svh
    |   |   |- vip_amba_apb_common_parameters.svh
    |   |   
    |   |- vip_amba_apb_env_config.sv
    |   |- vip_amba_apb_interface.sv
    |   |- vip_amba_apb_test_config.sv
    |   |- vip_amba_apb_txn_item.sv
    |   
    |- bfm ( dir )
    |   |- master_bfm ( dir )
    |   |   |- include ( dir )
    |   |   |   |- vip_amba_apb_bridge_bfm_defines.svh
    |   |   |   
    |   |   |- vip_amba_apb_bridge_bfm.sv
    |   |   |- vip_amba_apb_bridge_bfm_interface.sv
    |   |   
    |   |- slave_bfm ( dir )
    |       |- include ( dir )
    |       |   |- vip_amba_apb_slave_bfm_defines.svh
    |       |   
    |       |- vip_amba_apb_slave_bfm.sv
    |       |- vip_amba_apb_slave_bfm_interface.sv
    |   
    |- env ( dir )
    |   |- environment ( dir )
    |   |   |- vip_amba_apb_env.sv
    |   |   
    |   |- monitor ( dir )
    |   |   |- include ( dir )
    |   |   |   |- vip_amba_apb_monitor_error_id.svh
    |   |   |   |- vip_amba_apb_monitor_include.svh
    |   |   |   
    |   |   |- vip_amba_apb_assertion.sv
    |   |   |- vip_amba_apb_cover_collector.sv
    |   |   |- vip_amba_apb_monitor.sv
    |   |   |- vip_amba_apb_monitor_agent.sv
    |   |   
    |   |- scoreboard ( dir )
    |   |   |- vip_amba_apb_scoreboard.sv
    |   |   |- vip_amba_apb_scoreboard_agent.sv
    |   |   
    |   |- master ( dir )
    |   |   |- vip_amba_apb_master_agent.sv
    |   |   |- vip_amba_apb_master_driver.sv
    |   |   |- vip_amba_apb_master_sequencer.sv
    |   |   
    |   |- slave ( dir )
    |       |- vip_amba_apb_slave_agent.sv
    |       |- vip_amba_apb_slave_driver.sv
    |       |- vip_amba_apb_slave_sequencer.sv
    |       
    |- seq ( dir )
    |   |- seq_list ( dir )
    |   |   |- vip_amba_apb_callbacks.sv
    |   |   |- vip_amba_apb_sequences.sv
    |   |   
    |   |- vip_amba_apb_base_sequence.sv
    |   
    |- test ( dir )
    |   |- test_list ( dir )
    |   |   |- vip_amba_apb_master_tests.sv
    |   |   
    |   |- vip_amba_apb_base_test.sv
    |   
    |- sim_run ( dir )
        |- Makefile
        |- apb_filter.filter
        |- comp_filelist ( dir )
        |   |- compile_filelist.list
        |   
        |- dut_integration_top ( dir )
        |   |- vip_amba_apb_vip_dut_top.sv
        |   
        |- gtkapb.gtkw
        |- regress_script.sh
        |- regression_list.list
        |- regression_list_slave.list
        |- summary_script.sh
        |- tb_top ( dir )
        |   |- vip_amba_apb_tb_top.sv
        |   
        |- vip_pkg ( dir )
        |   |- vip_amba_apb_pkg.sv
        |   
        |- wave.do
*/

Individual Files Description & Source Code ( Click the filename to access the file source code )
Implementation pending file ( no impact of VIP right now )
Unused APB3 master BFM ( built in a generic manner to support any application layer protocol ) ( THIS IS A EMULATION SUPPORTING BUILD, but is not being used as the BFM in this VIP. Instead the Driver itself is being used as a APB3 Master BFM )
Bridge BFM interface ( currently unused )
Slave BFM interface ( unused since this is not needed as the slave bfm is non synthesizable model )
VIP specific common parameters definition & declaration file
VIP specific common defines files
Common uvm test config file ( this in my case is required to support the error suppression and errors tracking mechanism I implemented, but otherwise this does nto have anything special )
Environment configuration file
Sequence Item file for this VIP
Common VIP APB interface
VIP Monitor specific defines and macros
Monitor ERROR_IDs list and declaration
APB assertion file ( Unimplemented right now. You can skip this )
Coverage Collector File ( only basic implementation is there )
APB3 monitor file ( all checks and sampling logics are here )
APB3 Master Driver & Master BFM Model
Slave Sequencer ( but is not begin used in full effect since in APB, a slave cannot initiate transactions )
Slave Driver ( like the slave components, this also is not primarily used )
APB3 scoreboard code ( transaction scoreboarding is done here )
All the VIP test sequences are present here
The callback logic is here which is used to inject error in the BFMs
The VIP wrapper code is present here. Along with this, additional logic for DUMP file generations and clock generation logic is present here.
Bash script required setting a few neccessary Linux Environment Variables
Slave specific tests regression list. Has a list of tests specific to slave rtl testing. ( VIP is in Master mode and Slave is the DUT )
Regression running script. You can see it if you feel like, but everyone implements it differently as per requirement.
VIP compilation package file. The order or compilation of the files and their inclusion is mentioned here. Read this if you are trying to understand how VIP is being compiled.
DUT Top ( this is where integration is done. But this is only used when internal testing is being done. When an actual RTL is integrated, a different file is used which is more aligned with the real world use cases. )
Common regression list with all the tests
VIP specific Makefile
This file is provided to the simulator, to help it understand where all it is supposed to lok for files when compiling a package or an include file.
Simulation run and regression run summary generation script for better redability.
APB VIP Base Test Code