AHB (AHB-Lite/AHB Full) Protocol Verification IP
AHB VIP
Professional-grade AMBA AHB verification component supporting both AHB-Lite and AHB Full with master/slave agents, protocol checkers, and built-in scoreboard
๐ Overview
The KVIPS AHB VIP provides a comprehensive verification environment for AMBA AHB-Lite and AHB Full protocols in a single compiled image with runtime mode selection. It includes:
๐ฏ Master Agent
- Single and burst transfers (INCR4/8/16, WRAP4/8/16)
- Configurable address/control pipelining
- Variable HSIZE (byte/half/word/dword)
- Configurable inter-transaction delays
- Runtime mode switch: AHB-Lite vs AHB Full
๐ Slave Agent
- Flexible memory model with byte-addressable storage
- Configurable wait states (HREADY control)
- Error injection (OKAY/ERROR responses)
- Address range-based error injection
- Stall modeling for realistic timing
โ Protocol Checkers
- Hold-stability assertions while stalled
- Known/X checks on control signals
- AHB-Lite response legality (no RETRY/SPLIT)
- Burst legality and boundary checks
- Runtime assertion enable/disable switches
๐ Verification Features
- Monitor-based expected memory scoreboard
- Transaction reconstruction and logging
- Functional coverage (size, burst, stalls, responses)
- Performance statistics and counters
- End-of-test summary reporting
๐ Protocol Mode Selection
The AHB VIP supports both AHB-Lite and AHB Full in a single compiled image. Select the mode at runtime:
# AHB-Lite mode (default) - single master, OKAY/ERROR responses only
+AHB_MODE=AHB_LITE
# AHB Full mode - extended features (arbiter support planned)
+AHB_MODE=AHB_FULL
๐งช RTL-DUT verification
The examples/uvm_dut/ environment drives a synthesizable, reset-initialized
AHB RAM responder with the KVIPS master. Its six-test gate covers single
transfers, INCR and WRAP bursts, fixed wait states, back-to-back stress, and
AHB Full mode. Each simulator regression requires real read/write handshakes,
zero responder errors, zero scoreboard mismatches, and wait-state evidence for
the wait-state test.
make -C ahb/examples regress-rtl-questa USE_LSF=1
make -C ahb/examples regress-rtl-vcs USE_LSF=1
make -C ahb/examples regress-rtl-xcelium USE_LSF=1
make -C ahb/examples rtl-questa RTL_TEST=ahb_dut_full_mode_test PLUSARGS='+AHB_MODE=AHB_FULL'
Verilator runs the same DUT list in CI for portable coverage; commercial
simulator logs are the evidence-bearing validation. See the
AHB DUT verification guide.
๐ Quick Start
Run Example Tests
Navigate to the AHB examples directory and run tests:
cd ahb/examples/
# List available tests
make list-tests
# Run smoke test on Questa
make questa TEST=ahb_smoke_test
# Run with AHB Full mode
make questa TEST=ahb_smoke_test PLUSARGS='+AHB_MODE=AHB_FULL'
# Run wait state test on VCS
make vcs TEST=ahb_wait_state_test
# Run stress test on Xcelium
make xcelium TEST=ahb_random_stress_test
# Run on Verilator
make verilator TEST=ahb_smoke_test
# Full Verilator regression
make regress-verilator
# RTL-DUT regression (commercial simulator)
make regress-rtl-questa USE_LSF=1
# Run with LSF (if tools require job scheduler)
make questa USE_LSF=1 TEST=ahb_smoke_test
๐ Note: SVA assertions are skipped under Verilator.
Available Test Cases
| Test Name | Description |
|---|---|
ahb_smoke_test |
Basic SINGLE transfers (read/write) |
ahb_wait_state_test |
Tests slave wait state insertion |
ahb_back_to_back_test |
Burst transfers with minimal gaps |
ahb_random_stress_test |
Random bursts, sizes, and stalls |
ahb_error_test |
Error response injection testing |
RTL-DUT tests
| Test Name | Description |
|---|---|
ahb_dut_smoke_test |
RAM DUT single-transfer read/writeback |
ahb_dut_incr_burst_test |
RAM DUT INCR4/8/16 bursts |
ahb_dut_wrap_burst_test |
RAM DUT WRAP4/8/16 bursts |
ahb_dut_wait_state_test |
RAM DUT fixed wait-state handshakes |
ahb_dut_stress_test |
RAM DUT mixed back-to-back traffic |
ahb_dut_full_mode_test |
RAM DUT run with +AHB_MODE=AHB_FULL |
๐ Architecture
Component Hierarchy
ahb_env
โโโ ahb_agent (master)
โ โโโ ahb_sequencer
โ โโโ ahb_master_driver
โ โโโ ahb_monitor
โโโ ahb_agent (slave)
โ โโโ ahb_sequencer
โ โโโ ahb_slave_driver
โ โโโ ahb_monitor
โโโ ahb_scoreboard
โโโ ahb_txn_logger (optional)
Directory Structure
kvips/ahb/
โโโ sv/
โ โโโ if/
โ โ โโโ ahb_if.sv # AHB interface + clocking blocks
โ โโโ assertions/
โ โ โโโ ahb_if_sva.svh # Protocol assertions (SVA)
โ โโโ pkg/
โ โ โโโ ahb_types_pkg.sv # Type definitions, enums
โ โ โโโ ahb_uvm_pkg.sv # UVM package
โ โโโ uvm/
โ โโโ ahb_cfg.svh # Configuration object
โ โโโ ahb_transaction.svh # Transaction item
โ โโโ ahb_sequencer.svh # Sequencer
โ โโโ ahb_master_driver.svh # Master driver
โ โโโ ahb_slave_driver.svh # Slave driver
โ โโโ ahb_monitor.svh # Passive monitor
โ โโโ ahb_scoreboard.svh # Data integrity checker
โ โโโ ahb_agent.svh # Agent wrapper
โ โโโ ahb_env.svh # Environment
โ โโโ ahb_sequences.svh # Sequence library
โ โโโ ahb_txn_logger.svh # Transaction logger
โโโ docs/
โ โโโ user_guide.md # Detailed usage guide
โ โโโ integration_guide.md # Integration instructions
โ โโโ dut_verification.md # RTL-DUT topology and evidence gate
โ โโโ supported_features.md # Feature list & roadmap
โ โโโ assertions.md # Assertion documentation
โ โโโ testplan.md # Test coverage plan
โ โโโ directory_structure.md # File organization
โโโ examples/
โ โโโ uvm_back2back/ # Self-contained VIP-to-VIP demo
โ โโโ uvm_dut/ # KVIPS master to synthesizable RAM DUT
โโโ README.md # Quick reference
โ๏ธ Configuration
Key Configuration Knobs
class ahb_cfg extends uvm_object;
// Protocol Mode
ahb_mode_t mode = AHB_MODE_LITE; // AHB_MODE_LITE or AHB_MODE_FULL
// Slave Configuration - Wait States
bit allow_wait_states = 1;
int unsigned min_wait = 0; // Minimum wait cycles
int unsigned max_wait = 5; // Maximum wait cycles
// Slave Configuration - Error Injection
bit err_enable = 0; // Enable error injection
bit [31:0] err_addr_lo = 0; // Error range start
bit [31:0] err_addr_hi = 0; // Error range end
int unsigned err_pct = 10; // Error probability %
// Master Configuration - Burst Policy
bit allow_bursts = 1; // Enable burst transfers
bit allow_wrap = 1; // Enable WRAP bursts
int unsigned max_incr_len = 16; // Max INCR burst length
// Debug & Coverage
bit trace_enable = 0; // Transaction tracing
bit coverage_enable = 1; // Coverage sampling
// Assertion Control
bit assertions_enable = 1; // Enable SVA checks
// Address Configuration
bit [31:0] addr_min = 32'h0000_0000;
bit [31:0] addr_max = 32'hFFFF_FFFF;
endclass
Runtime Configuration via Plusargs
# Protocol mode selection
+AHB_MODE=AHB_LITE # Default: AHB-Lite mode
+AHB_MODE=AHB_FULL # AHB Full mode
# Debug options
+VIP_TRACE # Enable transaction tracing
+UVM_VERBOSITY=UVM_HIGH # Verbose UVM messaging
# Scoreboard options
+KVIPS_AHB_SB_WARN_UNINIT # Warn on reads from uninitialized memory
๐ Supported Features
โ Currently Supported (v0.1)
Protocol Support
- โ Single-bus, single-master operation (AHB-Lite style)
- โ Runtime mode selection: AHB-Lite vs AHB Full
- โ Basic responses: OKAY and ERROR
- โ Address/control pipelining with HREADY stall handling
Transfer Types
- โ SINGLE transfers
- โ INCR4/8/16 burst transfers
- โ WRAP4/8/16 burst transfers with wrap addressing
- โ Variable HSIZE (byte/half-word/word/double-word)
VIP Components
- โ Master agent: drives transfers with correct address/control vs data phasing
- โ Slave agent: responds with HREADYOUT/HRESP/HRDATA, captures writes
- โ Passive monitor: reconstructs completed transfers
- โ Scoreboard: monitor-based expected memory model
- โ Transaction logger: per-transfer logging + end-of-test summary
Timing & Stalls
- โ Configurable wait-state insertion (slave)
- โ Hold-stability during stalls
- โ Inter-transaction gap control (master)
Debug & Verification
- โ
Interface-bound SVA assertions
- Hold-stability while stalled
- Known/X checks on control signals
- AHB-Lite response legality
- โ
Functional coverage
- Read/write operations
- Transfer sizes
- Burst types and lengths
- Wait state bins
- Response types
- Cross-coverage matrices
๐ Planned Features (Future Releases)
AHB Full Enhancements
- ๐ Multi-master arbitration support
- ๐ HMASTER behavior tracking
- ๐ SPLIT/RETRY response handling
- ๐ HSPLITx signal support
Protocol Enhancements
- ๐ BUSY insertion and legality checking
- ๐ Stricter wrap boundary alignment enforcement
- ๐ Endianness configuration (currently little-endian)
- ๐ Multiple slave regions with interconnect-like decode
Advanced Features
- ๐ Full UVM transaction recording (UVM TR) integration
- ๐ Performance monitoring and bottleneck analysis
- ๐ Advanced constrained random coverage
- ๐ Formal verification property exports
๐ Debug Workflow
Recommended Bring-Up Sequence
- Start with basic transfers:
make questa TEST=ahb_smoke_testVerifies basic SINGLE read/write operations
- Enable wait states:
make questa TEST=ahb_wait_state_testTests slave stall insertion and hold-stability
- Enable burst stress:
make questa TEST=ahb_back_to_back_test make questa TEST=ahb_random_stress_testTests various burst types and random traffic
- Enable error injection:
make questa TEST=ahb_error_testTests error response handling
Debug Options
# Verbose UVM messaging
+UVM_VERBOSITY=UVM_HIGH
# Enable transaction tracing
+VIP_TRACE
# Warn on uninitialized memory reads
+KVIPS_AHB_SB_WARN_UNINIT
# Waveform dumping
+KVIPS_WAVES
๐ Detailed Documentation
For comprehensive information, refer to the following source documents in
ahb/docs/:
- User Guide - Detailed configuration and usage
- Integration Guide - Step-by-step integration
- Supported Features - Complete feature list
- Assertions - SVA checker documentation
- Testplan - Test coverage mapping
- Directory Structure - File organization
๐ก Integration Example
Minimal Testbench Integration
// 1. Instantiate AHB interface
ahb_if ahb_if_inst (
.HCLK(clk),
.HRESETn(rst_n)
);
// 2. In your UVM environment
class my_env extends uvm_env;
ahb_env ahb_env_inst;
function void build_phase(uvm_phase phase);
super.build_phase(phase);
// Create AHB configuration
ahb_cfg cfg = ahb_cfg::type_id::create("cfg");
cfg.mode = AHB_MODE_LITE;
cfg.allow_wait_states = 1;
cfg.max_wait = 5;
cfg.trace_enable = 1;
// Set virtual interface
if (!uvm_config_db#(virtual ahb_if)::get(this, "", "vif", cfg.vif))
`uvm_fatal("ENV", "Failed to get AHB interface")
// Create environment
uvm_config_db#(ahb_cfg)::set(this, "ahb_env_inst", "cfg", cfg);
ahb_env_inst = ahb_env::type_id::create("ahb_env_inst", this);
endfunction
endclass
// 3. Start sequences
class my_test extends uvm_test;
task run_phase(uvm_phase phase);
ahb_single_seq seq;
phase.raise_objection(this);
seq = ahb_single_seq::type_id::create("seq");
seq.addr = 32'h1000;
seq.data = 32'hDEADBEEF;
seq.is_write = 1;
seq.start(env.ahb_env_inst.master_agent.sequencer);
phase.drop_objection(this);
endtask
endclass
๐ Example Tests
Located in kvips/ahb/examples/uvm_back2back/:
examples/
โโโ tb/
โ โโโ top.sv # Top-level testbench
โ โโโ test_pkg.sv # Test package
โโโ tests/
โ โโโ ahb_base_test.sv
โ โโโ ahb_smoke_test.sv
โ โโโ ahb_wait_state_test.sv
โ โโโ ahb_back_to_back_test.sv
โ โโโ ahb_random_stress_test.sv
โโโ sim/
โโโ Makefile
โโโ run_questa.sh
โโโ run_vcs.sh
โโโ run_xcelium.sh
๐ง Validated Tool Versions
๐ Support & Resources
๐ Documentation
๐ฌ Community
Ready to Verify AHB Designs?
Get started with KVIPS AHB VIP and accelerate your verification!
Get Started View on GitHub