Altera AMBA AXI4-Stream User Manual

Mentor Verification IP Altera Edition
AMBA AXI4-Stream User Guide
Software Version 10.3
April 2014
© 2012-2014 Mentor Graphics Corporation
All rights reserved.
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 HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
U.S. GOVERNMENT LICENSE RIGHTS: The software and documentation were developed entirely at private expense and are commercial computer software and commercial computer software documentation within the meaning of the applicable acquisition regulations. Accordingly, pursuant to FAR 48 CFR 12.212 and DFARS 48 CFR 227.7202, use, duplication and disclosure by or for the U.S. Government or a U.S. Government subcontractor is subject solely to the terms and conditions set forth in the license agreement provided with the software, except for provisions which are contrary to applicable mandatory federal laws.
TRADEMARKS: The trademarks, logos and service marks ("Marks") used herein are the property of Mentor Graphics Corporation or other parties. No one is permitted to use these Marks without the prior written consent of Mentor Graphics or the owner of the Mark, as applicable. The use herein of a third­party 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.
The registered trademark Linux
®
is used pursuant to a sublicense from LMI, the exclusive licensee of
Linus Torvalds, owner of the mark on a world-wide basis.
Mentor Graphics Corporation
8005 S.W. Boeckman Road, Wilsonville, Oregon 97070-7777
Telephone: 503.685.7000
Toll-Free Telephone: 800.592.2210
Website: www.mentor.com
SupportNet: supportnet.mentor.com/
Send Feedback on Documentation: supportnet.mentor.com/doc_feedback_form

Table of Contents

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
About This User Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
AMBA AXI4-Stream Protocol Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Mentor VIP AE License Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Supported Simulators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13
Simulator GCC Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Chapter 1
Mentor VIP Altera Edition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Advantages of Using BFMs and Monitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Implementation of BFMs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
What Is a Transaction? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18
AXI4-Stream Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Master BFM and Slave BFM Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Chapter 2
SystemVerilog API Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
set_config() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
get_config(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Creating Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22
Transaction Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
create_*_transaction(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Executing Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26
execute_transaction() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Waiting Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
wait_on(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
get_packet(), get_transfer(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Access Transaction Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
set*() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
get*(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Operational Transaction Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Operation Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28
Handshake Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Transfer Done . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Transaction Done . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30
Chapter 3
SystemVerilog Master BFM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Master BFM Protocol Support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Master Timing and Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Master BFM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3 April 2014
3
Table of Contents
Master Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
SystemVerilog Master API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
set_config() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
get_config(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
create_master_transaction() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
execute_transaction() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
execute_transfer() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40
get_stream_ready() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
wait_on(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Chapter 4
SystemVerilog Slave BFM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Slave BFM Protocol Support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Slave Timing and Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Slave BFM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Slave Assertions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
SystemVerilog Slave API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
set_config() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
get_config(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
create_slave_transaction() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
get_transfer(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
execute_stream_ready() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
wait_on(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Chapter 5
SystemVerilog Monitor BFM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Inline Monitor Connection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Monitor BFM Protocol Support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Monitor Timing and Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Monitor BFM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Monitor Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
SystemVerilog Monitor API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
set_config() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
get_config(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
create_monitor_transaction() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
get_packet() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
get_transfer(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
get_stream_ready() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
wait_on(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Chapter 6
SystemVerilog Tutorials. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67
Verifying a Slave DUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Master BFM Test Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Verifying a Master DUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Slave BFM Test Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3
April 2014
Table of Contents
Chapter 7
VHDL API Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
set_config() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
get_config(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Creating Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .77
Transaction Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
create*_transaction(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80
Executing Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81
execute_transaction() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Waiting Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
wait_on(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
get_packet(), get_transfer(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Access Transaction Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
set*() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
get*(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Operational Transaction Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Operation Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .84
Handshake Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Transfer Done . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Transaction Done . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85
Chapter 8
VHDL Master BFM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Overloaded Procedure Common Arguments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Master BFM Protocol Support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Master Timing and Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Master BFM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Master Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
VHDL Master BFM API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
set_config() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
get_config(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
create_master_transaction() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
set_data(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
get_data() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
set_byte_type() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
get_byte_type() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
set_id() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
get_id() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
set_dest(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
get_dest() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
set_user_data() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
get_user_data() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
set_valid_delay(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
get_valid_delay() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
set_ready_delay() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
get_ready_delay() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
set_operation_mode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3 April 2014
5
Table of Contents
get_operation_mode(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
set_transfer_done() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
get_transfer_done(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
set_transaction_done() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
get_transaction_done() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
execute_transaction() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
execute_transfer() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
get_stream_ready() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
print() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
destruct_transaction() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
wait_on(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Chapter 9
VHDL Slave BFM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Slave BFM Protocol Support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Slave Timing and Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Slave BFM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Slave Assertions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
VHDL Slave BFM API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
set_config() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
get_config(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
create_slave_transaction() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
set_data(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
get_data() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
set_byte_type() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
get_byte_type() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
set_id() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
get_id() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
set_dest(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
get_dest() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
set_user_data() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
get_user_data() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
set_valid_delay(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
get_valid_delay() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
set_ready_delay() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
get_ready_delay() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
set_operation_mode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
get_operation_mode(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
set_transfer_done() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
get_transfer_done(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
set_transaction_done() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
get_transaction_done() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
get_packet() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
get_transfer(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
execute_stream_ready() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
print() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
destruct_transaction() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
wait_on(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
6
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3
April 2014
Table of Contents
Chapter 10
VHDL Monitor BFM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Inline Monitor Connection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Monitor BFM Protocol Support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Monitor Timing and Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Monitor BFM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Monitor Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
VHDL Monitor BFM API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
set_config() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
get_config(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
create_monitor_transaction() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
get_data() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
get_byte_type() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
get_id() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
get_dest() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
get_user_data() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
get_valid_delay() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
get_ready_delay() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
get_operation_mode(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
get_transfer_done(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
get_transaction_done() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
get_packet() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
get_transfer(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
print() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
destruct_transaction() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
wait_on(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Chapter 11
VHDL Tutorials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Verifying a Slave DUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Master BFM Test Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Verifying a Master DUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Slave BFM Test Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Chapter 12
Getting Started with Qsys and the BFMs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Setting Up a Simulation from a UNIX Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Setting Up Simulation from the Windows GUI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Running the Qsys Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Running a Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Chapter 13
Assertions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Appendix A
SystemVerilog Master and Slave Test Programs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
SystemVerilog Master Test Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
SystemVerilog Slave Test Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3 April 2014
7
Table of Contents
Appendix B
VHDL Master and Slave Test Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
VHDL Master BFM Code Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
VHDL Slave BFM Code Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Third-party Software for Mentor Verification IP Altera Edition
End-User License Agreement
8
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3
April 2014

List of Examples

Example 2-1. BFM Test Program Set Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Example 2-2. BFM Test Program Get Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Example 2-3. Transaction Record Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Example 2-4. Master BFM Test Program Transaction Creation . . . . . . . . . . . . . . . . . . . . . . 26
Example 2-5. Slave BFM Test Program Transaction Creation . . . . . . . . . . . . . . . . . . . . . . . 26
Example 2-6. Master Test Program Transaction Execution . . . . . . . . . . . . . . . . . . . . . . . . . 26
Example 2-7. Test Program Wait for Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Example 2-8. Slave Test Program get_transfer() Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Example 2-9. Master Test Program set_byte_type() Task. . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Example 2-10. Slave Test Program get_byte_type() Task . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Example 2-11. Master Test Program operation_mode() Task. . . . . . . . . . . . . . . . . . . . . . . . 29
Example 2-12. Slave Test Program ready_delay() Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Example 3-1. Master BFM Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Example 3-2. Master BFM Disable All Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Example 3-3. Master BFM Individual Assertion Enable/Disable . . . . . . . . . . . . . . . . . . . . . 34
Example 4-1. Slave BFM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Example 4-2. Slave BFM Disable All Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Example 4-3. Slave BFM Individual Assertion Enable/Disable . . . . . . . . . . . . . . . . . . . . . . 46
Example 5-1. Monitor BFM Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Example 5-2. Monitor BFM Disable All Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Example 5-3. Monitor BFM Individual Assertion Enable/Disable . . . . . . . . . . . . . . . . . . . . 59
Example 6-1. Definition and Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Example 6-2. Master Transaction Creation and Execution . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Example 6-3. Master Transfer Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Example 6-4. m_insert_wait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Example 6-5. ready_delay(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Example 6-6. Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Example 6-7. Transfer Receiving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Example 7-1. BFM Test Program Set Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Example 7-2. BFM Test Program Get Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Example 7-3. Transaction Record Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Example 7-4. Master BFM Test Program Transaction Creation . . . . . . . . . . . . . . . . . . . . . . 81
Example 7-5. Slave BFM Test Program Transaction Creation . . . . . . . . . . . . . . . . . . . . . . . 81
Example 7-6. Master Test Program Transaction Execution . . . . . . . . . . . . . . . . . . . . . . . . . 81
Example 7-7. Test Program Wait for Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Example 7-8. Slave Test Program get_packet() Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Example 7-9. Master Test Program set_byte_type() Procedure . . . . . . . . . . . . . . . . . . . . . . 83
Example 7-10. Slave Test Program get_byte_type() Procedure . . . . . . . . . . . . . . . . . . . . . . 83
Example 7-11. Master Test Program set_operation_mode() Procedure . . . . . . . . . . . . . . . . 84
Example 7-12. Slave Test Program ready_delay() Procedure . . . . . . . . . . . . . . . . . . . . . . . . 85
9
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3
April 2014
List of Examples
Example 8-1. Master BFM Disable All Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Example 8-2. Master BFM Individual Assertion Enable/Disable . . . . . . . . . . . . . . . . . . . . . 90
Example 9-1. Slave BFM Disable All Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Example 9-2. Slave BFM Individual Assertion Enable/Disable . . . . . . . . . . . . . . . . . . . . . . 126
Example 10-1. Monitor BFM Disable All Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Example 10-2. Monitor BFM Individual Assertion Enable/Disable . . . . . . . . . . . . . . . . . . . 160
Example 11-1. Definition and Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Example 11-2. Master Transaction Creation and Execution . . . . . . . . . . . . . . . . . . . . . . . . . 183
Example 11-3. Master Transfer Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Example 11-4. m_insert_wait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Example 11-5. ready_delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Example 11-6. Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Example 11-7. Transfer Receiving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
10
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3
April 2014

List of Figures

Figure 1-1. Master BFM Test Program Role. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Figure 1-2. Slave BFM Test Program Role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Figure 2-1. SystemVerilog BFM Internal Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Figure 5-1. Inline Monitor Connection Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Figure 6-1. Slave DUT Top-Level Test Bench Environment . . . . . . . . . . . . . . . . . . . . . . . . 67
Figure 6-2. Master DUT Top-Level Test Bench Environment . . . . . . . . . . . . . . . . . . . . . . . 71
Figure 7-1. VHDL BFM Internal Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Figure 10-1. Inline Monitor Connection Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Figure 11-1. Slave DUT Top-Level Test Bench Environment . . . . . . . . . . . . . . . . . . . . . . . 181
Figure 11-2. Master DUT Top-Level Test Bench Environment . . . . . . . . . . . . . . . . . . . . . . 185
Figure 12-1. Copy qsys-examples from the Installation Folder. . . . . . . . . . . . . . . . . . . . . . . 191
Figure 12-2. Paste qsys-examples from Installation to Work Folder . . . . . . . . . . . . . . . . . . 192
Figure 12-3. Select Qsys from the Quartus II Software Top-Level Menu . . . . . . . . . . . . . . 193
Figure 12-4. Open the ex1_back_to_back_sv.qsys Example. . . . . . . . . . . . . . . . . . . . . . . . . 193
Figure 12-5. Quartus II Software Displays the Connectivity of the Example. . . . . . . . . . . . 194
Figure 12-6. Qsys Generation Window Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Figure 12-7. Select the Work Directory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3 April 2014
11

List of Tables

Table 1. Simulator GCC Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Table 2-1. Transaction Record Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Table 3-1. Master BFM Signal Width Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Table 3-2. Master BFM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Table 4-1. Slave BFM Signal Width Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Table 4-2. Slave BFM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Table 5-1. Monitor BFM Signal Width Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Table 5-2. Monitor BFM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Table 7-1. Transaction Record Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Table 8-1. Master BFM Signal Width Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Table 8-2. Master BFM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Table 9-1. Slave BFM Signal Width Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Table 9-2. Slave BFM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Table 10-1. Monitor BFM Signal Width Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Table 10-2. Monitor BFM Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Table 12-1. SystemVerilog README Files and Script Names for all Simulators . . . . . . . 196
Table 13-1. AXI4-Stream Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
12
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3
April 2014

Preface

Note

About This User Guide

This user guide describes the application interface (API) of the Mentor® Verification IP (VIP)
®
Altera Specification, Version 1.0, Issue A (ARM IHI 0051A).

AMBA AXI4-Stream Protocol Specification

The Mentor VIP AE conforms to the AMBA 4 AXI4-Stream Protocol Specification, Version 1.0, Issue A (ARM IHI 0051A). This user guide refers to this specification as the “AMBA AXI4-Stream Protocol Specification.”

Mentor VIP AE License Requirements

Edition (AE) and how it conforms to the AMBA® 4 AXI4-Stream Protocol
A license is required to access the Mentor Graphics VIP AE bus functional models and inline monitor.
To access the Mentor Graphics VIP AE and upgrade to the Quartus II Subscription
Edition software, Version 14.0, from a previous version, you must regenerate your license file.
To access the Mentor VIP AE with the Quartus II Web Edition software, you must
upgrade to Version 14.0 and purchase a Mentor VIP AE seat license by contacting your Altera sales representative.
You can generate and manage license files for Altera software and IP products by visiting the Self-Service Licensing Center of the Altera website.

Supported Simulators

Mentor VIP AE supports the following simulators:
Mentor Graphics Modelsim 10.1e (including Altera Editions) and Questa Sim 10.2c
Synopsys
®
VCS® and VCS-MX 2013.06
Cadence
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3 April 2014
®
Incisive® Enterprise Simulator (IES) 13.10.001
13
Preface

Simulator GCC Requirements

Simulator GCC Requirements
Mentor VIP requires that the installation directory of the simulator 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, an error message similar to the following appears:
ModelSim / Questa SIM # ** Error: (vsim-8388) Could not find the MVC shared library : GCC not found in installation directory (/home/user/altera2/14.0/modelsim_ase) for platform "linux". Please install GCC version "gcc-4.5.0-linux"
14
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3
April 2014
Simulator GCC Requirements
Table 1. Simulator GCC Requirements
Simulator Version GCC Version(s) Search Path
Mentor Questa SIM
10.2c 4.5.0 (Linux 32 bit) <install dir>/gcc-4.5.0-linux
4.5.0 (Linux 64 bit) <install dir>/gcc-4.5.0-linux_x86_64
4.2.1 (Windows 32 bit) <install dir>/gcc-4.2.1-mingw32vc9
Mentor ModelSim
10.1e 4.5.0 (Linux 32 bit) <install dir>/gcc-4.5.0-linux
4.5.0 (Linux 64 bit) <install dir>/gcc-4.5.0-linux_x86_64
4.2.1 (Windows 32 bit) <install dir>/gcc-4.2.1-mingw32vc9
Synopsys VCS/VCS-MX
2013.06 4.5.2 (Linux 32 bit) $VCS_HOME/gnu/linux/4.5.2_32-shared
$VCS_HOME/gnu/4.5.2_32-shared
Preface
4.5.2 (Linux 64 bit) $VCS_HOME/gnu/linux/4.5.2_64-shared
$VCS_HOME/gnu/4.5.2_64-shared
Note: If you set the environment variable VG_GNU_PACKAGE, then it is used instead of the VCS_HOME environment variable.
Cadence Incisive
13.10.001 4.4 (Linux 32/64 bit) <install dir>/tools/cdsgcc/gcc/4.4
Note: 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.
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3 April 2014
15
Preface
Simulator GCC Requirements
16
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3
April 2014
Chapter 1
Mentor VIP Altera Edition
The Mentor VIP AE provides bus functional models (BFMs) to simulate the behavior and to facilitate the verification of the IP. The Mentor VIP AE includes the following interfaces:
AXI3 with master, slave, and inline monitor BFMs
AXI4 with master, slave, and inline monitor BFMs
AXI4-Lite with master, slave, and inline monitor BFMs
AXI4-Stream with master, slave, and inline monitor BFMs
This user guide covers the AXI4-Stream BFMs only. Refer to the Mentor Verification IP Altera
Edition AXI3/AXI4 User Guide for details of the AXI3 and AXI4 BFMs, and the Mentor Verification IP Altera Edition AXI4-Lite User Guide for details of the AXI4-Lite BFMs.

Advantages of Using BFMs and Monitors

Using the Mentor VIP AE has the following advantages:
Accelerates the verification process by providing key verification test bench
components
Provides BFM components that implement the AMBA 4 AXI4-Stream Protocol
Specification, which serves as a reference for the protocol
Provides a full suite of configurable assertion checking within 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 you can use the BFMs 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 may not be supported in future releases.
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3 April 2014
17
Mentor VIP Altera Edition

What Is a Transaction?

The test program drives the stimulus to the DUT and determines whether the behavior of the DUT is correct by analyzing the responses. The BFMs translate the test program stimuli (transactions), creating the signaling for the AMBA 4 AXI4-Stream Protocol Specification. The BFMs also check for protocol compliance by firing an assertion when a protocol error is observed.
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 it adheres to the protocol used to transfer the information. For example, a master transaction can communicate a data stream packet consisting of a number of transfers to a slave DUT. A subsequent data stream packet 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:
Protocol fields are transferred over the protocol signals
Operation fields determine how the information is transferred, and when the transaction
is complete
For example, a master transaction record holds a byte definition in the byte_type protocol field, the value of this field is transferred over the TKEEP and TSTRB protocol signals. A master transaction also has a transaction_done operation field that indicates when the transaction is complete; this operation 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 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.
18
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3
April 2014
Mentor VIP Altera Edition
Note
execute_transaction(t) – Master
execute_transfer() – Master
Master BFM
+
Test program
Slave DUT
Transfer Transfer TransferTransfer

AXI4-Stream Transactions

AXI4-Stream Transactions
A complete transaction communicates information between a master and a slave. 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 from the master to the slave during a transaction, with the master initiating the transaction.
The AXI4-Stream protocol has a single channel to transfer protocol information. It has a pair of handshake signals, TVALID and TREADY, that indicate valid information on the channel, and the acceptance of the information from the channel.

Master BFM and Slave BFM Roles

The following description of a master transaction references SystemVerilog BFM API tasks. There are equivalent VHDL BFM API procedures that perform the same functionality.
For a master transaction, the master calls the create_master_transaction() task to define the information to be transferred, and then calls the execute_transaction() task to initiate the communication of information, as shown in Figure 1-1.
The execute_transaction() task results in the master calling the execute_transfer() task a multiple number of times, equal to the number of transfers in the transaction.
Figure 1-1. Master BFM Test Program Role
The slave also creates a transaction by calling the create_slave_transaction() task to accept the transfer of information from the master. The transfer is received by the slave calling the
get_transfer() task, as shown in Figure 1-2.
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3 April 2014
19
Mentor VIP Altera Edition
execute_stream_ready() – Slave
Master
DUT
Slave BFM
+
Test
Program
Transfer Transfer TransferTransfer
get_transfer() – Slave
AXI4-Stream Transactions
Figure 1-2. Slave BFM Test Program Role
The slave can cause back-pressure to the master using the execute_stream_ready() task to set the TREADY protocol signal to “0” to inhibit subsequent “transfers” from the master.
20
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3
April 2014
Chapter 2
Test Program SystemVerilog
Notes: 1. Refer to create_*_transaction()
2. Refer to execute_transaction()
3. Refer to set*()
SystemVerilog BFM API
Configuration Creating Transaction
Waiting Events
Executing Transaction
Access Transaction
create_*_transaction
1
set_config/get_config
get_packet/get_transfer wait_on
3
Rx_Transaction
queue
queue
Tx_Transaction
Configuration
Wire level
get*/set*
execute_transaction/execute_transfer
2
SystemVerilog interface
SystemVerilog API Overview
This section provides the functional description of the SystemVerilog (SV) 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 set delay and timeout values.
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 Verification IP AE AMBA AXI4-Stream User Guide, V10.3 April 2014
21
SystemVerilog API Overview

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()

Example 2-1 shows how to set the burst timeout factor to 1000 for a transaction in the master
BFM test program.
Example 2-1. BFM Test Program Set Configuration
// Setting the burst timeout factor to 1000 master_bfm.set_config(AXI4STREAM_CONFIG_BURST_TIMEOUT_FACTOR, 1000);

get_config()

Example 2-2 shows how to get the signal hold time in the master BFM test program.
Example 2-2. BFM Test Program Get Configuration
// Getting hold time value
hold_time = master_bfm.get_config(AXI4STREAM_CONFIG_HOLD_TIME);

Creating Transactions

To transfer information between a master BFM and slave DUT over the protocol signals, you must create a transaction in the master test program. Similarly, to transfer information between a master DUT and a slave BFM, you must create a transaction in the slave test program. To monitor the transfer of information using a monitor BFM, you must create a transaction 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.
22
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3
April 2014
SystemVerilog API Overview
Note
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, respectively.
Protocol fields contain transaction information that is transferred over the protocol signals. For example, the id field is transferred over the TID protocol signals during a transaction to identify a data stream.
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.
Transaction Definition
The transaction record exists as a SystemVerilog class definition in each BFM. Example 2-3 shows the definition of the axi4stream_transaction class members that form the transaction record.
Example 2-3. Transaction Record Definition
// Global Transaction Class class axi4stream_transaction; // Protocol byte unsigned data[]; axi4stream_byte_type_e byte_type[]; bit [((`MAX_AXI4_ID_WIDTH) - 1):0] id; bit [((`MAX_AXI4_DEST_WIDTH) - 1):0] dest; bit [((`MAX_AXI4_USER_WIDTH) - 1):0] user_data []; int valid_delay[]; int ready_delay[];
// Housekeeping axi4stream_operation_mode_e
operation_mode = AXI4STREAM_TRANSACTION_BLOCKING; bit transfer_done[]; bit transaction_done;
...
endclass
The axi4stream_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.
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3 April 2014
23
SystemVerilog API Overview
Creating Transactions
The contents of the transaction record is detailed in Table 2-1.
Table 2-1. Transaction Record Fields
Transaction Field Description
Protocol Transaction Fields
data An unsized array of bytes to hold the data of an AXI4-Stream
packet. The field content is transferred over the TDATA protocol signals during a transaction.
byte_type An unsized array to hold the enumerated type of each data byte
within an AXI4-Stream packet. The field content is transferred over the TSTRB and TKEEP protocol signals during a transaction. The following are types of byte:
AXI4STREAM_DATA_BYTE AXI4STREAM_NULL_BYTE AXI4STREAM_POS_BYTE AXI4STREAM_ILLEGAL_BYTE
id A bit vector (of length equal to the TID protocol signal bus
width) to hold the data stream identifier of the data packet. The field content is transferred over the TID protocol signals during a transaction.
dest A bit vector (of length equal to the TDEST protocol signal bus
width) to hold the routing information for the data stream packet. The field content is transferred over the TDEST protocol signals during a transaction.
user_data An unsized bit vector (of length equal to the TUSER protocol
signal bus width) to hold the user-defined sideband information. The field content is transferred over the TUSER protocol signals during a transaction.
Operational Transaction Fields
valid_delay An unsized array of integers to hold the delay value of the
TVALID protocol signal (measured in ACLK cycles) for each transfer within a packet. The field content is not transferred over the protocol signals during a transaction.
ready_delay An unsized array of integers to hold the delay value of the
TREADY protocol signal (measured in ACLK cycles) for each transfer within a packet. The field content is not transferred over the protocol signals during a transaction.
24
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3
April 2014
SystemVerilog API Overview
Note
Creating Transactions
Table 2-1. Transaction Record Fields (cont.)
Transaction Field Description
operation_mode An enumeration to hold the operation mode of the transaction.
The following are two types of operation mode:
AXI4STREAM_TRANSACTION_NON_BLOCKING AXI4STREAM_TRANSACTION_BLOCKING
The field content is not transferred over the AXI4-Stream protocol signals during a transaction.
transfer_done An unsized bit array to hold the done flag for each transfer within
a packet. The field content is not transferred over the protocol signals during a transaction.
transaction_done A bit to hold the done flag for a complete transaction. The field
content is not transferred over the protocol signals during a transaction.
The SystemVerilog Master BFM API allows you to create a master transaction by providing only an optional burst_length argument to indicate the number of transfers within a packet. All other protocol transaction fields automatically default to legal protocol values to create a master transaction record. Refer to create_master_transaction() for default protocol transaction field values.
The SystemVerilog Slave BFM API allows you to create a slave transaction with no arguments. All protocol transaction fields automatically default to legal protocol values to create a slave transaction record. Refer to create_slave_transaction() for default protocol transaction field values.
The SystemVerilog Monitor BFM API allows you to create a monitor transaction with no arguments. All protocol transaction fields automatically default to legal protocol values to create a complete monitor transaction record. Refer to create_monitor_transaction() for default protocol transaction field values.
If you change the default value of a protocol transaction field, it is valid for all future transactions until you set a new value.

create_*_transaction()

The create_master_transaction(), create_slave_transaction() and create_monitor_transaction() BFM API functions create a master, a slave, and a monitor transaction, respectively.
Example 2-4 shows a master BFM test program creating a master transaction with a packet
length of 10 transfers.
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3 April 2014
25
SystemVerilog API Overview

Executing Transactions

Example 2-4. Master BFM Test Program Transaction Creation
// Define a variable trans of type axi4stream_transaction to hold // master transaction record axi4stream_transaction trans;
...
// Create master transaction with 10 transfers trans = bfm.create_master_transaction(10);
Example 2-5 shows a slave BFM test program creating a slave transaction.
Example 2-5. Slave BFM Test Program Transaction Creation
// Define a variable trans of type axi4stream_transaction to hold // slave transaction record axi4stream_transaction trans;
...
// Create a slave transaction trans = bfm.create_slave_transaction();
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 21 illustrates the internal BFM structure.

execute_transaction()

If the DUT is a slave, then the execute_transaction() task is called in the master BFM test program. Example 2-6 shows a master test program executing a master transaction.
Example 2-6. Master Test Program Transaction Execution
// Define a variable trans of type axi4stream_transaction to hold the // master transaction record. axi4stream_transaction trans;
...
// Create a master transaction with 10 transfers. trans = bfm.create_master_transaction(10);
...
// By default the execution of a transaction will block. bfm.execute_transaction(trans);
26
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3
April 2014
SystemVerilog API Overview
Note

Waiting Events

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 execution until an ACLK or ARESETn signal event has occurred before proceeding.
The get_packet(), get_transfer() tasks block the test program code execution until a complete stream packet, or transfer, has occurred.

wait_on()

Example 2-7 shows a BFM test program waiting for the positive edge of the ARESETn signal.
Example 2-7. Test Program Wait for Event
// Block test program execution until the positive edge of the // ARESETn signal. bfm.wait_on(AXI4STREAM_RESET_POSEDGE);

get_packet(), get_transfer()

Example 2-8 shows a slave BFM test program using the get_transfer() task to block until it has
received a data stream transfer.
Example 2-8. Slave Test Program get_transfer() Task
// Create a slave transaction. trans = bfm.create_slave_transaction();
...
// Wait for a data stream transfer to occur. bfm.get_transfer(trans, 0, last);

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 detailed within each BFM API chapter. The simple rule for the task name is set_ or get_ followed by the name of the transaction field to be accessed. Refer to “Transaction Record Fields” on page 24 for transaction field name details.
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3 April 2014
27
SystemVerilog API Overview

Operational Transaction Fields

set*()

Example 2-9 shows the master test program calling the set_byte_type() task to set the first data
byte_type in the transaction.
Example 2-9. Master Test Program set_byte_type() Task
trans.set_byte_type(AXI4STREAM_DATA_BYTE, 0);

get*()

Example 2-10 shows the slave test program calling the get_byte_type() task to get the first data
byte_type in the transaction.
Example 2-10. Slave Test Program get_byte_type() Task
// Define a variable of type axi4stream_byte_type_e to hold the byte // type of the data stream byte. axi4stream_byte_type_e slave_byte_type;
...
// Create a slave transaction. trans = bfm.create_slave_transaction();
...
// Wait for a data stream transfer to occur. bfm.get_transfer(trans, 0, last);
...
// Get the byte_type for the first data byte of the data stream transfer slave_byte_type = trans.get_byte_type(0);
Operational Transaction Fields
Operational transaction fields control the way in which a transaction is executed onto the protocol signals. These fields also indicate when an individual data transfer or transaction is complete.

Operation Mode

By default, each 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 AXI4STREAM_TRANSACTION_NON_BLOCKING instead of the default AXI4STREAM_TRANSACTION_BLOCKING.
28
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3
April 2014
SystemVerilog API Overview
Operational Transaction Fields
Example 2-11 shows a master BFM test program creating a transaction by calling the create_master_transaction() task. Before executing the transaction, the operation_mode task is
changed to nonblocking.
Example 2-11. Master Test Program operation_mode() Task
// Define a variable trans of type axi4stream_transaction to hold the // master transaction record. axi4stream_transaction trans;
// Create a master transaction to create a transaction record trans = bfm.create_master_transaction(1);
// Change the operation_mode to be nonblocking in the transaction record trans.operation_mode(AXI4STREAM_TRANSACTION_NON_BLOCKING);

Handshake Delay

You can configure the TVALID and TREADY handshake signals to insert a delay before their assertion.
TVALID Signal Delay Transaction Field
The Transaction Record contains a valid_delay transaction field to configure the delay of the TVALID signal. The setting of the valid_delay transaction field is performed in the master BFM test program by calling the set_valid_delay() task.
TREADY Signal Delay Transaction Field
The Transaction Record contains a ready_delay transaction field to configure the delay of the TREADY signal. The setting of the ready_delay transaction field is performed in the slave BFM test program by calling the local ready_delay() task.
Example 2-12 shows the slave BFM test program implementing a ready_delay() task that
inserts a specified delay before the assertion of the TREADY signal.
Example 2-12. Slave Test Program ready_delay() Task
// Task : ready_delay // This is used to set ready delay to extend the transfer task ready_delay();
// Making TREADY '0'. This will consume one cycle. bfm.execute_stream_ready(0); // Two clock cycle wait. In total 3 clock wait. repeat(2) bfm.wait_on(AXI4STREAM_CLOCK_POSEDGE); // Making TREADY '1'. bfm.execute_stream_ready(1);
endtask
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3 April 2014
29
SystemVerilog API Overview
Operational Transaction Fields

Transfer Done

A transfer_done transaction field is set to 1 to indicate when each protocol “transfer” completes.

Transaction Done

A transaction_done transaction field is set to 1 to indicate when each protocol “transaction” completes.
In a slave BFM test program, you call the get_transfer() task to investigate whether a transaction is complete. If complete, the task returns the last argument of the task set to 1, and the transaction record will have the transaction_done field set to 1.
30
Mentor Verification IP AE AMBA AXI4-Stream User Guide, V10.3
April 2014
Loading...
+ 201 hidden pages