This document contains information that is proprietary to Mentor Graphics Corporation. The original recipient of this
document may duplicate this document in whole or in part for internal business purposes only, provided that this entire
notice appears in all copies. In duplicating any part of this document, the recipient agrees to make every reasonable
effort to prevent the unauthorized use and distribution of the proprietary information.
This document is for information and instruction purposes. Mentor Graphics reserves the right to make
changes in specifications and other information contained in this publication without prior notice, and the
reader should, in all cases, consult Mentor Graphics to determine whether any changes have been
made.
The terms and conditions governing the sale and licensing of Mentor Graphics products are set forth in
written agreements between Mentor Graphics and its customers. No representation or other affirmation
of fact contained in this publication shall be deemed to be a warranty or give rise to any liability of Mentor
Graphics whatsoever.
MENTOR GRAPHICS MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE.
MENTOR GRAPHICS SHALL NOT BE LIABLE FOR ANY INCIDENTAL, INDIRECT, SPECIAL, OR
CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING BUT NOT LIMITED TO LOST PROFITS)
ARISING OUT OF OR RELATED TO THIS PUBLICATION OR THE INFORMATION CONTAINED IN IT,
EVEN IF MENTOR GRAPHICS CORPORATION HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
RESTRICTED RIGHTS LEGEND 03/97
U.S. Government Restricted Rights. The SOFTWARE and documentation have been developed entirely
at private expense and are commercial computer software provided with restricted rights. Use,
duplication or disclosure by the U.S. Government or a U.S. Government subcontractor is subject to the
restrictions set forth in the license agreement provided with the software pursuant to DFARS 227.72023(a) or as set forth in subparagraph (c)(1) and (2) of the Commercial Computer Software - Restricted
Rights clause at FAR 52.227-19, as applicable.
Send Feedback on Documentation: supportnet.mentor.com/doc_feedback_form
TRADEMARKS: The trademarks, logos and service marks ("Marks") used herein are the property of
Mentor Graphics Corporation or other third parties. No one is permitted to use these Marks without the
prior written consent of Mentor Graphics or the respective third-party owner. The use herein of a thirdparty Mark is not an attempt to indicate Mentor Graphics as a source of a product, but is intended to
indicate a product from, or associated with, a particular third party. A current list of Mentor Graphics’
trademarks may be viewed at: www.mentor.com/trademarks.
This Mentor
application interface (API) of the Mentor VIP AE and how it conforms to the AMBA® AXI and
ACE Protocol Specification, AXI3TM, AXI4TTM, and AXI-LiteTM, ACE, and ACE-LiteTM
(ARM IHI 0022D).
®
Verification IP (VIP) Altera
This release supports only the AMBA AXI3, AXI4, AXI4-Lite, and AXI4-StreamTM
protocols. The AMBA ACE protocol is not supported in this release.
®
Edition (AE) User Guide describes the AXI3/AXI4
AMBA AXI Protocol Specification
The Mentor VIP AE conforms to the AMBA® AXI and ACE Protocol Specification, AXI3TM,
AXI4TTM, and AXI-LiteTM, ACE and ACE-LiteTM (ARM IHI 0022D). For restrictions to this
protocol, refer to the section Protocol Restrictions.
This user guide refers to the AMBA® AXI and ACE Protocol Specification, AXI3TM, AXI4TM,
and AXI-LiteTM, ACE and ACE-LiteTM as the AXI protocol specification.
Protocol Restrictions
The Mentor VIP AE supports all but the following features of this AXI Specification, which
gives you a simplified API to create desired protocol stimulus.
BFM Dependencies Between Handshake Signals
Starting a write data phase before its write address phase in a transaction is not supported.
However, starting a write data phase simultaneously with its write address phase is supported.
The above statement disallowing a write data phase to start before its write address phase in a
transaction modifies the AXI3 protocol specification write transaction handshake dependencies
diagram, Figure A3-6 in section A3.3.1, by effectively adding double-headed arrows between
AWVALID to WVALID and AWREADY to WVALID, with the provision that they can be
simultaneous.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
1
Preface
Supported Simulators
The above statement disallowing a write data phase to start before its write address phase in a
transaction modifies the AXI4 protocol specification slave write response handshake
dependencies diagram, Figure A3-7 in section A3.3.1, by effectively adding double-headed
arrows between AWVALID to WVALID and AWREADY to WVALID, with the provision that
they can be simultaneous.
AXI3 BFM Write Data Interleaving
The ability of a BFM to interleave write data is not supported. Therefore, a write data burst that
has started will complete before another write data burst with the same or different transaction
ID can start. An AXI3 BFM modifies the AXI protocol specification by removing section
A5.3.3 concerning the interleaving of write data with different AWID signal values.
BFM Read Data Interleaving
The ability of a BFM to interleave read data is not supported. Therefore, a read data burst that
has started will complete before another read data burst with the same or different transaction
ID can start. A BFM modifies the AXI protocol specification by changing the following
statement in section A5.3.1 concerning the interleaving of read data with different ARID signal
values.
•Read data of transactions with different ARID values cannot be interleaved.
Supported Simulators
Mentor VIP AE supports the following simulators:
•Mentor Graphics Questa Sim and ModelSim SE 10.2b/10.1d on Linux
•Mentor Graphics Questa Sim and ModelSim SE 10.1d on Windows
•Mentor Graphics ModelSim DE/PE/AE 10.1d on Linux and Windows
•Synopsys
•Cadence
®
VCS® and VCS-MX 2013.06 on Linux
®
Incisive® Enterprise Simulator (IES) 12.20.014 on Linux
2
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
Preface
Simulator GCC Requirements
Simulator GCC Requirements
Mentor Verification IP requires that the simulator’s installation directory includes the GCC
libraries shown in Table 1. If the installation of the GCC libraries was an optional part of the
simulator’s installation and the Mentor VIP does not find these libraries, you will see an error
similar to the following error:
ModelSim / Questa Sim
# ** Error: (vsim-8388) Could not find the MVC shared library : GCC not
found in installation directory (/home/user/altera2/13.1/modelsim_ase) for
platform "linux". Please install GCC version "gcc-4.5.0-linux"
Although a 32-bit executable simulation is supported, IES requires a 64-bit Linux
OS. A 32-bit Linux OS is no longer supported.
Use the cds_tools.sh executable to find the Incisive installation. Ensure $PATH
includes the Installation path and <install dir>/tools/cdsgcc/gcc/4.4/install/bin. Also,
ensure the LD_LIBRARY_PATH includes <install
dir>/tools/cdsgcc/gcc/4.4/install/lib.
$VCS_HOME/gnu/4.5.2_32-shared
$VCS_HOME/gnu/4.5.2_64-shared
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
3
Preface
AXI3 and AXI4 Syntax References
AXI3 and AXI4 Syntax References
Throughout this user guide, the syntax axi or axi4 is used when an AXI3 or AXI4 protocol
argument is referenced: axi is used for AXI3 protocol arguments; axi4 is used for AXI4 protocol
arguments. Uppercase AXI3 and AXI4 is used for enumerated arguments.
When a task is applicable to both AXI3 and AXI4 protocols, either a single (*) or double
asterisk (**) is used in the syntax description. A single asterisk is used for nonenumerated
arguments; a double asterisk is used for enumerated arguments.
4
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
Chapter 1
Mentor VIP Altera Edition
The Mentor® Verification IP (VIP) Altera® Edition (AE) provides bus functional models
(BFMs) to simulate the behavior and to facilitate IP verification. The Mentor VIP AE includes
the following interfaces:
•AXI3
•AXI4
TM
BFM with master, slave, and inline monitor interfaces
TM
BFM with master, slave, and inline monitor interfaces
Advantages of Using BFMs and Monitors
Using the Mentor VIP AE has the following advantages:
•Accelerates the verification process by providing key verification testbench
components.
•Provides BFM components that implement the AMBA AXI Protocol Specification,
which serves as a reference for the protocol.
•Provides a full suite of configurable assertion checking in each BFM.
Implementation of BFMs
The Mentor VIP AE BFMs, master, slave, and inline monitor components are implemented in
SystemVerilog. Also included are wrapper components so that the BFMs can be used in VHDL
verification environments with simulators that support mixed-language simulation.
The Mentor VIP AE provides a set of APIs for each BFM that you can use to construct,
instantiate, control, and query signals in all BFM components. Your test programs must use
only these public access methods and events to communicate with each BFM. To ensure
support in current and future releases, your test programs must use the standard set of APIs to
interface with the BFMs. Nonstandard APIs and user-generated interfaces can not be supported
in future releases.
The test program drives the stimulus to the DUTs and determines whether the behavior of the
DUTs is correct by analyzing the responses. The BFMs translate the test program stimuli
(transactions), creating the signaling for the AMBA AXI Protocol Specification. The BFMs also
check for protocol compliance by firing an assertion when a protocol error is observed.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
5
Mentor VIP Altera Edition
Note
What Is a Transaction?
What Is a Transaction?
A transaction for Mentor VIP AE represents an instance of information that is transferred
between a master and a slave peripheral, and that adheres to the protocol used to transfer the
information. For example, a write transaction transfers an address phase, a data burst, followed
by a response phase. A subsequent instance of transferred information requires a new and
unique transaction.
Each transaction has a dynamic Transaction Record that exists for the life of the transaction.
The life of a transaction record starts when it is created and ends when the transaction
completes. The transaction record is automatically discarded when the transaction ends. When
created, a transaction contains transaction fields that you set to define two transaction aspects:
the protocol fields that are transferred over the protocol signals and operation fields that
determine how the information is transferred and when the transfer is complete. For example, a
write transaction record holds the protection information in the prot protocol field; the value of
this field is transferred over the AWPROT protocol signals during an address phase. A write
transaction also has a transaction_done operation field that indicates when the transaction is
complete; this field is not transferred over the protocol signals. These two types of transaction
fields, protocol and operation, establish a dynamic record during the life of the transaction.
In addition to transaction fields, you specify arguments to tasks, functions, and procedures that
permit you to create, set, and get the dynamic transaction record during the lifetime of a
transaction. Each BFM has an API that controls how you access the BFM transaction record.
How you access the record also depends on the source code language, whether it is VHDL or
SystemVerilog. Methods for accessing transactions based on the language you use are
explained in detail in the relevant chapters of this user guide.
An AXI Transaction
The following description of an AXI transaction is applicable to AXI3 and AXI4 protocols.
A complete read/write transaction transfers information between a master and a slave
peripheral. Transaction fields, described in the previous section, What Is a Transaction?
determine what is transferred and how information is transferred. During the lifetime of a
transaction, the roles of the master and slave ensure that a transaction completes successfully
and that transferred information adheres to the protocol specification. Information flows in both
directions during a transaction with the master initiating the transaction and the slave reporting
back to the master that the transaction has completed.
An AXI protocol uses five channels (three write channels and two read channels) to transfer
protocol information. Each of these channels has a pair of handshake signals, *VALID and
*READY, that indicates valid information on a channel and the acceptance of the information
from the channel.
6
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
Mentor VIP Altera Edition
Note
An AXI Transaction
AXI Write Transaction Master and Slave Roles
The following description of a write transaction references SystemVerilog BFM API
tasks. There are equivalent VHDL BFM API procedures that perform the same
functionality.
For a write transaction, the master calls the create_write_transaction() task to define the
information to be transferred and then calls the execute_transaction() task to initiate the transfer
of information as Figure illustrates.
Figure 1-1. Execute Write Transaction
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
7
Mentor VIP Altera Edition
An AXI Transaction
The execute_transaction() task results in the master calling the execute_write_addr_phase()
task followed by the execute_write_data_burst() task . The execute_write_data_burst() calls the
execute_write_data_phase() task for each phase (beat) of the burst defined by a burst_length
transaction field as illustrated in Figure 1-2.
8
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
Figure 1-2. Master Write Transaction Phases
Mentor VIP Altera Edition
An AXI Transaction
The master then calls the get_write_response_phase() task to receive the response from the
slave and to complete its role in the write transaction.
The slave also creates a transaction by calling the create_slave_transaction() task to accept the
transfer of information from the master. The address phase and data burst are received by the
slave calling the get_write_addr_phase() task, followed by the get_write_data_burst() task. The
get_write_data_burst() calls the get_write_data_phase() task for each phase (beat) of the burst
defined by a burst_length transaction field, as illustrated in Figure 1-3.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
9
Mentor VIP Altera Edition
Note
An AXI Transaction
Figure 1-3. Slave Write Transaction Phases
The slave then executes a write response phase by calling the execute_write_response_phase()
task and completes its role in the write transaction.
AXI Read Transaction Master and Slave Roles
The following description of a read transaction references the SystemVerilog BFM API
tasks. There are equivalent VHDL BFM API procedures that perform the same
functionality.
A read transaction is similar to a write transaction. The master initiates the read by calling the
create_read_transaction() and execute_transaction() tasks. The execute_transaction() calls the
the execute_read_addr_phase() task followed by the get_read_data_burst() task. The
get_read_data_burst() calls the get_read_data_phase() task for each phase (beat) of the burst
defined by a burst_length transaction field, as illustrated in Figure 1-4.
10
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
Mentor VIP Altera Edition
An AXI Transaction
Figure 1-4. Master Read Transaction Phases
The slave creates a read transaction by calling the create_slave_transaction() task to accept the
transfer of read information from the master. The slave accepts the address phase by calling the
get_read_addr_phase() task, and then executes the data burst by calling the
execute_read_data_burst() task. The execute_read_data_burst() calls the
execute_read_data_phase() task for each phase (beat) of the burst defined by the burst_length
transaction field, as illustrated in Figure 1-5.
Figure 1-5. Slave Read Transaction Phases
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
11
Mentor VIP Altera Edition
An AXI Transaction
12
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
Chapter 2
SV BFM API
Configuration
Creating
Transaction
Waiting Events
Executing
Transaction
Access
Transaction
create*_transaction
1
set_config/get_config
wait_on
get*_burst/get*_phase
3
Rx_Transaction
queue
queue
Tx_Transaction
Configuration
Wire Level
Notes: 1. Refer to create*_transaction()
2. Refer to execute_transaction(), execute*_burst(), execute*_phase()
This section provides the functional description of the SystemVerilog Application
Programming Interface (API) for all the BFM (master, slave, and monitor) components. For
each BFM, you can configure the protocol transaction fields that are executed on the protocol
signals, as well as control the operational transaction fields that permit delays to be introduced
between the handshake signals for each of the five address, data, and response channels.
In addition, each BFM API has tasks that wait for certain events to occur on the system clock
and reset signals, and tasks to get and set information about a particular transaction.
Figure 2-1. SystemVerilog BFM Internal Structure
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
13
SystemVerilog API Overview
Note
Note
Configuration
Configuration
Configuration sets timeout delays, error reporting, and other attributes of the BFM. Each BFM
has a set_config() function that sets the configuration of the BFM. Refer to the individual BFM
APIs for details.
Each BFM also has a get_config() function that returns the configuration of the BFM. Refer to
the individual BFM APIs for details.
set_config()
The following test program code sets the burst timeout factor for a transaction in the master
BFM.
// Setting the burst timeoutfactor to 1000
master_bfm.set_config(AXI_CONFIG_BURST_TIMEOUT_FACTOR, 1000);
The above test program code segment is for AXI3 BFMs. Substitute the
AXI_CONFIG_BURST_TIMEOUT_FACTOR enumeration with
AXI4_CONFIG_BURST_TIMEOUT_FACTOR for AXI4 BFMs.
get_config()
The following test program code gets the protocol signal hold time in the master BFM.
The above test program code segment is for AXI3 BFMs. Substitute the
AXI_CONFIG_HOLD_TIME enumeration with AXI4_CONFIG_HOLD_TIME for AXI4
BFMs.
Creating Transactions
To transfer information between a master BFM and slave DUT over the protocol signals, a
transaction must be created in the master test program. Similarly, to transfer information
between a master DUT and a slave BFM, a transaction must be created in the slave test
program. To monitor the transfer of information using a monitor BFM, a transaction must be
created in the monitor test program.
When you create a transaction, a Transaction Record is created and exists for the life of the
transaction. This transaction record can be accessed by the BFM test programs during the life of
the transaction as it transfers information between the master and slave.
14
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog API Overview
Creating Transactions
Transaction Record
The transaction record contains two types of transaction fields, protocol and operational, that
either transfer information over the protocol signals or define how and when a transfer occurs.
Protocol fields contain transaction information that is transferred over protocol signals. For
example, the prot field is transferred over the AWPROT protocol signals during a write
transaction.
Operational fields define how and when the transaction is transferred. Their content is not
transferred over protocol signals. For example, the operation_mode field controls the
blocking/nonblocking operation of a transaction, but this information is not transferred over the
protocol signals.
AXI3 Transaction Definition
The transaction record exists as a SystemVerilog class definition in each BFM. Example 2-1
shows the definition of the axi_transaction class members that form the transaction record.
Example 2-1. AXI3 Transaction Definition
// Global Transaction Class
class axi_transaction;
// Protocol
bit [((`MAX_AXI_ADDRESS_WIDTH) - 1):0] addr;
axi_size_e size;
axi_burst_e burst;
axi_lock_e lock;
axi_cache_e cache;
axi_prot_e prot;
bit [((`MAX_AXI_ID_WIDTH) - 1):0] id;
bit [3:0] burst_length;
bit [((((`MAX_AXI_RDATA_WIDTH > `MAX_AXI_WDATA_WIDTH) ?
`MAX_AXI_RDATA_WIDTH : `MAX_AXI_WDATA_WIDTH)) - 1):0] data_words [];
bit [(((`MAX_AXI_WDATA_WIDTH / 8)) - 1):0] write_strobes [];
axi_response_e resp[];
bit [7:0] addr_user;
axi_rw_e read_or_write;
int address_valid_delay;
int data_valid_delay[];
int write_response_valid_delay;
int address_ready_delay;
int data_ready_delay[];
int write_response_ready_delay;
// Housekeeping
bit gen_write_strobes = 1'b1;
axi_operation_mode_e operation_mode = AXI_TRANSACTION_BLOCKING;
axi_delay_mode_e delay_mode = AXI_VALID2READY;
axi_write_data_mode_e write_data_mode = AXI_DATA_AFTER_ADDRESS;
bit data_beat_done[];
bit transaction_done;
...
endclass
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
15
SystemVerilog API Overview
Note
Note
Creating Transactions
The axi_transaction class code above is shown for information only. Access to each
transaction record during its life is performed by various set*() and get*() tasks described
later in this chapter.
AXI4 Transaction Definition
The transaction record exists as a SystemVerilog class definition in each BFM. Example 2-2
shows the definition of the axi4_transaction class members that form the transaction record.
Example 2-2. AXI4 Transaction Definition
// Global Transaction Class
class axi4_transaction;
// Protocol
axi4_rw_e read_or_write;
bit [((`MAX_AXI4_ADDRESS_WIDTH) - 1):0] addr;
axi4_prot_e prot;
bit [3:0] region;
axi4_size_e size;
axi4_burst_e burst;
axi4_lock_e lock;
axi4_cache_e cache;
bit [3:0] qos;
bit [((`MAX_AXI4_ID_WIDTH) - 1):0] id;
bit [7:0] burst_length;
bit [((`MAX_AXI4_USER_WIDTH) - 1):0] addr_user;
bit [((((`MAX_AXI4_RDATA_WIDTH > `MAX_AXI4_WDATA_WIDTH) ?
`MAX_AXI4_RDATA_WIDTH : `MAX_AXI4_WDATA_WIDTH)) - 1):0] data_words [];
bit [(((`MAX_AXI4_WDATA_WIDTH / 8)) - 1):0] write_strobes [];
axi4_response_e resp[];
int address_valid_delay;
int data_valid_delay[];
int write_response_valid_delay;
int address_ready_delay;
int data_ready_delay[];
int write_response_ready_delay;
// Housekeeping
bit gen_write_strobes = 1'b1;
axi4_operation_mode_e operation_mode = AXI4_TRANSACTION_BLOCKING;
axi4_write_data_mode_e write_data_mode = AXI4_DATA_AFTER_ADDRESS;
bit data_beat_done[];
bit transaction_done;
...
endclass
The axi4_transaction class code above is shown for information only. Access to each
transaction record during its life is performed by various set*() and get*() tasks described
later in this chapter.
16
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog API Overview
Creating Transactions
The contents of the transaction record is defined in Table 2-1 below.
Table 2-1. Transaction Fields
Transaction FieldDescription
Protocol Transaction Fields
addrA bit vector (the length is equal to the ARADDR/AWADDR
signal bus width) containing the starting address of the first
transfer (beat) of a transaction. The addr value is transferred
over the ARADDR or AWADDR signals for a read or write
transaction, respectively.
protAn enumeration containing the protection type of a transaction.
region(AXI4) A 4-bit vector containing the region identifier of a
sizeAn enumeration to hold the size of a transaction. The types of
AXI_CACHE_WBACK_ALLOC_RW;
The cache value is transferred over the ARCACHE or
AWCACHE signals for a read or write transaction, respectively.
cache(AXI4) An enumeration to hold the cache of a transaction. The
types of cache are:
AXI4_NONMODIFIABLE_NONBUF
AXI4_BUF_ONLY
AXI4_CACHE_NOALLOC
AXI4_CACHE_2
AXI4_CACHE_3
AXI4_CACHE_RSVD4
AXI4_CACHE_RSVD5
AXI4_CACHE_6
AXI4_CACHE_7
AXI4_CACHE_RSVD8
AXI4_CACHE_RSVD9
AXI4_CACHE_10
AXI4_CACHE_11
AXI4_CACHE_RSVD12
AXI4_CACHE_RSVD13
AXI4_CACHE_14
AXI4_CACHE_15
The cache value is transferred over the ARCACHE or
AWCACHE signals for a read or write transaction, respectively.
18
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
Table 2-1. Transaction Fields (cont.)
Transaction FieldDescription
SystemVerilog API Overview
Creating Transactions
qos(AXI4) A 4-bit vector to hold the Quality of Service (qos)
idA bit vector (of length equal to the ARID/AWID signal bus width)
burst_lengthA 4-bit (8-bit for AXI4) vector to hold the burst length of a
addr_userA bit vector (of length equal to the ARUSER/AWUSER signal
data_wordsAn unsized array of bit vectors (of length equal to the greater of
write_strobesAn unsized array of bit vectors (of length equal to the WDATA
identifier of a transaction. The qos value is transferred over the
ARQOS or AWQOS signals for a read or write transaction,
respectively.
that holds the identification tag of a transaction. The id value is
transferred over the AWID/BID signals for a write transaction
and over the ARID/RID signals for a read transaction.
transaction. The burst_length value is transferred over the
ARLEN or AWLEN signals for a read or write transaction,
respectively.
bus width) to hold the address channel user data of a
transaction. The addr_data value is transferred over the ARUSER or AWUSER signals for a read or write transaction,
respectively.
the RDATA/WDATA signal bus widths) to hold the data words
of the payload. A data_words array element is transferred over
the RDATA or WDATA signals per beat of the read or write data
channel, respectively.
signal bus width divided by 8) to hold the write strobes. A
write_strobes array element is transferred over the WSTRB
signals per beat of the write data channel.
respAn unsized enumeration array to hold the responses of a
transaction. The types of response are:
**_OKAY;
**_EXOKAY;
**_SLVERR;
**_DECERR;
A resp array element is transferred over the RRESP signals per
beat of the read data channel, and over the BRESP signals for
a write transaction, respectively.
Operational Transaction Fields
read_or_writeAn enumeration to hold the read or write control flag. The types
of read_or_write are:
**_TRANS_READ
**_TRANS_WRITE
address_valid_delayAn integer to hold the delay value of the address channel
AWVALID and ARVALID signals (measured in ACLK cycles) for
a read or write transaction, respectively.
data_valid_delayAn unsized array of integers to hold the delay values of the data
channel WVALID and RVALID signals (measured in ACLK
cycles) for a read or write transaction, respectively.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
19
SystemVerilog API Overview
Creating Transactions
Table 2-1. Transaction Fields (cont.)
Transaction FieldDescription
write_response_valid_delayAn integer to hold the delay value of the write response channel
address_ready_delayAn integer to hold the delay value of the address channel
data_ready_delayAn unsized array of integers to hold the delay values of the data
write_response_ready_delayAn integer to hold the delay value of the write response channel
gen_write_strobesAutomatically correct write strobes flag. Refer to Automatic
operation_modeAn enumeration to hold the operation mode of the transaction.
delay_mode(AXI3) An enumeration to hold the delay mode control flag. The
BVALID signal (measured in ACLK cycles) for a write
transaction.
AWREADY and ARREADY signals (measured in ACLK cycles)
for a read or write transaction, respectively.
channel WREADY and RREADY signals (measured in ACLK
cycles) for a read or write transaction, respectively.
BREADY signal (measured in ACLK cycles) for a write
transaction.
Generation of Byte Lane Strobes for details.
The two types of operation_mode are:
**_TRANSACTION_NON_BLOCKING
**_TRANSACTION_BLOCKING
types of delay_mode are:
AXI_VALID2READY
AXI_TRANS2READY
Refer to AXI3 BFM Delay Mode for details.
write_data_modeAn enumeration to hold the write data mode control flag. The
types of write_data_mode are:
**_DATA_AFTER_ADDRESS
**_DATA_WITH_ADDRESS
data_beat_doneAn unsized bit array to hold the done flag for each beat in a
read or write data burst when it has completed.
transaction_doneA bit to hold the done flag for a transaction when it has
completed.
The master BFM API allows you to create a master transaction by providing only the address
and burst length arguments for a read or write transaction. All other protocol transaction fields
automatically default to legal protocol values to create a complete master transaction record.
Refer to the create_read_transaction() and create_write_transaction() functions for default
protocol read and write transaction field values.
The slave BFM API allows you to create a slave transaction without providing any arguments.
All protocol transaction fields automatically default to legal protocol values to create a complete
slave transaction record. Refer to the create_slave_transaction() function for default protocol
transaction field values.
20
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog API Overview
Note
Note
Executing Transactions
The monitor BFM API allows you to create a monitor transaction without providing any
arguments. All protocol transaction fields automatically default to legal protocol values to
create a complete slave transaction record. Refer to the create_monitor_transaction() function
for default protocol transaction field values.
If you change the default value of a protocol transaction field, this value is valid for all
future transactions until a new value is set.
create*_transaction()
There are two master BFM API functions available to create transactions,
create_read_transaction() and create_write_transaction(), a create_slave_transaction() for the
slave BFM API, and a create_monitor_transaction() for the monitor BFM API.
For example, the following master BFM test program creates a simple write transaction with a
start address of 1, and a single data phase with a data value of 2, the master BFM test program
would contain the following code:
// Define a variable trans of type axi_transaction
axi_transaction write_trans;
The above test program code segments are for AXI3 BFMs. Substitute the
axi_transaction type definition with axi4_transaction for AXI4 BFMs.
Executing Transactions
Executing a transaction in a master/slave BFM test program initiates the transaction onto the
protocol signals. Each master/slave BFM API has execution tasks that push transactions into the
BFM internal transaction queues. Figure 2-1 on page 13 illustrates the internal BFM structure.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
If the DUT is a slave, then the execute_transaction() task is called in the master BFM test
program. If the DUT is a master, then the execute*_burst() and execute*_phase() tasks are
called in the slave BFM test program.
For example, to execute a master write transaction the master BFM test program contains the
following code:
22
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog API Overview
Note
Waiting Events
// By default the execution of a transaction will block
bfm.execute_transaction(write_trans);
For example, to execute a slave write response phase, the slave BFM test program contains the
following code:
// By default the execution of a transaction will block
bfm.execute_write_response_phase(slave_trans);
Waiting Events
Each BFM API has tasks that block the test program code execution until an event has occurred.
The wait_on() task blocks the test program until an ACLK or ARESETn signal event has
occurred before proceeding.
The get*_transaction(), get*_burst(), get*_phase(), get*_cycle() tasks block the test program
code execution until a complete transaction, burst, phase or cycle has occurred, respectively.
wait_on()
For example, a BFM test program can wait for the positive edge of the ARESETn signal using
the following code:
// Block test program execution until the positive edge of the clock
bfm.wait_on(AXI_RESET_POSEDGE);
The above test program code segments are for AXI3 BFMs. Substitute the
AXI_RESET_POSEDGE enumeration with AXI4_RESET_POSEDGE for AXI4 BFMs.
For example, a slave BFM test program can use a received write address phase to form the
response of the write transaction. The test program gets the write address phase for the
transaction by calling the get_write_addr_phase()task. This task blocks until it has received the
address phase, allowing the test program to call the execute_write_response_phase() task for
the transaction at a later stage, as shown in the slave BFM test program in Example 2-3.
Example 2-3. Slave Test Program Using get_write_addr_phase()
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
23
SystemVerilog API Overview
Note
Note
Access Transaction Record
Not all BFM APIs support the full complement of get*_transaction(), get*_burst(),
get*_phase(), get*_cycle() tasks. Refer to the individual master, slave or monitor BFM
API for details.
Access Transaction Record
Each BFM API has tasks that can access a complete or partially complete Transaction Record.
The set*()and get*() tasks are used in a test program to set and get information from the
transaction record.
The set*() and get*() tasks are not explicitly described in each BFM API chapter. The
simple rule for the task name is set_ or get_ followed by the name of the transaction field
accessed. Refer to “Transaction Fields” on page 17 for transaction field name details.
set*()
For example, to set the WSTRB write strobes signal for the first phase (beat) in the Transaction
Record of a write transaction, the master test program would use the set_write_strobes() task, as
shown in the code below.
write_trans.set_write_strobes(4'b0010, 0);
get*()
For example, a slave BFM test program uses a received write address phase to get the AWPROT
signal value from the Transaction Record, as shown in the slave BFM test program code below.
// Define a variable prot_value of type axi_transaction
axi_prot_e prot_value;
slave_trans = bfm.create_slave_transaction();
// Wait for a write address phase
bfm.get_write_addr_phase(slave_trans);
... …
// Get the AWPROT signal value of the slave transaction
prot_value = bfm.get_prot(slave_trans);
24
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog API Overview
Note
Operational Transaction Fields
The above test program code segments are for AXI3 BFMs. For AXI4 BFMs, substitute
the axi_transaction type definition with axi4_transaction and axi_prot_e with
axi4_prot_e.
Operational Transaction Fields
Operational transaction fields control the way a transaction is executed onto the protocol
signals. They also indicate when a data phase (beat) or transaction is complete.
Automatic Generation of Byte Lane Strobes
The master BFM permits unaligned and narrow write transfers by using byte lane strobe
(WSTRB) signals to indicate which byte lanes contain valid data per data phase (beat).
When you create a write transaction in your master BFM test program, the write_strobes
variable is available to store the write strobe values for each write data phase (beat) in the
transaction. To assist you in creating the correct byte lane strobes, automatic correction of any
previously set write_strobes is performed by default during execution of the write transaction,
or write data phase (beat). You can disable this default behavior by setting the operational
transaction field gen_write_strobes = 0, which allows any previously set write_strobes to pass
through uncorrected onto the protocol WSTRB signals. In this mode, with the automatic
correction disabled, you are responsible for setting the correct write_strobes for the whole
transaction.
The automatic correction algorithm performs a bit-wise AND operation on any previously set
write_strobes. To do the corrections, the correction algorithm uses the equations described in
the AMBA AXI Protocol Specification, section A3.4.1 that define valid write data byte lanes
for legal protocol. Therefore, if you require automatic generation of all write_strobes, before the
write transaction executes, you must set all write_strobes to 1, indicating that all bytes lanes
initially contain valid write data prior to the execution of the write transaction. Automatic
correction then sets the relevant write_strobes to 0 to produce legal protocol WSTRB signals.
For example, Figure 2-2 below shows byte lanes that can contain valid data for a write
transaction with a starting address = 0x01, size = 0b001 (2 bytes), type = INCR, and the length
= 0b0010 (3 beats) for a 32-bit write data bus.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
25
SystemVerilog API Overview
Note
Operational Transaction Fields
Figure 2-2. Valid Data on Byte Lanes During a Write Transaction
In the above example, if you set all write_strobes[] array elements to 1 before executing the
write transaction, automatic correction produces the following results while the transaction
executes.
Prior to ExecutionDuring Execution
1st data phase write_strobes[0]=0b1111->write_strobes[0]=0b0010
2nd data phase write_strobes[1]=0b1111->write_strobes[1]=0b1100
3rd data phase write_strobes[2]=0b1111->write_strobes[2]=0b0011
If you randomly set all write_strobes[] array elements to 0 or 1, before executing the write
transaction, automatic correction corrects only those write_strobes[] array elements that were
previously set to 1, as shown below.
Prior to ExecutionDuring Execution
1st data phase write_strobes[0]=0b1010->write_strobes[0]=0b0010
2nd data phase write_strobes[1]=0b1010->write_strobes[1]=0b1000
3rd data phase write_strobes[2]=0b1010->write_strobes[2]=0b0010
To automatically generate all WSTRB signals for a write transaction, set all
write_strobes[] array elements to 1 before executing the write transaction or write data
burst.
Operation Mode
By default, each read or write transaction performs a blocking operation which prevents a
following transaction from starting until the current active transaction completes.
You can configure this behavior to be nonblocking by setting the operation_mode transaction
field to the enumerate type value AXI_TRANSACTION_NON_BLOCKING instead of the
default AXI_TRANSACTION_BLOCKING.
26
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog API Overview
Note
Operational Transaction Fields
For example, in a master BFM test program you create a transaction by calling the
create_read_transaction() or create_write_transaction() tasks which creates a transaction
record. Before executing the transaction record, the operation_mode can be changed as follows:
// Create a write transaction to create a transaction record
trans = bfm.create_write_transaction(1);
// Change operation_mode to be nonblocking in the transaction record
trans.operation_mode(AXI_TRANSACTION_NON_BLOCKING);
The above test program code segments are for AXI3 BFMs. Substitute the
AXI_TRANSACTION_NON_BLOCKING enumeration with
AXI4_TRANSACTION_NON_BLOCKING for AXI4 BFMs.
Channel Handshake Delay
Each of the five protocol channels have *VALID and *READY handshake signals that control
the rate at which information is transferred between a master and slave. The API to control these
handshake signals differs between the AXI3 BFMs and AXI4 BFMs. Refer to the AXI3 BFM
Handshake Delay and AXI3 BFM Delay Mode for details of the AXI3 BFM API, and AXI4
BFM Handshake Delay for details of the AXI4 BFM API.
AXI3 BFM Handshake Delay
The delay between the *VALID and *READY handshake signals for each of the five protocol
channels can be configured. The delay can be defined per phase (beat) basis for a particular
transaction, measured from the positive edge of ACLK when *VALID is asserted. The delay can
also be set from the completion of a previous transaction phase (*VALID and *READY both
asserted).
AXI3 BFM Handshake Signal Delay Transaction Fields
The transaction record contains transaction fields to configure the desired handshake delay
pattern for a particular transaction phase on any of the five protocol channels. The master BFM
configures the *VALID and *READY signal delays that it asserts, and the slave BFM configures
the *VALID and *READY signal delays that it asserts. Table 2-2 specifies which operational
delay transaction fields are configured by the master and slave BFMs.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
27
SystemVerilog API Overview
Note
Operational Transaction Fields
Table 2-2. Handshake Signal Delay Transaction Fields
The data channel handshake signal transaction fields (data_valid_delay[] and
data_ready_delay[]) are defined as arrays so that the *VALID to *READY delay can be
configured on a per data phase (beat) basis in a transaction.
AXI4 BFM Handshake Delay
The delay between the *VALID and *READY handshake signals for each of the five protocol
channels is controlled in a BFM test program using execute_*_ready(), get_*_ready(), and
get_*_cycle() tasks. The execute_*_ready() tasks place a value onto the *READY signals and
the get_*_ready() tasks retrieve a value from the *READY signals. The get_*_cycle() tasks wait
for a *VALID signal to be asserted and are used to insert a delay between the *VALID and
*READY signals in the BFM test program.
For example, the master BFM test program code below inserts a specified delay between the
read channel RVALID and RREADY handshake signals using the execute_read_data_ready()
and get_read_data_cycle() tasks.
// Set the RREADY signal to ‘0’ so that it is nonblocking
fork
bfm.execute_read_data_ready(1'b0);
join_none
// Wait until the RVALID signal is asserted and then wait_on the specified
// number of ACLK cycles
bfm.get_read_data_cycle;
repeat(5) bfm.wait_on(AXI4_CLOCK_POSEDGE);
// Set the RREADY signal to ‘1’ so that it blocks for an ACLK cycle
bfm.execute_read_data_ready(1'b1);
28
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog API Overview
Note
Note
Operational Transaction Fields
AXI4 BFM *VALID Signal Delay Transaction Fields
The transaction record contains a *_valid_delay transaction field for each of the five protocol
channels to configure the delay value prior to the assertion of the *VALID signal for the
channel. The master BFM holds the delay configuration for the *VALID signals that it asserts,
and the slave BFM holds the delay configuration for the *VALID signals that it asserts.
Table 2-3 below specifies which *_valid_delay fields are configured by the master and slave
BFMs.
Table 2-3. Master and Slave*_valid_delay Configuration Fields
In the transaction record, the data channel handshake signal transaction field
(data_valid_delay[]) is defined as an array, which allows you to configure the *VALID
delay on a per data phase (beat) basis in a transaction.
AXI4 BFM *READY Handshake Signal Delay Transaction Fields
The transaction record contains a *_ready_delay transaction field for each of the five protocol
channels to store the delay value that occurred between the assertion of the *VALID and
*READY handshake signals for the channel. Table 2-4 specifies the *_ready_delay field
corresponding to the *READY signal delay.
In the transaction record, the data channel handshake signal transaction field
(data_ready_delay[]) is defined as an array so that the *READY delay can be recorded on
a per data phase (beat) basis in a transaction.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
29
SystemVerilog API Overview
*VALID
*READY
ACLK
*_valid_delay = 4
*_ready_delay = 2
Operational Transaction Fields
AXI3 BFM Delay Mode
The delay mode can be configured on a per transaction basis using the delay_mode operational
transaction field. This transaction field can be configured to the enumerated type values of
AXI_VALID2READY (default) or AXI_TRANS2READY.
The default configuration (delay_mode = AXI_VALID2READY) corresponds to the delay
measured from the positive edge of ACLK when *VALID is asserted in a transaction. Figure 2-3
demonstrates how to achieve a *VALID asserted before *READY handshake.
Figure 2-3. Operational Transaction Field delay_mode = AXI_VALID2READY
The other configuration (delay_mode = AXI_TRANS2READY) corresponds to the delay
measured from the completion of a previous transaction phase (*VALID and *READY both
asserted). Figure 2-4 demonstrates how to achieve a *READY before *VALID handshake.
30
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog API Overview
*VALID
*READY
ACLK
*_valid_delay = 4
*_ready_delay = 2
Operational Transaction Fields
Figure 2-4. Operational Transaction Field delay_mode = AXI_TRANS2READY
Data Beat Done
There is a data_beat_done transaction field for each transaction, defined as an array, to indicate
when each data phase (beat) has completed. Each element of the data_beat_done array is set to
1 when each data phase (beat) has completed in a data burst.
You call the get_read_data_phase() task in the master BFM test program to investigate how
many beats of a read data burst have completed by analyzing how many elements of the
data_beat_done array have been set to 1. Similarly, the get_write_data_phase() task can be
called in the slave BFM test program to analyze a write data burst.
Transaction Done
The transaction_done field in each transaction indicates when the transaction is complete.
In a master BFM test program, you call the get_read_data_burst() task to investigate whether a
read transaction is complete, and the get_write_response_phase() to investigate whether a write
transaction is complete.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
31
SystemVerilog API Overview
Operational Transaction Fields
32
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
Chapter 3
Note
SystemVerilog AXI3 and AXI4 Master BFMs
This section provides information about the SystemVerilog AXI3 and AXI4 master BFMs.
Each BFM has an API that contains tasks and functions to configure the BFM and to access the
dynamic Transaction Record during the lifetime of the transaction.
Due to AXI3 protocol specification changes, for some BFM tasks, you reference the
AXI3 BFM by specifying AXI instead of AXI3.
Master BFM Protocol Support
The AXI3 master BFM supports the AMBA AXI3 protocol with restrictions described in
“Protocol Restrictions” on page 1. In addition to the standard protocol, it supports user sideband
signals AWUSER and ARUSER.
The AXI4 master BFM supports the AMBA AXI4 protocol with restrictions described in
“Protocol Restrictions” on page 1.
Master Timing and Events
For detailed timing diagrams of the protocol bus activity, refer to the relevant AMBA AXI
protocol specification chapter, which you can use to reference details of the following master
BFM API timing and events.
The AMBA AXI protocol specification does not define any timescale or clock period with
signal events sampled and driven at rising ACLK edges. Therefore, the master BFM does not
contain any timescale, timeunit, or timeprecision declarations with the signal setup and hold
times specified in units of simulator time-steps.
The simulator time-step resolves to the smallest of all the time-precision declarations in the
testbench and design IP as a result of these directives, declarations, options, or initialization
files:
•` timescale directives in design elements.
•timeprecision declarations in design elements.
•compiler command-line options.
•simulation command-line options.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
33
SystemVerilog AXI3 and AXI4 Master BFMs
Note
Master BFM Configuration
•local or site-wide simulator initialization files.
If there is no timescale directive, the default time unit and time precision are tool specific. The
recommended practice is to use timeunit and timeprecision declarations. Refer to the
SystemVerilog LRM section 3.14 for details.
Master BFM Configuration
A master BFM supports the full range of signals defined for the AMBA AXI protocol
specification. It has parameters that configure the widths of the address, ID and data signals, and
transaction fields to specify timeout factors, slave exclusive support, setup and hold times, etc.
The address, ID and data signal widths can be changed from their default settings by assigning
them new values, usually in the top-level module of the testbench. These new values are then
passed to the master BFM using a parameter port list of the master BFM module. For example,
the code extract below shows the AXI3 master BFM with the address, ID and data signal widths
defined in module top() and passed to the master BFM mgc_axi_master parameter port list:
In the above code extract, the mgc_axi_master is the AXI3 master BFM interface.
The following table lists parameter names for the address, ID and data signals, and their default
values.
Table 3-1. Master BFM Signal Width Parameters
Signal Width Parameter
(Note: ** = AXI or AXI4)
**_ADDRESS_WIDTHAddress signal width in bits. This applies to the ARADDR and
**_RDATA_WIDTHRead data signal width in bits. This applies to the RDATA
Description
AWADDR signals. Refer to the AMBA AXI Protocol
specification for more details. Default: 32.
signals. Refer to the AMBA AXI Protocol specification for more
details. Default: 64.
**_WDATA_WIDTHWrite data signal width in bits. This applies to the WDATA
34
signals. Refer to the AMBA AXI Protocol specification for more
details. Default: 64.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog AXI3 and AXI4 Master BFMs
Master BFM Configuration
Table 3-1. Master BFM Signal Width Parameters
**_ID_WIDTHID signal width in bits. This applies to the RID and WID signals.
Refer to the AMBA AXI Protocol specification for more details.
Default: 4.
AXI4_USER_WIDTH(AXI4) User data signal width in bits. This applies to the
AXI4_REGION_MAP_SIZE(AXI4) Region signal width in bits. This applies to the
ARUSER, AWUSER, RUSER, WUSER and BUSER signals.
Refer to the AMBA AXI Protocol specification for more details.
Default: 8.
ARREGION and AWREGION signals. Refer to the AMBA AXI
Protocol specification for more details. Default: 16.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
35
SystemVerilog AXI3 and AXI4 Master BFMs
Master BFM Configuration
A master BFM has configuration fields that you can set with the set_config() function to
configure timeout factors, slave exclusive support, and setup and hold times, etc. You can also
get the value of a configuration field using the get_config() function. The full list of
configuration fields is described in Table 3-2 below.
Table 3-2. Master BFM Configuration
Configuration Field (Note: ** = AXI or AXI4)Description
Timing Variables
**_CONFIG_SETUP_TIMEThe setup-time prior to the active edge
**_CONFIG_HOLD_TIMEThe hold-time after the active edge of
**_CONFIG_MAX_TRANSACTION_TIME_FACTORThe maximum timeout duration for a
**_CONFIG_BURST_TIMEOUT_FACTORThe maximum delay between the
**_CONFIG_MAX_LATENCY_AWVALID_
ASSERTION_TO_AWREADY
**_CONFIG_MAX_LATENCY_ARVALID_
ASSERTION_TO_ARREADY
**_CONFIG_MAX_LATENCY_RVALID_
ASSERTION_TO_RREADY
of ACLK, in units of simulator timesteps for all signals.
ACLK, in units of simulator time-steps
for all signals.
read/write transaction in clock cycles.
Default: 100000.
individual phases of a read/write
transaction in clock cycles. Default:
10000.
The maximum timeout duration from
the assertion of AWVALID to the
assertion of AWREADY in clock
periods. Default: 1000.
The maximum timeout duration from
the assertion of ARVALID to the
assertion of ARREADY in clock
periods. Default: 10000.
The maximum timeout duration from
the assertion of RVALID to the
assertion of RREADY in clock periods.
Default: 10000.
1
Default: 0.
1
Default: 0.
**_CONFIG_MAX_LATENCY_BVALID_
ASSERTION_TO_BREADY
**_CONFIG_MAX_LATENCY_WVALID_
ASSERTION_TO_WREADY
36
The maximum timeout duration from
the assertion of BVALID to the
assertion of BREADY in clock periods.
Default: 10000.
The maximum timeout duration from
the assertion of WVALID to the
assertion of WREADY in clock periods.
Default 10000.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog AXI3 and AXI4 Master BFMs
Note
Master Assertions
Table 3-2. Master BFM Configuration (cont.)
Slave Attributes
**_CONFIG_SUPPORT_EXCLUSIVE_ACCESSConfigures the support for an exclusive
slave. If enabled the BFM will expect
an EXOKAY response to a successful
exclusive transaction. If disabled the
BFM will expect an OKAY response to
an exclusive transaction. Refer to the
AMBA AXI protocol specification for
more details.
0 = disabled
1 = enabled (default)
AXI_CONFIG_SLAVE_DEFAULT_UNDER_RESET (AXI3) The slave BFM drives the
BVALID and RVALID signals low
during reset. Refer to the AMBA AXI
Protocol specification for more details.
0 = false (default)
1 = true
**_CONFIG_SLAVE_START_ADDRConfigures the start address map for
**_CONFIG_SLAVE_END_ADDRConfigures the end address map for
to the AMBA AXI Protocol specification
for more details. Default: 1.
Error Detection
**_CONFIG_ENABLE_ALL_ASSERTIONSGlobal enable/disable of all assertion
**_CONFIG_ENABLE_ASSERTIONIndividual enable/disable of assertion
1.
Refer to Master Timing and Events for details of simulator time-steps.
checks in the BFM.
0 = disabled
1 = enabled (default)
check in the BFM.
0 = disabled
1 = enabled (default)
Master Assertions
Each master BFM performs protocol error checking using the built-in assertions.
The built-in BFM assertions are independent of programming language and simulator.
AXI3 Assertion Configuration
By default, all built-in assertions are enabled in the master BFM. To globally disable them in the
master BFM, use the set_config() command as the following example illustrates:
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
37
SystemVerilog AXI3 and AXI4 Master BFMs
Note
Master Assertions
set_config(AXI_CONFIG_ENABLE_ALL_ASSERTIONS,0)
Alternatively, individual built-in assertions can be disabled by using a sequence of get_config()
and set_config() commands on the respective assertion. For example, to disable assertion
checking for the AWLOCK signal changing between the AWVALID and AWREADY handshake
signals, use the following sequence of commands:
// Define a local bit vector to hold the value of the assertion bit vector
bit [255:0] config_assert_bitvector;
// Get the current value of the assertion bit vector
config_assert_bitvector = bfm.get_config(AXI_CONFIG_ENABLE_ASSERTION);
// Assign the AXI_LOCK_CHANGED_BEFORE_AWREADY assertion bit to 0
config_assert_bitvector[AXI_LOCK_CHANGED_BEFORE_AWREADY] = 0;
// Set the new value of the assertion bit vector
bfm.set_config(AXI_CONFIG_ENABLE_ASSERTION, config_assert_bitvector);
Do not confuse the AXI_CONFIG_ENABLE_ASSERTION bit vector with the
AXI_CONFIG_ENABLE_ALL_ASSERTIONS global enable/disable.
To re-enable the AXI_LOCK_CHANGED_BEFORE_AWREADY assertion, follow the above
code sequence and assign the assertion in the AXI_CONFIG_ENABLE_ASSERTION bit vector
to 1.
For a complete listing of AXI3 assertions, refer to “AXI3 Assertions” on page 665.
38
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog AXI3 and AXI4 Master BFMs
Note
Note
SystemVerilog Master API
AXI4 Assertion Configuration
By default, all built-in assertions are enabled in the master AXI4 BFM. To globally disable
them in the master BFM, use the set_config() command as the following example illustrates:
set_config(AXI4_CONFIG_ENABLE_ALL_ASSERTIONS,0)
Alternatively, individual built-in assertions can be disabled by using a sequence of get_config()
and set_config() commands on the respective assertion. For example, to disable assertion
checking for the AWLOCK signal changing between the AWVALID and AWREADY handshake
signals, use the following sequence of commands:
// Define a local bit vector to hold the value of the assertion bit vector
bit [255:0] config_assert_bitvector;
// Get the current value of the assertion bit vector
config_assert_bitvector = bfm.get_config(AXI4_CONFIG_ENABLE_ASSERTION);
// Assign the AXI4_LOCK_CHANGED_BEFORE_AWREADY assertion bit to 0
config_assert_bitvector[AXI4_LOCK_CHANGED_BEFORE_AWREADY] = 0;
// Set the new value of the assertion bit vector
bfm.set_config(AXI4_CONFIG_ENABLE_ASSERTION, config_assert_bitvector);
Do not confuse the AXI4_CONFIG_ENABLE_ASSERTION bit vector with the
AXI4_CONFIG_ENABLE_ALL_ASSERTIONS global enable/disable.
To re-enable the AXI4_LOCK_CHANGED_BEFORE_AWREADY assertion, follow the above
code sequence and assign the assertion in the AXI4_CONFIG_ENABLE_ASSERTION bit vector
to 1.
For a complete listing of AXI4 assertions, refer to “AXI4 Assertions” on page 678.
SystemVerilog Master API
This section describes the SystemVerilog master API.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
39
SystemVerilog AXI3 and AXI4 Master BFMs
set_config()
set_config()
This function sets the configuration of the master BFM.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
43
SystemVerilog AXI3 and AXI4 Master BFMs
create_write_transaction()
create_write_transaction()
This nonblocking function creates a write transaction with a start address addr and optional
burst_length arguments. All other transaction fields default to legal protocol values, unless previously assigned a value. It returns with the *_transaction record.
Prototype
// * = axi | axi4
// ** = AXI | AXI4
function automatic *_transaction create_write_transaction
(
input bit [((**_ADDRESS_WIDTH) - 1):0] addr,
bit [3:0] burst_length = 0 // optional
);
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
45
SystemVerilog AXI3 and AXI4 Master BFMs
create_write_transaction()
Operational
Transaction
address_valid_delayAddress channel AWVALID delay measured in ACLK cycles for
this transaction (default = 0).
Fields
data_valid_delayWrite data channel WVALID delay array measured in ACLK
cycles for this transaction (default = 0 for all elements).
Returns
write_response_
ready_delay
data_beat_doneWrite data channel beat done flag array for this transaction.
transaction_doneWrite transaction done flag for this transaction.
The *_transaction record.
Write response channel BREADY delay measured in ACLK
cycles for this transaction (default = 0).
AXI3 Example
// Create a write transaction with a data burst length of 3 (4 beats) to
// start address 16.
trans = bfm.create_write_transaction(16, 3);
trans.set_size = (AXI_BYTES_4);
trans.set_data_words = ('hACE0ACE1, 0);
trans.set_data_words = ('hACE2ACE3, 1);
trans.set_data_words = ('hACE4ACE5, 2);
trans.set_data_words = ('hACE6ACE7, 3);
AXI4 Example
// Create a write transaction with a data burst length of 3 to start
// address 16.
trans = bfm.create_write_transaction(16, 3);
trans.set_size = (AXI4_BYTES_4);
trans.set_data_words = ('hACE0ACE1, 0);
trans.set_data_words[= ('hACE2ACE3, 1);
trans.set_data_words = ('hACE4ACE5, 2);
trans.set_data_words = ('hACE6ACE7, 3);
46
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog AXI3 and AXI4 Master BFMs
create_read_transaction()
create_read_transaction()
This nonblocking function creates a read transaction with a start address addr and optional
burst_length arguments. All other transaction fields default to legal AXI protocol values, unless previously assigned a value. It returns the *_transaction record.
Prototype
// * = axi | axi4
// ** = AXI| AXI4
function automatic *_transaction create_read_transaction
(
input bit [((**_ADDRESS_WIDTH) - 1):0] addr,
bit [3:0] burst_length = 0 //optional
);
Read data channel RREADY delay array measured in
ACLK cycles for this transaction (default = 0 for all
elements).
transaction.
AXI3 Example
// Create a read data burst length of 3 (4 beats) to start address 16.
trans = bfm.create_read_transaction(16, 3);
trans.set_size = (AXI_BYTES_4);
AXI4 Example
// Read data burst length of 3 to start address 16.
trans = bfm.create_read_transaction(16, 3);
trans.set_size = (AXI4_BYTES_4);
48
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog AXI3 and AXI4 Master BFMs
execute_transaction()
execute_transaction()
This task executes a master transaction previously created by the create_write_transaction(), or
create_read_transaction(), functions. The transaction can be blocking (default) or non-
blocking, defined by the transaction record operation_mode field.
The results of execute_transaction() for write transactions varies based on how write transaction
fields are set. If the gen_write_strobes transaction field is set, execute_transaction()
automatically corrects any previously set write_strobes. However, if the gen_write_strobes
field is not set, then any previously assigned write_strobes will be passed through onto the WSTRB protocol signals, which can result in a protocol violation if not correctly set. Refer to
“Automatic Correction of Byte Lane Strobes” on page 197 for more details.
If a write transaction write_data_mode field is set to *_DATA_WITH_ADDRESS, execute_transaction() calls the execute_write_addr_phase() and execute_write_data_burst()
tasks simultaneously, otherwise execute_write_data_burst() will be called after
execute_write_addr_phase() so that the write data burst occurs after the write address phase
(default). It will then call the get_write_response_phase() task to complete the write transaction.
For a read transaction, execute_transaction() calls the execute_read_addr_phase() task
followed by the get_read_data_burst() task to complete the read transaction.
Prototype
// * = axi | axi4
task automatic execute_transaction
(
*_transaction trans
);
Arguments transThe *_transaction record.
Returns
None
AXI3 Example
// Declare a local variable to hold the transaction record.
axi_transaction read_trans;
// Create a read transaction with start address of 0 and assign
// it to the local read_trans variable.
read_trans = bfm.create_read_transaction(0);
....
// Execute the read_trans transaction.
bfm.execute_transaction(read_trans);
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
49
SystemVerilog AXI3 and AXI4 Master BFMs
execute_transaction()
AXI4 Example
// Declare a local variable to hold the transaction record.
axi4_transaction read_trans;
// Create a read transaction with start address of 0 and assign
// it to the local read_trans variable.
read_trans = bfm.create_read_transaction(0);
....
// Execute the read_trans transaction.
bfm.execute_transaction(read_trans);
50
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog AXI3 and AXI4 Master BFMs
execute_write_addr_phase()
execute_write_addr_phase()
This task executes a master write address phase previously created by the
create_write_transaction() function. This phase can be blocking (default) or nonblocking,
defined by the transaction operation_mode field.
It sets the AWVALID protocol signal at the appropriate time defined by the transaction
address_valid_delay field.
Prototype
// * = axi | axi4
task automatic execute_write_addr_phase
(
*_transaction trans
);
Arguments transThe *_transaction record.
Returns
None
AXI3 Example
// Declare a local variable to hold the transaction record.
axi_transaction write_trans;
// Create a write transaction with start address of 0 and assign
// it to the local write_trans variable.
write_trans = bfm.create_write_transaction(0);
....
// Execute the write_trans transaction.
bfm.execute_transaction(write_trans);
AXI4 Example
// Declare a local variable to hold the transaction record.
axi4_transaction write_trans;
// Create a write transaction with start address of 0 and assign
// it to the local write_trans variable.
write_trans = bfm.create_write_transaction(0);
....
// Execute the write_trans transaction.
bfm.execute_transaction(write_trans);
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
51
SystemVerilog AXI3 and AXI4 Master BFMs
execute_read_addr_phase()
execute_read_addr_phase()
This task executes a master read address phase previously created by the
create_read_transaction() function. This phase can be blocking (default) or nonblocking,
defined by the transaction operation_mode field.
It sets the ARVALID protocol signal at the appropriate time, defined by the transaction
address_valid_delay field.
Prototype
Arguments trans
Returns
// * = axi | axi4
task automatic execute_read_addr_phase
(
*_transaction trans
);
The *_transaction record.
None
AXI3 Example
// Declare a local variable to hold the transaction record.
axi_transaction read_trans;
// Create a read transaction with start address of 0 and assign
// it to the local read_trans variable.
read_trans = bfm.create_read_transaction(0);
....
// Execute the read_trans transaction.
bfm.execute_transaction(read_trans);
AXI4 Example
// Declare a local variable to hold the transaction record.
axi4_transaction read_trans;
// Create a read transaction with start address of 0 and assign
// it to the local read_trans variable.
read_trans = bfm.create_read_transaction(0);
....
// Execute the read_trans transaction.
bfm.execute_transaction(read_trans);
52
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog AXI3 and AXI4 Master BFMs
execute_write_data_burst()
execute_write_data_burst()
This task executes a write data burst previously created by the create_write_transaction() task.
This burst can be blocking (default) or nonblocking, defined by the transaction operation_mode
field.
If the transaction gen_write_strobes field is set, this task automatically corrects any previously
set write_strobes field array elements. If the gen_write_strobes field is not set then any
previously assigned write_strobes field array elements will be passed through onto the WSTRB
protocol signals, which can result in a protocol violation if the WSTRB signals are not correctly
set. Refer to “Automatic Correction of Byte Lane Strobes” on page 197 for more details.
It calls the execute_write_data_phase() task for each beat of the data burst, with the length of
the burst defined by the transaction burst_length field.
Prototype
Arguments trans
Returns
// * = axi | axi4
task automatic execute_write_data_burst
(
*_transaction trans
);
The *_transaction record.
None
AXI3 Example
// Declare a local variable to hold the transaction record.
axi_transaction write_trans;
// Create a write transaction with start address of 0 and assign
// it to the local write_trans variable.
write_trans = bfm.create_write_transaction(0);
....
// Execute the write_trans transaction.
bfm.execute_write_data_burst(write_trans);
AXI4 Example
// Declare a local variable to hold the transaction record.
axi4_transaction write_trans;
// Create a write transaction with start address of 0 and assign
// it to the local write_trans variable.
write_trans = bfm.create_write_transaction(0);
....
// Execute the write_trans transaction.
bfm.execute_write_data_burst(write_trans);
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
53
SystemVerilog AXI3 and AXI4 Master BFMs
execute_write_data_phase()
execute_write_data_phase()
This task executes a write data phase (beat) previously created by the
create_write_transaction() task. This phase can be blocking (default) or nonblocking, defined
by the transaction record operation_mode field.
The execute_write_data_phase() sets the WVALID protocol signal at the appropriate time
defined by the transaction record data_valid_delay field and sets the data_beat_done array
index element field to 1 when the phase completes.
Prototype
Arguments trans
Returns
// * = axi | axi4
task automatic execute_write_data_phase
(
*_transaction trans,
int index = 0, // Optional
output bit last
);
The *_transaction record.
indexData phase (beat) number.
lastFlag to indicate that this phase is the last beat of data.
None
AXI3 Example
// Declare a local variable to hold the transaction record.
axi_transaction write_trans;
// Create a write transaction with start address of 0 and assign
// it to the local write_trans variable.
write_trans = bfm.create_write_transaction(0);
....
// Execute the write data phase for the first beat of the
// write_trans transaction.
bfm.execute_write_data_phase(write_trans, 0, last);
// Execute the write data phase for the second beat of the
// write_trans transaction.
bfm.execute_write_data_phase(write_trans, 1, last);
54
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog AXI3 and AXI4 Master BFMs
execute_write_data_phase()
AXI4 Example
// Declare a local variable to hold the transaction record.
axi4_transaction write_trans;
// Create a write transaction with start address of 0 and assign
// it to the local write_trans variable.
write_trans = bfm.create_write_transaction(0);
....
// Execute the write data phase for the first beat of the
// write_trans transaction.
bfm.execute_write_data_phase(write_trans, 0, last);
// Execute the write data phase for the second beat of the
// write_trans transaction.
bfm.execute_write_data_phase(write_trans, 1, last);
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
55
SystemVerilog AXI3 and AXI4 Master BFMs
get_read_data_burst()
get_read_data_burst()
This blocking task gets a read data burst previously created by the create_read_transaction()
function.
It calls the get_read_data_phase() task for each beat of the data burst, with the length of the
burst defined by the transaction record burst_length field.
Prototype
Arguments trans
Returns
// * = axi | axi4
task automatic get_read_data_burst
(
*_transaction trans
);
The *_transaction record.
None
AXI3 Example
// Declare a local variable to hold the transaction record.
axi_transaction read_trans;
// Create a read transaction with start address of 0 and assign
// it to the local read_trans variable.
read_trans = bfm.create_read_transaction(0);
....
// Get the read data burst for the read_trans transaction.
bfm.get_read_data_burst(read_trans);
AXI4 Example
// Declare a local variable to hold the transaction record.
axi4_transaction read_trans;
// Create a read transaction with start address of 0 and assign
// it to the local read_trans variable.
read_trans = bfm.create_read_transaction(0);
....
// Execute the read_trans transaction.
bfm.execute_transaction(read_trans);
56
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog AXI3 and AXI4 Master BFMs
Note
Note
get_read_data_phase()
get_read_data_phase()
This blocking task gets a read data phase previously created by the create_read_transaction()
task.
The get_read_data_phase() sets the data_beat_done array index element field to 1 when
the phase completes. If this is the last phase (beat) of the burst, then it sets the
transaction_done field to 1 to indicate the whole read transaction is complete.For AXI3,
the get_read_data_phase() also sets the RREADY protocol signal at the appropriate time,
defined by the transaction record data_ready_delay field.
Prototype
Arguments trans
Returns
// * = axi | axi4
task automatic get_read_data_phase
(
*_transaction trans
,
int index = 0 // Optional
);
The *_transaction record.
index(Optional) Data phase (beat) number.
None
AXI3 Example
// Declare a local variable to hold the transaction record.
axi_transaction read_trans;
// Create a read transaction with start address of 0 and assign
// it to the local read_trans variable.
read_trans = bfm.create_read_transaction(0);
....
// Get the read data phase for the first beat of the
// read_trans transaction.
bfm.get_read_data_phase(read_trans, 0);
// Get the read data phase for the second beat of the
// read_trans transaction.
bfm.get_read_data_phase(read_trans, 1);
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
57
SystemVerilog AXI3 and AXI4 Master BFMs
get_read_data_phase()
AXI4 Example
// Declare a local variable to hold the transaction record.
axi4_transaction read_trans;
// Create a read transaction with start address of 0 and assign
// it to the local read_trans variable.
read_trans = bfm.create_read_transaction(0);
....
// Get the read data phase for the first beat of the
// read_trans transaction.
bfm.get_read_data_phase(read_trans, 0);
// Get the read data phase for the second beat of the
// read_trans transaction.
bfm.get_read_data_phase(read_trans, 1);
58
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog AXI3 and AXI4 Master BFMs
Note
Note
get_write_response_phase()
This blocking task gets a write response phase previously created by the
create_write_transaction() task.
The get_write_response_phase() sets the transaction_done field to 1 when the
transaction completes to indicate the whole transaction is complete. For AXI3, the
get_write_response_phase() also sets the BREADY protocol signal at the appropriate
time, defined by the transaction record write_response_ready_delay field.
get_write_response_phase()
Prototype
Arguments trans
// * = axi | axi4
task automatic get_write_response_phase
(
*_transaction trans
);
The *_transaction record.
ReturnsNone
AXI3 Example
// Declare a local variable to hold the transaction record.
axi_transaction write_trans;
// Create a write transaction with start address of 0 and assign
// it to the local write_trans variable.
write_trans = bfm.create_write_transaction(0);
....
// Get the write response phase of the write_trans transaction.
bfm.get_write_response_phase(write_trans);
AXI4 Example
// Declare a local variable to hold the transaction record.
axi4_transaction write_trans;
// Create a write transaction with start address of 0 and assign
// it to the local write_trans variable.
write_trans = bfm.create_write_transaction(0);
....
// Get the write response phase of the write_trans transaction.
bfm.get_write_response_phase(write_trans);
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
59
SystemVerilog AXI3 and AXI4 Master BFMs
Note
get_read_addr_ready()
get_read_addr_ready()
This blocking AXI4 task returns the value of the read address channel ARREADY signal using
the ready argument. It will block for one ACLK period.
Prototype
Arguments ready
Returns
task automatic get_read_addr_ready
(
output bit ready
);
The value of the ARREADY signal.
ready
AXI3 BFM
The get_read_addr_ready() task is not available in the AXI3 BFM.
AXI4 Example
// Get the ARREADY signal value
bfm.get_read_addr_ready(ready);
60
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog AXI3 and AXI4 Master BFMs
Note
get_read_data_cycle()
get_read_data_cycle()
This blocking AXI4 task waits until the read data channel RVALID signal is asserted.
Prototype
task automatic get_read_data_cycle();
Arguments None
Returns
None
AXI3 BFM
The get_read_data_cycle() task is not available in the AXI3 BFM.
AXI4 Example
// Waits until the read data channel RVALID signal is asserted.
bfm.get_read_data_cycle();
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
61
SystemVerilog AXI3 and AXI4 Master BFMs
Note
get_write_addr_ready()
get_write_addr_ready()
This blocking AXI4 task returns the value of the write address channel AWREADY signal using
the ready argument. It will block for one ACLK period.
Prototype
Arguments ready
Returns
task automatic get_write_addr_ready
(
output bit ready
);
The value of the AWREADY signal.
None
AXI3 BFM
The get_write_addr_ready() task is not available in the AXI3 BFM.
AXI4 Example
// Get the value of the AWREADY signal
bfm.get_write_addr_ready();
62
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog AXI3 and AXI4 Master BFMs
Note
get_write_data_ready()
get_write_data_ready()
This blocking AXI4 task returns the value of the write data channel WREADY signal using the
ready argument. It will block for one ACLK period.
Prototype
Arguments ready
Returns
task automatic get_write_data_ready
(
output bit ready
);
The value of the WREADY signal.
None
AXI3 BFM
The get_write_data_ready() task is not available in the AXI3 BFM.
AXI4 Example
// Get the value of the WREADY signal
bfm.get_write_data_ready();
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
63
SystemVerilog AXI3 and AXI4 Master BFMs
Note
get_write_response_cycle()
get_write_response_cycle()
This blocking AXI4 task waits until the write response channel BVALID signal is asserted.
Prototype
task automatic get_write_response_cycle();
Arguments None
Returns
None
AXI3 BFM
The get_write_response_cycle() task is not available in the AXI3 BFM.
AXI4 Example
// Wait until the write response channel BVALID signal is asserted.
bfm.get_write_response_cycle();
64
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog AXI3 and AXI4 Master BFMs
Note
execute_read_data_ready()
execute_read_data_ready()
This AXI4 task executes a read data ready by placing the ready argument value onto the
RREADY signal. It will block for one ACLK period.
Prototype
Arguments ready
Returns
task automatic execute_read_data_ready
(
bit ready
);
The value to be placed onto the RREADY signal
None
AXI3 BFM
The execute_read_data_ready() task is not available in the AXI3 BFM. Use the
get_read_data_phase() task along with the transaction record data_ready_delay field.
AXI4 Example
// Assert and deassert the RREADY signal
forever begin
This blocking task waits for an event(s) on the ACLK or ARESETn signals to occur before
proceeding. An optional count argument waits for the number of events equal to count.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
67
SystemVerilog AXI3 and AXI4 Master BFMs
wait_on()
68
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
Chapter 4
Note
SystemVerilog AXI3 and AXI4 Slave BFMs
This section provides information about the SystemVerilog AXI3 and AXI4 slave BFMs. Each
BFM has an API that contains tasks and functions to configure the BFM and to access the
dynamic Transaction Record during the lifetime of the transaction.
Due to AXI3 protocol specification changes, for some BFM tasks, you reference the
AXI3 BFM by specifying AXI instead of AXI3.
Slave BFM Protocol Support
This section defines protocol support for various AXI BFMs.
The AXI3 slave BFM supports the AMBA AXI3 protocol with restrictions described in
“Protocol Restrictions” on page 1. In addition to the standard protocol, it supports user sideband
signals AWUSER and ARUSER.The AXI4 slave BFM supports the AMBA AXI4-Lite protocol
with restrictions described in “Protocol Restrictions” on page 1.
Slave Timing and Events
For detailed timing diagrams of the protocol bus activity refer to the relevant AMBA AXI
Protocol Specification chapter, which you can use to reference details of the following slave
BFM API timing and events.
The specification does not define any timescale or clock period with signal events sampled and
driven at rising ACLK edges. Therefore, the slave BFM does not contain any timescale,
timeunit, or timeprecision declarations with the signal setup and hold times specified in units of
simulator time-steps.
The simulator time-step resolves to the smallest of all the time-precision declarations in the
testbench and design IP based on using the directives, declarations, options, and initialization
files below:
•` timescale directives in design elements.
•timeprecision declarations in design elements.
•compiler command-line options.
•simulation command-line options
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
69
SystemVerilog AXI3 and AXI4 Slave BFMs
Note
Slave BFM Configuration
•local or site-wide simulator initialization files.
If there is no timescale directive, the default time unit and time precision are tool specific. Using
timeunit and timeprecision declarations are recommended. Refer to the SystemVerilog LRM
section 3.14 for details.
Slave BFM Configuration
The slave BFM supports the full range of signals defined for the AMBA AXI protocol
specification. It has parameters you can use to configure the widths of the address, ID and data
signals, and transaction fields to configure timeout factors, slave exclusive support, and setup
and hold times, etc.
You can change the address, ID and data signal widths from their default settings by assigning
them with new values, usually performed in the top-level module of the testbench. These new
values are then passed into the slave BFM using a parameter port list of the slave BFM module.
For example, the code extract below shows the AXI3 slave BFM with the address, ID and data
signal widths defined in module top() and passed in to the slave BFM mgc_axi_slave parameter
port list:
In the above code extract, mgc_axi_slave is an AXI3 slave BFM interface.
Table 4-1 lists the parameter names for the address, ID and data signals, and their default
values.
Table 4-1. Slave BFM Signal Width Parameters
Signal Width ParameterDescription
**_ADDRESS_WIDTHAddress signal width in bits. This applies to the ARADDR and
AWADDR signals. Refer to the AMBA AXI Protocol
specification for more details. Default: 32
**_RDATA_WIDTHRead data signal width in bits. This applies to the RDATA
signals. Refer to the AMBA AXI Protocol specification for more
details. Default: 64.
**_WDATA_WIDTHWrite data signal width in bits. This applies to the WDATA
signals. Refer to the AMBA AXI Protocol specification for more
details. Default: 64.
70
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
Table 4-1. Slave BFM Signal Width Parameters
Signal Width ParameterDescription
SystemVerilog AXI3 and AXI4 Slave BFMs
Slave BFM Configuration
**_ID_WIDTHID signal width in bits. This applies to the RID and WID signals.
AXI4_USER_WIDTH(AXI4) User data signal width in bits. This applies to the
AXI4_REGION_MAP_SIZE(AXI4) Region signal width in bits. This applies to the
Refer to the AMBA AXI Protocol specification for more details.
Default: 4.
ARUSER, AWUSER, RUSER, WUSER and BUSER signals.
Refer to the AMBA AXI Protocol specification for more details.
Default: 8.
ARREGION and AWREGION signals. Refer to the AMBA AXI
Protocol specification for more details. Default: 16.
A slave BFM has configuration fields that you can set with the set_config() function to
configure timeout factors, slave exclusive support, setup and hold times, etc. You can also get
the value of a configuration field via the get_config() function.
The full list of configuration fields is described in Table 4-2 below.
Table 4-2. Slave BFM Configuration
Configuration FieldDescription
Timing Variables
**_CONFIG_SETUP_TIMEThe setup-time prior to the active edge of
ACLK, in units of simulator time-steps for
all signals.
1
Default: 0.
**_CONFIG_HOLD_TIMEThe hold-time after the active edge of
**_CONFIG_MAX_TRANSACTION_
TIME_FACTOR
AXI_CONFIG_TIMEOUT_MAX_DATA_TRANSFER(AXI3) The maximum number of write
**_CONFIG_BURST_TIMEOUT_FACTORThe maximum delay between the
**_CONFIG_MAX_LATENCY_AWVALID_
ASSERTION_TO_AWREADY
**_CONFIG_MAX_LATENCY_ARVALID_
ASSERTION_TO_ARREADY
ACLK, in units of simulator time-steps for
all signals.
The maximum timeout duration for a
read/write transaction in clock cycles.
Default: 100000.
data beats that the AXI3 BFM can
generate as part of write data burst of
write transfer. Default: 1024.
individual phases of a read/write
transaction in clock cycles. Default:
10000.
The maximum timeout duration from the
assertion of AWVALID to the assertion of
AWREADY in clock periods (default
10000).
The maximum timeout duration from the
assertion of ARVALID to the assertion of
ARREADY in clock periods (default
10000).
1
Default: 0.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
71
SystemVerilog AXI3 and AXI4 Slave BFMs
Slave BFM Configuration
Table 4-2. Slave BFM Configuration (cont.)
Configuration FieldDescription
**_CONFIG_MAX_LATENCY_RVALID_
ASSERTION_TO_RREADY
**_CONFIG_MAX_LATENCY_BVALID_
ASSERTION_TO_BREADY
**_CONFIG_MAX_LATENCY_WVALID_
ASSERTION_TO_WREADY
AXI_CONFIG_WRITE_CTRL_TO_DATA_MINTIME(AXI3) The minimum delay from the start
AXI_CONFIG_MASTER_WRITE_DELAY(AXI3) The master BFM applies the
AXI_CONFIG_MASTER_DEFAULT_UNDER_RESET (AXI3) The master BFM drives the
The maximum timeout duration from the
assertion of RVALID to the assertion of
RREADY in clock periods (default
10000).
The maximum timeout duration from the
assertion of BVALID to the assertion of
BREADY in clock periods (default 10000).
The maximum timeout duration from the
assertion of WVALID to the assertion of
WREADY in clock periods (default
10000).
of a write control (address) phase to the
start of a write data phase in clock cycles.
Default: 1.
AXI_CONFIG_WRITE_CTRL_TO_
DATA_MINTIME value set.
0 = true (default)
1 = false
ARVALID, AWVALID and WVALID
signals low during reset:
0 = false (default)
1 = true
Slave Attributes
AXI4_CONFIG_ENABLE_QOS(AXI4) The master participates in the
Quality-of-Service scheme. If a master
does not participate, the
AWQOS/ARQOS value used in
write/read transactions must be b0000.
**_CONFIG_SUPPORT_EXCLUSIVE_ACCESSConfigures the support for an exclusive
slave. If enabled the BFM will expect an
EXOKAY response to a successful
exclusive transaction. If disabled the BFM
will expect an OKAY response to an
exclusive transaction. Refer to the AMBA
AXI protocol specification for more
details.
0 = disabled
1 = enabled (default)
AXI_CONFIG_SLAVE_DEFAULT_UNDER_RESET (AXI3) The slave BFM drives the BVALID
and RVALID signals low during reset.
Refer to the AMBA AXI Protocol
specification for more details.
0 = false (default)
1 = true
**_CONFIG_SLAVE_START_ADDRConfigures the start address map for the
slave.
72
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog AXI3 and AXI4 Slave BFMs
Note
Table 4-2. Slave BFM Configuration (cont.)
Configuration FieldDescription
Slave Assertions
**_CONFIG_SLAVE_END_ADDRConfigures the end address map for the
**_CONFIG_READ_DATA_REORDERING_DEPTHThe slave read reordering depth. Refer to
**_CONFIG_MAX_OUTSTANDING_WRConfigures the maximum number of
**_CONFIG_MAX_OUTSTANDING_RDConfigures the maximum number of
slave.
the AMBA AXI Protocol specification for
more details. Default: 1.
outstanding write requests from the
master that can be processed by the
slave. The slave back-pressures the
master by setting the signal
AWREADY=0b0 if this value is exceeded.
outstanding read requests from the
master that can be processed by the
slave. The slave back-pressures the
master by setting the signal
ARREADY=0b0 if this value is exceeded.
Error Detection
**_CONFIG_ENABLE_ALL_ASSERTIONSGlobal enable/disable of all assertion
**_CONFIG_ENABLE_ASSERTIONIndividual enable/disable of assertion
1.
Refer to Slave Timing and Events for details of simulator time-steps.
checks in the BFM.
0 = disabled
1 = enabled (default)
check in the BFM.
0 = disabled
1 = enabled (default)
Slave Assertions
Each slave BFM performs protocol error checking using the built-in assertions.
The built-in BFM assertions are independent of programming language and simulator.
AXI3 Assertion Configuration
By default, all built-in assertions are enabled in the slave BFM. To globally disable them in the
slave BFM, use the set_config() command as the following example illustrates:
set_config(AXI_CONFIG_ENABLE_ALL_ASSERTIONS,0)
Alternatively, individual built-in assertions can be disabled by using a sequence of get_config()
and set_config() commands on the respective assertion. For example, to disable assertion
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
73
SystemVerilog AXI3 and AXI4 Slave BFMs
Note
Slave Assertions
checking for the AWLOCK signal changing between the AWVALID and AWREADY handshake
signals, use the following sequence of commands:
// Define a local bit vector to hold the value of the assertion bit vector
bit [255:0] config_assert_bitvector;
// Get the current value of the assertion bit vector
config_assert_bitvector = bfm.get_config(AXI_CONFIG_ENABLE_ASSERTION);
// Assign the AXI_LOCK_CHANGED_BEFORE_AWREADY assertion bit to 0
config_assert_bitvector[AXI_LOCK_CHANGED_BEFORE_AWREADY] = 0;
// Set the new value of the assertion bit vector
bfm.set_config(AXI_CONFIG_ENABLE_ASSERTION, config_assert_bitvector);
Do not confuse the AXI_CONFIG_ENABLE_ASSERTION bit vector with the
AXI_CONFIG_ENABLE_ALL_ASSERTIONS global enable/disable.
To re-enable the AXI_LOCK_CHANGED_BEFORE_AWREADY assertion, follow the above
code sequence and assign the assertion in the AXI_CONFIG_ENABLE_ASSERTION bit vector
to 1.
For a complete listing of AXI3 assertions, refer to “AXI3 Assertions” on page 665.
AXI4 Assertion Configuration
By default, all built-in assertions are enabled in the slave AXI4 BFM. To globally disable them
in the slave BFM, use the set_config() command as the following example illustrates:
set_config(AXI4_CONFIG_ENABLE_ALL_ASSERTIONS,0);
Alternatively, individual built-in assertions can be disabled by using a sequence of get_config()
and set_config() commands on the respective assertion. For example, to disable assertion
checking for the AWLOCK signal changing between the AWVALID and AWREADY handshake
signals, use the following sequence of commands:
// Define a local bit vector to hold the value of the assertion bit vector
bit [255:0] config_assert_bitvector;
// Get the current value of the assertion bit vector
config_assert_bitvector = bfm.get_config(AXI4_CONFIG_ENABLE_ASSERTION);
// Assign the AXI4_LOCK_CHANGED_BEFORE_AWREADY assertion bit to 0
config_assert_bitvector[AXI4_LOCK_CHANGED_BEFORE_AWREADY] = 0;
// Set the new value of the assertion bit vector
bfm.set_config(AXI4_CONFIG_ENABLE_ASSERTION, config_assert_bitvector);
74
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
SystemVerilog AXI3 and AXI4 Slave BFMs
Note
SystemVerilog Slave API
Do not confuse the AXI4_CONFIG_ENABLE_ASSERTION bit vector with the
AXI4_CONFIG_ENABLE_ALL_ASSERTIONS global enable/disable.
To re-enable the AXI4_LOCK_CHANGED_BEFORE_AWREADY assertion, follow the above
code sequence and assign the assertion in the AXI4_CONFIG_ENABLE_ASSERTION bit vector
to 1.
For a complete listing of AXI4 assertions, refer to “AXI4 Assertions” on page 678.
SystemVerilog Slave API
This section describes the SystemVerilog Slave API.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
75
SystemVerilog AXI3 and AXI4 Slave BFMs
set_config()
set_config()
This function sets the configuration of the slave BFM.
Mentor VIP AE AXI3/4 User Guide, V10.2b
September 2013
79
SystemVerilog AXI3 and AXI4 Slave BFMs
create_slave_transaction()
create_slave_transaction()
This nonblocking function creates a slave transaction. All transaction fields default to legal
protocol values, unless previously assigned a value. It returns with the *_transaction record.
Prototype
Protocol
Transaction
Fields
// * = axi | axi4
// ** = AXI| AXI4
function automatic *_transaction create_write_transaction();