Verification of AMBA Bus Model Using SystemVerilog
Verification of AMBA Bus Model Using SystemVerilog
Abstract: A verification environment to verify an ARM-based hardware concepts such as cycles, tri-state values,
SoC (System-on-Chip) by using SystemVerilog is presented in wires, just like Verilog hardware languages. So
this paper. The new verification constructs can be easily reused SystemVerilog can be used to simulate the HDL
for the objected-oriented feature of SystemVerilog. The paper design and verify them by high level test case.
also introduced how to design the AMBA (Advanced In this paper, how to put up the simulation
Microprocessors Bus Architecture) verification IP (Intellectual environment using SystemVerilog is introduced. The
Property) by SystemVerilog, which include AHB (Advanced simulation environment using by SystemVerilog is
High Performance Bus) Master and AHB Monitor. The efficient and high-performance. The paper discusses
verification IP can be reused to verify any AMBA protocol the usage experience to verify an SoC by the AMBA
based SoC. To reduce the time spending in the verification, a verification IP and the AHB monitor.
reference model designing method is also discussed in the During verify the SoC, a great deal of visual
paper. simulation waveform inspection is required. To
Keywords: SoC, AMBA, SystemVerilog, Reference model, generate the waveform will be time-consuming. The
Verification IP paper presents SoC bus transaction verification IP
1 Introduction written by SystemVerilog, which are called reference
model to compare the behavior of the DUT. The IP
The tremendous progress of VLSI technology can be integrated into SystemVerilog simulation
enables the integration of more than several million environment. By using the reference model, we can
transistors in a single chip to make a SoC greatly reduce the waveform inspection time.
(System-on-Chip). This has made verification the
most critical bottleneck in the chip design flow.
2 SystemVerilog Verification
Roughly 70 to 80 percent of the design cycle is spent Environment
in functional verification. However, the test program
The main purpose of the verification environment
need to provide more automation to maximize the
is to generate stimulus, apply stimulus to the DUT
functional coverage from each test case and reduce the
(design under test), and check results to verify that the
time needed to create a test case[1-3]. So there is a
function is correct. Then test cases may be modified or
tradeoff between the sophistication of the verification
added referring to the coverage reports. By using
program and the time spent developing it.
SystemVerilog we can easily do these works.
SystemVerilog is a special hardware verification
2.1 Introduction of the Verification Environment
language to be used in function verification. It
provides the high-level data structures available in Figure 1 shows the contracture of the
object-oriented languages, such as C++. These data SystemVerilog verification environment. The
structures enable a higher level of abstraction and environments include the DUT written by Verilog
modeling of complex data types. The SystemVerilog HDL, SystemVerilog test bench which include
also provides constructs necessary for modeling SystemVerilog interface, simulation top module, and
test program. In the SystemVerilog test bench, the
generator can be used to create constrained random
test vectors. These test vectors are sent to the driver,
1-4244-1135-1/07/$25.00 ©2007 IEEE.
1-776
The Eighth International Conference on Electronic Measurement and Instruments ICEMI’2007
reports. These test bench components are all designed Channel Channel
ARM 7TDMI
Reference
DMA Generator (Replace by
Model
VIP Master)
Master Master
Arbiter AHB AHB
/Decoder Monitor
Slave Slave Slave Slave
APB
The ARM7TDMI master ports are wired by the VIP Generate configuration Wait for end
env.gen_cfg() env.wait_for_end()
master. The ports used by the monitor are wired
directly from the AHB bus. Build environment Stop environment
env.build() env.stop()
interface test _ahb_if(input hclk);
logic hresetn; Reset the DUT Sweep DUT and reports
logic [`AHB_DATA_WIDTH-1:0] hrdata; env.reset_dut() env.cleanup()
ĂĂ
//interface only used for the monitor
logic [`AHB_ADDR_WIDTH -1:0] haddr; Configure DUT Report pass/fail
logic hsel; env.cfg_dut env.report()
logic [`AHB_DATA_WIDTH-1:0] hwdata;
logic hgrant;
Start environment
logic hwrite; End Test
env.start()
ĂĂ
//interface only used for the VIP Master
logic [`AHB_ADDR_WIDTH -1:0] arm 1_haddr; Fig. 4 Executing Flow in the Verification
logic [`AHB_DATA_WIDTH-1:0] arm1_hwdata;
logic [`AHB_DATA_WIDTH-1:0] arm1_hrdata;
logic arm1_hgrant;
logic arm1_hwrite;
2.3 VIP Master Behavior Analysis
ĂĂ
clocking monitor_cb @(posedge HClk);
//default input #1skew output #0;
The VIP Master has two operating modes:
input hresetn; protocol-related and buffer access. Protocol related
input hrdata;
input haddr; features generate bus cycles and transfer responses to
input hesl;
input hwdata; slave response types. Buffer access features allow us
ĂĂ
endclocking
to create burst transfers in advance and reuse the burst
clocking master_cb @(posedge HClk); information. So it can give the DUT proper test to
default input#1 output #1;
input hresetn verify DUT’s protocol feature. VIP Master is not as
output arm1_haddr;
output arm1_hwata;
same as the ARM model. In the design, we use the
input arm1_hrata; ARM7TDMI core. The ARM7TDMI core uses a
output arm1_hwrite;
ĂĂ pipeline to increase the speed of the flow of
endclocking
modport Master(clocking master_cb); instructions to the processor. This allows several
modport Monitor(clocking monitor_cb);
endinterface
operations to take place simultaneously. A three stage
pipeline is used so instructions are executed in three
stages: fetch, decode and execute, as shown in fig
Fig. 3 Modport Define in the Test bench 5.While the instruction to be decoded by ARM may be
not necessary to verify.
During the simulation, the generator will transfer
test vectors by the channel to the VIP Master. Then the
master will drive the slaves. The reference model is
used to dynamically predict the response of the VIP
Master and compare with the data from the real slave.
The AHB monitor checks the bus protocol such as
which master requesting the bus and getting granted.
It also checks other AHB protocol such as the burst
type, the transfer size, and address increment size. Fig. 5 ARM7TDMI Simulation Waves
The executing flow of the SystemVerilog
simulation environment is shown in Fig.4. The first
step is to generate the configuration and connect
environment components, such as VIP master, monitor
and reference model. After reset the DUT, the
configuration will be downloaded into the DUT. Then
the VIP master, monitor, generator and reference
model will start and test begin. When the test is over,
logs will be generated and the designer can check the
reports. Fig. 6 VIP Master Simulation Waves
1-778
The Eighth International Conference on Electronic Measurement and Instruments ICEMI’2007
The VIP Master will not simulate the same behavior. (2) Decode address; if an address is in the range of
As shown in fig 6, the VIP Master need not fetch the the Flash memory map, then the Flash reference
next command when executing an instruction, because model begin working.
all the commands have been decoder when the test (3) Read operation, the address will be stored, and
vectors were designed. The VIP Master can verify if the data store in the address will be output to
the DUT behavior confirm to the AHB protocol and compare with the response of the DUT.
execute the necessary commands. So it can be faster (4) Write operation, the address will be stored and
to verify the function feature of the DUT than the the write data will be store in.
ARM. (5) Page erase, all the page unit address will be
calculate out and the memory will be filled with
3 Design of the Reference model 16’hFFFF.
(6) Mass erase, all the memory will be filled in 16’
Rreference model that we designed is used to hFFFF.
dynamically predict the response of the DUT. As The reference model includes initiate part,
shown in fig. 1 and fig. 2, the stimulus applied to the memory address decoding part, operation checking
DUT is concurrently provided to the reference model. part, and address/data store part. The initiate part
The reference model performs all the operations on can get all the memory initiate state by the VIP master.
the stimulus to produce the form of the final response The SRAM must be written before READ operation.
and then inserts it in a data structure. Response from So which the reference model needs to do is to store
the reference model is forward to be the same as the the write address and the write data. When read
DUT’s . address is given, the reference model should give the
The reference model is also a class which includes data if the address has been written data in. Else, the
local variables and methods. It has the transaction reference model should simulate the error information
level interface. So it can get the VIP Master’s stimulus like the SRAM.
Then a report will be generating when the
by the channel to share the data contracture of the VIP
simulation is end. In the report we can debug the DUT
Master. Then the stimulus will be stored in the design. As shown in table 1, if the DUT responses
reference model and expect response will be given to difference from the reference model, it will be
verify the DUT. The comparison of the observed lightened in the report.
response with the reference model’s is performed at Table 1 Report For the Verification
1-779
The Eighth International Conference on Electronic Measurement and Instruments ICEMI’2007
1-780