This commit is contained in:
2026-06-12 07:53:32 +02:00
commit 59e71f3297
259 changed files with 29010 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
/****************************************************************************
+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
|F|u|n|c|t|i|o|n|a|l| |V|e|r|i|f|i|c|a|t|i|o|n| |o|f| |H|a|r|d|w|a|r|e|
+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
FILE apb_test_top.sv
DESCRIPTION top module
- connects DUT and interface
- generates clk and reset
- runs UVM test
****************************************************************************/
`ifndef APB_TEST_TOP_SV
`define APB_TEST_TOP_SV
/**
* Module: apb_test_top
*/
module apb_test_top;
import uvm_pkg::*; // import the UVM library
`include "uvm_macros.svh" // Include the UVM macros
import apb_pkg::*; // import the APB pkg
`include "apb_test_lib.sv"
`include "dut.sv"
logic clock;
logic reset;
// interface
apb_if apb_vif(clock, reset);
// DUT
dut #( .ADDR_WIDTH(32),
.RDATA_WIDTH(32),
.WDATA_WIDTH(32),
.SLV_NUM(15)
) dut_inst (
.paddr (apb_vif.paddr ),
.psel (apb_vif.psel ),
.penable (apb_vif.penable),
.pwrite (apb_vif.pwrite ),
.pwdata (apb_vif.pwdata ),
.pready (apb_vif.pready ),
.prdata (apb_vif.prdata ),
.pslverr (apb_vif.pslverr)
);
// set interface in db; run UVM test
initial begin
uvm_config_db#(virtual apb_if)::set(null,"uvm_test_top.*","apb_if", apb_vif);
run_test();
end
// initialize clock and reset
initial begin
clock <= 1'b0;
reset <= 1'b0;
#50 reset <= 1'b1;
end
// generate clock
always #5 clock = ~clock;
endmodule : apb_test_top
`endif

View File

@@ -0,0 +1,36 @@
/****************************************************************************
+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
|F|u|n|c|t|i|o|n|a|l| |V|e|r|i|f|i|c|a|t|i|o|n| |o|f| |H|a|r|d|w|a|r|e|
+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
FILE dut.sv
DESCRIPTION
****************************************************************************/
`ifndef DUT_SV
`define DUT_SV
/**
* Module: dut
*/
module dut#(
parameter ADDR_WIDTH = 32,
parameter RDATA_WIDTH = 32,
parameter WDATA_WIDTH = 32,
parameter SLV_NUM = 15
)
(
ref logic [ADDR_WIDTH - 1 : 0] paddr,
ref logic [SLV_NUM - 1 : 0] psel,
ref logic penable,
ref logic pwrite,
ref logic [WDATA_WIDTH - 1 : 0] pwdata,
ref logic pready,
ref logic [RDATA_WIDTH - 1 : 0] prdata,
ref logic pslverr
);
endmodule : dut
`endif

View File

@@ -0,0 +1,48 @@
/****************************************************************************
+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
|F|u|n|c|t|i|o|n|a|l| |V|e|r|i|f|i|c|a|t|i|o|n| |o|f| |H|a|r|d|w|a|r|e|
+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
FILE apb_test_base.sv
DESCRIPTION base test to be extended by other tests
****************************************************************************/
`ifndef APB_TEST_BASE_SV
`define APB_TEST_BASE_SV
/**
* Class: apb_test_base
*/
class apb_test_base extends uvm_test;
// UVM factory registration
`uvm_component_utils (apb_test_base)
// main environment
apb_env env;
// new - constructor
function new(string name = "apb_test_base", uvm_component parent = null);
super.new(name, parent);
endfunction : new
// UVM build_phase
function void build_phase(uvm_phase phase);
super.build_phase(phase);
// build environment
env = apb_env::type_id::create("env", this);
endfunction : build_phase
// UVM end_of_elaboration_phase
function void end_of_elaboration_phase(uvm_phase phase);
super.end_of_elaboration_phase(phase);
// display verification environment topology
uvm_top.print_topology();
endfunction : end_of_elaboration_phase
endclass : apb_test_base
`endif

View File

@@ -0,0 +1,18 @@
/****************************************************************************
+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
|F|u|n|c|t|i|o|n|a|l| |V|e|r|i|f|i|c|a|t|i|o|n| |o|f| |H|a|r|d|w|a|r|e|
+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
FILE apb_test_lib.sv
DESCRIPTION test includes
****************************************************************************/
`ifndef APB_TEST_LIB_SV
`define APB_TEST_LIB_SV
`include "apb_test_base.sv"
`include "apb_test_simple.sv"
`endif

View File

@@ -0,0 +1,59 @@
/****************************************************************************
+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
|F|u|n|c|t|i|o|n|a|l| |V|e|r|i|f|i|c|a|t|i|o|n| |o|f| |H|a|r|d|w|a|r|e|
+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
FILE apb_test_simple.sv
DESCRIPTION simple test for debug
****************************************************************************/
`ifndef APB_TEST_SIMPLE_SV
`define APB_TEST_SIMPLE_SV
/**
* Class: apb_test_simple
*/
class apb_test_simple extends apb_test_base;
// UVM factory registration
`uvm_component_utils (apb_test_simple)
// sequences
apb_master_simple_seq master_seq;
apb_slave_simple_seq slave_seq;
// new - constructor
function new(string name = "apb_test_simple", uvm_component parent = null);
super.new(name, parent);
endfunction : new
// UVM build_phase
function void build_phase(uvm_phase phase);
super.build_phase(phase);
// build all sequences
master_seq = apb_master_simple_seq::type_id::create("master_seq");
slave_seq = apb_slave_simple_seq::type_id::create("slave_seq");
endfunction : build_phase
// UVM run_phase
task run_phase(uvm_phase phase);
assert(master_seq.randomize()); // random fields in master seq.
phase.raise_objection(this); // test cannot end yet
// start all sequences
fork
master_seq.start(env.master.seqr);
slave_seq.start(env.slaves[0].seqr); // runs forever
join_any
// only way to get here is if master sequence finished
phase.drop_objection(this); // test can end
endtask : run_phase
endclass : apb_test_simple
`endif