Avalon Bus Spec

  • Upload
    dkagh

  • View
    216

  • Download
    0

Embed Size (px)

Citation preview

  • 8/8/2019 Avalon Bus Spec

    1/86

    Reference Manual

    Avalon Bus Specification

    101 Innovation DriveSan Jose, CA 95134(408) 544-7000http://www.altera.com

    Document Version: 1.2Document Date: July 2002

    http://www.altera.com/http://www.altera.com/
  • 8/8/2019 Avalon Bus Spec

    2/86

    ii Altera CorporationMNL-AVABUSREF-1.2

    Copyright Avalon Bus Specification Reference Manual

    Copyright 2002 Altera Corporation. All rights reserved. Altera, The Programmable Solutions Company, the stylized Altera logo,specific device designations, and all other words and logos that are identified as trademarks and/or service marks are, unlessnoted otherwise, the trademarks and service marks of Altera Corporation in the U.S. and other countries. All other product orservice names are the property of their respective holders. Altera products are protected under numerous U.S. and foreign patentsand pending applications, mask work rights, and copyrights. Altera warrants performance of its semiconductorproducts to current specifications in accordance with Alteras standard warranty, but reserves the right to makechanges to any products and services at any time without notice. Altera assumes no responsibility or liabilityarising out of the application or use of any information, product, or service described herein except as expresslyagreed to in writing by Altera Corporation. Altera customers are advised to obtain the latest version of devicespecifications before relying on any published information and before placing orders for products or services.

  • 8/8/2019 Avalon Bus Spec

    3/86

    Altera Corporation iii

    About this Manual

    This manual provides comprehensive information about the Altera Avalon TM Bus.

    Table 1 shows the reference manual revision history.

    How to FindInformation

    I The Adobe Acrobat Find feature allows you to search the contents ofa PDF file. Click the binoculars toolbar icon to open the Find dialog box.

    I Bookmarks serve as an additional table of contents.I Thumbnail icons, which provide miniature previews of each page,

    provide a link to the pages.I Numerous links, shown in green text, allow you to jump to related

    information.

    Table 1. Reference Manual Revision History

    Date Description

    July 2002 Minor edits and additions. Replaced Excalibur logo on cover

    with Altera logo - version 1.2April 2002 Updated PDF - version 1.1

    January 2002 Initial PDF - version 1.0

  • 8/8/2019 Avalon Bus Spec

    4/86

    iv Altera Corporation

    About this Manual Avalon Bus Specification Reference Manual

    How to ContactAltera

    For the most up-to-date information about Altera products, go to theAltera world-wide web site at http://www.altera.com .

    For technical support on this product, go tohttp://www.altera.com/mysupport . For additional information about

    Altera products, consult the sources shown in Table 2 .

    Note:(1) You can also contact your local Altera sales office or sales representative.

    Table 2. How to Contact Altera

    Information Type USA & Canada All Other Locations

    Product literature http://www.altera.com http://www.altera.com

    Altera literature services [email protected] (1) [email protected] (1)

    Non-technical customerservice

    (800) 767-3753 (408) 544-7000(7:30 a.m. to 5:30 p.m.Pacific Time)

    Technical support (800) 800-EPLD (3753)(7:30 a.m. to 5:30 p.m.Pacific Time)

    (408) 544-7000 (1) (7:30 a.m. to 5:30 p.m.Pacific Time)

    http://www.altera.com/mysupport/ http://www.altera.com/mysupport/

    FTP site ftp.altera.com ftp.altera.com

    http://www.altera.com/mysupportmailto:[email protected]:[email protected]:///reader/full/ftp.altera.comhttp:///reader/full/ftp.altera.comhttp:///reader/full/ftp.altera.comhttp:///reader/full/ftp.altera.commailto:[email protected]:[email protected]://www.altera.com/mysupport
  • 8/8/2019 Avalon Bus Spec

    5/86

    Altera Corporation v

    Avalon Bus Specification Reference Manual About this Manual

    TypographicConventions

    The Avalon Bus Specification Reference Manual uses the typographicconventions shown in Table 3 .

    Table 3. Conventions

    Visual Cue Meaning

    Bold Type with InitialCapital Letters

    Command names, dialog box titles, checkbox options, and dialog box options areshown in bold, initial capital letters. Example: Save As dialog box.

    bold type External timing parameters, directory names, project names, disk drive names,filenames, filename extensions, and software utility names are shown in bold type.Examples: fMAX, \QuartusII directory, d: drive, chiptrip.gdf file.

    Bold italic type Book titles are shown in bold italic type with initial capital letters. Example:1999 Device Data Book .

    Italic Type with Initial Capital Letters

    Document titles are shown in italic type with initial capital letters. Example: AN 75 (High-Speed Board Design).

    Italic type Internal timing parameters and variables are shown in italic type. Examples: t PIA, n + 1.Variable names are enclosed in angle brackets (< >) and shown in italic type. Example:, < project name >.pof file.

    Initial Capital Letters Keyboard keys and menu names are shown with initial capital letters. Examples:Delete key, the Options menu.

    Subheading Title References to sections within a document and titles of Quartus II Help topics areshown in quotation marks. Example: Configuring a FLEX 10K or FLEX 8000 Devicewith the BitBlaster Download Cable.

    Courier type Signal and port names are shown in lowercase Courier type. Examples: data1 , tdi ,input. Active-low signals are denoted by suffix n , e.g., resetn .

    Anything that must be typed exactly as it appears is shown in Courier type. Forexample: c:\quartusII\qdesigns\tutorial\chiptrip.gdf . Also, sectionsof an actual file, such as a Report File, references to parts of files (e.g., the AHDLkeyword SUBDESIGN ), as well as logic function names (e.g., TRI ) are shown inCourier.

    1., 2., 3., and a., b., c.,... Numbered steps are used in a list of items when the sequence of the items isimportant, such as the steps listed in a procedure.

    I Bullets are used in a list of items when the sequence of the items is not important.

    v The checkmark indicates a procedure that consists of one step only.1 The hand points to information that requires special attention.

    r The angled arrow indicates you should press the Enter key.f The feet direct you to more information on a particular topic.

  • 8/8/2019 Avalon Bus Spec

    6/86

  • 8/8/2019 Avalon Bus Spec

    7/86

    Altera Corporation vii

    Contents

    About this Manual ...................................................................................................................................... iiiHow to Find Information .............................................................................................................. iiiHow to Contact Altera .................................................................................................................. ivTypographic Conventions ..............................................................................................................vGeneral Description .........................................................................................................................9Features Overview .........................................................................................................................10Terms and Concepts ......................................................................................................................11

    Bus Cycle .................................................................................................................................11Bus Transfer ............................................................................................................................11Streaming Transfer ................................................................................................................12Read Transfer with Latency ................................................................................................. 12SOPC Builder Software and Generation of the Avalon Bus ............................................12System Module .......................................................................................................................12Avalon Bus Module ...............................................................................................................13Avalon Peripherals ................................................................................................................15

    Peripherals inside the System Module .......................................................................16Peripherals outside the System Module .....................................................................17

    Master Port ..............................................................................................................................17Slave Port ................................................................................................................................17Master-Slave Pair ...................................................................................................................17PTF File and SOPC Builder Parameters and Switches .....................................................18

    Avalon Bus Transfers .................................................................................................................... 18Master Interface versus Slave Interface ..............................................................................19Avalon Bus Timing ................................................................................................................19Avalon Bus Signals ................................................................................................................20Simultaneous Multi-Master Avalon Bus Considerations ................................................22

    Avalon Slave Transfers ........................................................................................................ .........23Avalon Signals for Slave Transfers ......................................................................................23Slave Read Transfers on the Avalon Bus ...........................................................................25

    Fundamental Slave Read Transfer .............................................................................. 25Slave Read Transfer with Fixed Wait States ..............................................................27Slave Read Transfer with Peripheral-Controlled Wait States ................................. 30Slave Read Transfer with Setup Time .........................................................................32

    Slave Write Transfers on the Avalon Bus ...........................................................................34Fundamental Slave Write Transfer ............................................................................. 34Slave Write Transfer with Fixed Wait States .............................................................37Slave Write Transfer with Peripheral-Controlled Wait States ................................ 38Slave Write Transfer with Setup and Hold Time ......................................................40

    Avalon Master Transfers ...............................................................................................................42

  • 8/8/2019 Avalon Bus Spec

    8/86

    viii Altera Corporation

    Contents

    Avalon Signals for Master Transfers ...................................................................................43Fundamental Master Read Transfers on the Avalon Bus ................................................44Fundamental Master Write Transfer on the Avalon Bus .................................................47

    Advanced Avalon Bus Transfers .................................................................................................50Streaming Transfer ................................................................................................................50

    Streaming Slave Transfers ............................................................................................50Streaming Master Transfers ......................................................................................... 57Avalon Read Transfers with Latency ..................................................................................60

    Slave Read Transfer with Latency ...............................................................................61Master Read Transfer with Latency ............................................................................63

    Avalon Bus Control Signals ..................................................................................................66Interrupt Request Signal ...............................................................................................66Reset Control Logic ........................................................................................................67Begin Transfer Signal ....................................................................................................68

    Avalon Bus Address Alignment Options ...................................................................................69Address Alignment Overview .............................................................................................69Choosing the Address Alignment Assignment for Avalon Peripherals .......................70Native Address Alignment 32-Bit Master Port ..............................................................71

    Slave Port Between 1 and 8 Bits .................................................................................. 71Slave Port Between 9 and 16 Bits ................................................................................. 72Slave Port Between 17 and 31 Bits ...............................................................................74

    Native Address Alignment 16-Bit Master Port ..............................................................74Slave Port Between 1 and 8 Bits ...................................................................................74Slave Port Between 9 and 16 Bits ................................................................................. 75

    Native Alignment Considerations in Multi-Master System Modules ...........................75Dynamic Bus Sizing ...............................................................................................................77

    8-bit Slave Port with Dynamic Bus Sizing ..................................................................7816-bit Slave Port with Dynamic Bus Sizing ................................................................79

    32-bit Slave Port with Dynamic Bus Sizing ................................................................81Connection to External Devices ...................................................................................................81

    Index ................................................................................................................................................................83

  • 8/8/2019 Avalon Bus Spec

    9/86

    Altera Corporation 9

    GeneralDescription

    Avalon is a simple bus architecture designed for connecting on-chipprocessors and peripherals together into a system onaprogrammablechip (SOPC). Avalon is an interface that specifies the port connections between master and slave components, and specifies the timing by whichthese components communicate.

    The principal design goals of the Avalon Bus were:

    I Simplicity Provide an easy-to-understand protocol with a shortlearning curve.

    I Optimized resource utilization for bus logic Conserve logic elements(LEs) inside the Programmable Logic Device (PLD).

    I Synchronous operation Integrate well with other user logic thatcoexists on the same PLD, while avoiding complex timing analysisissues.

    Basic Avalon bus transactions transfer a single byte, half-word, or word(8, 16, or 32 bits) between a master and slave peripheral. After a transfercompletes, the bus is immediately available on the next clock for anothertransaction, either between the same master-slave pair, or betweenunrelated masters and slaves. The Avalon bus also supports advancedfeatures, such as latency-aware peripherals, streaming peripherals andmultiple bus masters. These advanced transfer modes allow multipleunits of data to be transferred between peripherals during a single bustransaction.

    The Avalon bus supports multiple bus masters. This multi-masterarchitecture provides great flexibility in the construction of SOPCsystems, and is amenable to high bandwidth peripherals. For example, amaster peripheral may perform Direct Memory Access (DMA) transfers,without requiring a processor in the data path to transfer data from theperipheral to memory.

    Avalon masters and slaves interact with each other based on a techniquecalled slave-side arbitration. Slave-side arbitration determines whichmaster gains access to a slave, in the event that multiple masters attemptto access the same slave at the same time. Slave-side arbitration offers two benefits:

    $YDORQ %XV 6SHFLILFDWLRQ

  • 8/8/2019 Avalon Bus Spec

    10/86

    10 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    1. The details of arbitration are encapsulated inside the Avalon bus.Therefore, the master and slave interfaces are consistent, regardlessof the number of masters and slaves on the bus. Each bus masterinterfaces to the Avalon bus as if it were the only master on the bus.

    2. Multiple masters can perform bus transactions simultaneously, aslong as they do not access the same slave during the same bus cycle.

    Avalon has been designed to accommodate the system ona programmable chip (SOPC) environment. The Avalon bus is an active, on-chip bus architecture, which consists of logic and routing resources insidea PLD. Some principles of the Avalon architecture are:

    1. The interface to peripherals is synchronous to the Avalon clock.Therefore, no complex, asynchronous handshaking/acknowledgeschemes are necessary. The performance of the Avalon bus (and theoverall system) can be measured using standard, synchronoustiming analysis techniques.

    2. All signals are active LOW or HIGH, which facilitates immediateturn-around of the bus. Multiplexers (not tri-state buffers) inside theAvalon bus determine which signals drive which peripheral.Peripherals are never required to tri-state their outputs, even whenthe peripheral is deselected.

    3. The address, data and control signals use separate, dedicated ports,which simplifies the design of peripherals. A peripheral does notneed to decode address and data bus cycles, and does not need todisable its outputs when it is not selected.

    Avalon also includes a number of features and conventions to supportautomatic generation of systems, busses, and peripherals by the SOPCBuilder software.

    FeaturesOverview

    Up to 4GB Address Space Memory and peripherals may be mappedanywhere within the 32-bit address space.

    Synchronous Interface All Avalon signals are synchronized to the Avalon bus clock. This simplifies the relevant timing behavior of the Avalon Bus,and facilitates integration with high-speed peripherals.

    Separate Address, Data and Control Lines Separate, dedicated address anddata paths provide the easiest interface to on-chip user logic. Peripherals

    do not need to decode data and address bus cycles.

  • 8/8/2019 Avalon Bus Spec

    11/86

    Altera Corporation 11

    $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO $YDORQ %XV 6SHFLILFDWLRQ

    Built-in Address Decoding The Avalon Bus automatically generates ChipSelect signals for all peripherals, greatly simplifying the design of Avalonperipherals.

    Multiple Master Bus Architecture Multiple master peripherals can resideon the Avalon Bus. The Avalon Bus automatically generates arbitrationlogic.

    Wizard-based Configuration Easy-to-use graphical Wizards guide theuser through Avalon Bus configuration (adding peripherals, specifyingmaster/slave relationships, defining the memory map). The Avalon busarchitecture is generated automatically based on user input from thewizard interface.

    Dynamic Bus Sizing The Avalon bus automatically handles the detailsof transferring data between peripherals with mismatched data widths,allowing peripherals of various widths to interface easily.

    Terms andConcepts

    Many of the terms and concepts relating to SOPC design are entirely new,or substantially different from traditional, off-chip bus architectures. Thedesigner needs to understand this context in order to understand theAvalon bus specification. The following terms and concepts create aconceptual framework upon which the Avalon bus specification is built.They are used throughout this document.

    Bus Cycle

    A bus cycle is a basic unit of one bus clock period, which is defined fromrising-edge to rising-edge of the Avalon master clock. Bus signal timing isreferenced to the bus cycle clock.

    Bus Transfer

    An Avalon bus transfer is a read or write operation of a data object, whichmay take one or more bus cycles. The transfer sizes supported by theAvalon bus include byte (8-bit), half-word (16-bit) and word (32-bit).

  • 8/8/2019 Avalon Bus Spec

    12/86

    12 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    Streaming Transfer

    Streaming transfers create an open channel between a streaming masterand streaming slave to perform successive data transfers. This channelallows data to flow between the master-slave pair as data becomesavailable. The master does not have to continuously access status registersin the slave peripheral to determine whether the slave can send or receivedata. Streaming transfers maximize throughput between a master-slavepair, while avoiding data overflow or underflow on the slave peripheral.This is especially useful for DMA transfers.

    Read Transfer with Latency

    Read transfer with latency increase the bandwidth efficiency tosynchronous peripherals that require several cycles of latency for the firstaccess, but can return data every bus cycle thereafter. Latent transfersallow a master to issue a read request, move on to an unrelated task, andreceive the data later. The unrelated task can be issuing another readtransfer, even though data from the previous transfer hasn t yet returned.This is beneficial for instruction fetch operations and DMA transfers, inwhich access to sequential addresses is the norm. In these cases, the CPUor the DMA master may prefetch expected data, thereby keeping thesynchronous memory active and reducing the average access latency.

    SOPC Builder Software and Generation of the Avalon Bus

    SOPC Builder is a system generation and integration tool developed byAltera. SOPC Builder generates the system module, which is the on-chipcircuitry that comprises the Avalon bus, master peripherals, and slaveperipherals. SOPC Builder has a graphical user interface for addingmaster and slave peripherals to the system module, configuring theperipherals, and then configuring the Avalon bus to connect peripheralstogether. With this information, SOPC Builder automatically creates andconnects HDL modules, that implements all or part of the user s PLDdesign.

    f See the SOPC Builder Data Sheet f or more information about the SystemModule.

    System Module

    Consider the structure of a user-defined System on a Programmable Chip,

    part of which is automatically generated by the SOPC Builder. The entiresystem is implemented on an Altera PLD, as shown in Example 1 .

  • 8/8/2019 Avalon Bus Spec

    13/86

    Altera Corporation 13

    $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO $YDORQ %XV 6SHFLILFDWLRQ

    Example 1. System Module Integrated with User Logic into an Altera PLD

    For purposes of this document, System module refers to the portion of thedesign that was automatically generated by SOPC Builder. The systemmodule contains at least one Avalon master peripheral and the entireAvalon bus module. The system module usually contains several Avalonslave peripherals, such as UARTs, timers or PIOs. The logic external to thesystem module may contain custom Avalon peripherals and other customlogic unrelated to the system module.

    The system module must be connected to the designer s PLD design. Theports on the system module will vary, depending on which peripheralsare included in the system module and what settings were made in theSOPC Builder. These ports may include direct connections to the Avalon

    bus, and user-defined ports to peripherals inside the system module.

    Avalon Bus Module

    The Avalon bus module is the backbone of an system module. It is themain path of communication between peripherals components in anSOPC design. The Avalon bus module is the sum of all control, data andaddress signals and arbitration logic that connect together the peripheralcomponents making up the system module. The Avalon bus moduleimplements a configurable bus architecture, which changes to fit theinterconnection needs of the designer s peripherals.

    PCI_ctrlPCI_addrPCI_data

    Data

    Instr

    System Module

    Signalsto

    on-chipuserlogic

    Signalsto

    off-chipdevices

    UserlogicareaPCI

    bridge

    Customperipheral

    Off-chipmemory

    A v a

    l o n

    B u s

    M o

    d u

    l e

    NiosCPU

    PIO

    Customperipheral

    Altera PLD

  • 8/8/2019 Avalon Bus Spec

    14/86

    14 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    The Avalon bus module is generated automatically by the SOPC Builder,so that the system designer is spared the task of connecting the bus andperipherals together. The Avalon bus module is very rarely used as adiscrete unit, because the SOPC Builder will almost always be used toautomate the integration of processors and other Avalon bus peripheralsinto a system module. The designer s view of the Avalon bus moduleusually is limited to the specific ports that relate to the connection ofcustom Avalon peripherals.

    Note that the Avalon bus module (an Avalon bus) is a unit of active logicthat takes the place of passive, metal bus lines on a physical PCB. (See Example 2 ). In this context, the ports of the Avalon bus module could bethought of as the pin connections for all peripheral devices connected to apassive bus. The Avalon Bus Specification Reference Manual defines only theports, logical behavior and signal sequencing that comprise the interfaceto the Avalon bus module. It does not specify any electrical or physicalcharacteristics of a physical bus.

    Figure 2. Avalon Bus Module Block Diagram - an example system

    The Avalon bus module provides the following services to Avalonperipherals connected to the bus:

  • 8/8/2019 Avalon Bus Spec

    15/86

    Altera Corporation 15

    $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO $YDORQ %XV 6SHFLILFDWLRQ

    I Data-path Multiplexing Multiplexers in the Avalon bus moduletransfer data from the selected slave peripheral to the appropriatemaster peripheral.

    I Address Decoding Address decoding logic produces chip-selectsignals for each peripheral. This simplifies peripheral design, becauseindividual peripherals do not need to decode the address lines togenerate chip-select signals.

    I Wait-state Generation Wait-state generation extends bus transfers by one or more bus cycles, for the benefit of peripherals with specialsynchronization needs. Wait states can be generated to stall a masterperipheral in cases when the target slave peripheral cannot respondin a single clock cycle. Wait states can also be generated in cases whenread-enable and write-enable signals have setup or hold timerequirements.

    I Dynamic Bus Sizing Dynamic bus sizing hides the details ofinterfacing narrow peripherals to a wider Avalon bus, or vice versa.For example, in the case of a 32-bit master read transfer from a 16-bitmemory, dynamic bus sizing would automatically execute two slaveread transfers to fetch 32 bits of data from the 16-bit memory device.This reduces the logic and/or software complexity in the masterperipheral, because the master does not have to worry about thephysical nature of the slave peripheral.

    I Interrupt-Priority Assignment When one or more slave peripheralsgenerate interrupts, the Avalon bus module passes the (prioritized)interrupts to appropriate master peripherals, along with the

    appropriate interrupt request (IRQ) number.I Latent Transfer Capabilities The logic required to perform transfers

    with latency between master-slave pairs is contained inside theAvalon bus module.

    I Streaming Read and Write Capabilities The logic required to allowstreaming transfers between master-slave pairs is contained insidethe Avalon bus module.

    Avalon Peripherals

    An Avalon peripheral on the Avalon bus is a logical device either on-chip or off-chip that performs some system-level task, andcommunicates with other system components through the Avalon Bus.Peripherals are modular system components, and may be added orremoved at design time, depending on the requirements of the system.

  • 8/8/2019 Avalon Bus Spec

    16/86

    16 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    Avalon peripherals can be memories and processors, as well as traditionalperipheral components, such as a UART, PIO, timer or bus bridge. Anyuser logic can also be an Avalon peripheral, as long as it provides address,data and control signal interfaces to the Avalon bus in accordance to the

    Avalon Bus Specification Reference Manual. A peripheral connects to specificports on the Avalon bus module allocated for that peripheral. Theperipheral may also have user-defined ports in addition to the Avalonaddress, data and control signals. These signals connect to custom logicexternal to the system module.

    The roles of Avalon peripherals are classified as either a master or slave.A master peripheral is a peripheral that can initiate bus transfers on theAvalon bus. A master peripheral has at least one master port ( see MasterPort on page 17 ) which connects to the Avalon bus module. A masterperipheral may also have a slave port ( see Slave Port on page 17 ), whichallows the peripheral to receive bus transfers initiated by other masterperipherals on the Avalon bus. A slave peripheral is a peripheral that onlyaccepts bus transfers from the Avalon bus, and cannot initiate bustransfers. Slave peripherals, such as memory devices or UARTs, usuallyhave only one slave port, which connects to the Avalon bus module.

    In the SOPC environment, it is important to make the distinction betweenthe following types of peripherals, which may be either Avalon busmasters or slaves.

    Peripherals inside the System Module

    If SOPC Builder finds a peripheral in a peripheral library, or if thedesigner specifies the location of a custom peripheral design file, thenSOPC Builder automatically connects the peripheral to the Avalon busmodule. Such a peripheral is referred to as a peripheral inside the systemmodule, and is treated as a piece of the system module. The details ofconnecting the address, data and control ports to the Avalon bus moduleare hidden from the user. Any additional non-Avalon ports on theperipheral are presented to the outside world as ports on the systemmodule. These ports may connect directly to physical device pins, or mayconnect to the ports of other on-chip modules.

  • 8/8/2019 Avalon Bus Spec

    17/86

    Altera Corporation 17

    $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO $YDORQ %XV 6SHFLILFDWLRQ

    Peripherals outside the System Module

    An Avalon bus peripheral can also exist external to the system module.This is referred to as a peripheral outside the system module. A designermay chose to leave the module outside the system module for severalreasons: The peripheral may exist physically outside the PLD; theperipheral may require some glue logic to connect it to the Avalon bussignals; or the peripheral design may not be complete at the time thesystem module is generated. In this case, the appropriate Avalon busmodule signals are presented to the outside world (and to the specificperipheral) as ports on the system module.

    Master Port

    A master port is the collection of ports on a master peripheral used toinitiate transfers on the Avalon bus. The master port connects directly tothe Avalon bus module. In practice, a master peripheral may have one ormore master ports, as well as a slave port. The interdependence of thesemaster and slave ports is dependent on the peripheral design. However,individual bus transfers on these master or slave ports always conform tothe Avalon Bus Specification Reference Manual. Throughout this document,a master transfer refers to an Avalon bus transfer from the perspective ofa single master port.

    Slave Port

    A slave port is the collection of ports on a peripheral to accept Avalon bustransfers from the master port on another Avalon peripheral. The slaveport connects directly to the Avalon bus module. Master peripherals mayalso have a slave port, which allows the peripheral to accept transfersfrom other masters on the Avalon bus. Throughout this document, a slavetransfer refers to an Avalon bus transfer from the perspective of a singleslave port.

    Master-Slave Pair

    A master-slave pair is the combination of a master port and a slave portthat are connected via the Avalon bus module. Structurally, these masterand slave ports connect to their appropriate ports on the Avalon busmodule. Effectively, the master port s control and data signals passthrough the Avalon bus module, and interact with the slave port.Connections between master and slave ports (thus creating master-slavepairs) are specified in the SOPC Builder.

  • 8/8/2019 Avalon Bus Spec

    18/86

    18 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    PTF File and SOPC Builder Parameters and Switches

    The configuration of the Avalon bus and peripherals can be specifiedusing the wizard-based SOPC Builder graphical user interface (GUI).Through this GUI the user specifies various parameters and switches,which are then used to generate a system PTF file. The PTF file is a text filethat fully defines:

    I Parameters that define the structure and/or functionality of theAvalon bus module.

    I Parameters for each peripheral that define its structure and/orfunctionality.

    I The master/slave role of each peripheral.I The ports (such as read enable, read data, write enable, write data)

    present on each peripheralI The arbitration mechanism for each slave port that can be accessed bymultiple master ports

    The PTF file is then passed to an HDL generator that creates the actualregister transfer level (RTL) description of the system module.

    f See the SOPC Builder Data Sheet for additional information about thesystem PTF files.

    Avalon BusTransfers

    The Avalon bus specification defines the signals and timing required totransfer data between a master port and a slave port via the Avalon busmodule. The signals that comprise the interface between the Avalon busmodule and the peripheral are different, depending on the type oftransfer. Foremost, the interface is different for master transfers and slave

    transfers, giving rise to the distinct definitions of a slave port and a masterport. Furthermore, the exact type and number of signals required willvary, based on assignments made in the system PTF file.

    The Avalon bus specification offers a variety of options to tailor the bussignals and timing to the needs of different types of peripherals.Fundamental Avalon bus transfers move a single unit of data per bustransfer between a master-slave pair. The bus transfer can be extendedwith wait states to accommodate slow peripherals. Streaming transactionsalong with simultaneous multi-master capabilities accommodate high-

    bandwidth peripherals. Peripherals can also use a combination oftransaction types. The sequencing of signals for all Avalon slave transfersare derived from the fundamental slave read transfer and fundamentalslave write transfer. Likewise, the fundamental master read and master

    write transfers are the basis for all Avalon master transfers. A firmunderstanding of the fundamental transfers will facilitate understandingthe more advanced bus transfers.

  • 8/8/2019 Avalon Bus Spec

    19/86

    Altera Corporation 19

    $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO $YDORQ %XV 6SHFLILFDWLRQ

    Master Interface versus Slave Interface

    When discussing Avalon bus transfers, it is important to pay attention towhich side of the bus is the focus: the master port interface or the slaveport interface. The signals output from a master port on the Avalon busmodule may be very different from the corresponding signals that areinput into the slave port on the target peripheral.

    The signal activity on the slave side is always the result of a masterperipheral initiating a bus transfer, but the actual slave port input signalsdo not come directly from the master port. The Avalon bus module relaysthe signals from the master port, and custom-tailors the signals (e.g.,inserts wait states; arbitrates between contending masters) to the needs ofthe slave peripheral.

    For this reason, the discussion Avalon bus transfers is separated intomaster transfer types and slave transfer types. Most designers will beinterested only in slave transfers, because the custom peripherals theydesign (if any) will most likely be slave peripherals. In this case, thedesigner considers only the signaling between the Avalon bus moduleand the custom peripheral. The discussion of master transfers is onlyrelevant in the event that a designer creates a master peripheral.

    Avalon Bus Timing

    Avalon is a synchronous bus interface, clocked by a master Avalon busclock. All bus transfers occur synchronous to the Avalon bus clock. All bustransfers initiate on a rising clock edge, and terminate after valid data iscaptured on (or before) a subsequent rising clock edge.

    Note that synchronous bus interface does not necessarily mean that allAvalon bus signals are registered. Notably, the Avalon chipselect signal is combinatorial, based on the outputs of registers that aresynchronous to the Avalon bus clock, clk . Therefore, peripherals mustnot be edge sensitive to Avalon signals, because Avalon signals maytransition multiple times before they stabilize. As with any synchronousdesign, Avalon bus peripherals must function only in response to signalsthat are stable at the rising edge of clk , and output stable signals at therising edge of clk .

    It is possible to interface asynchronous peripherals such as off-chip,asynchronous memory to the Avalon bus module, but there are a fewdesign considerations. Due to the synchronous operation of the Avalon

    bus module, Avalon signals toggle only at intervals equal to the period ofthe Avalon bus clock. Also, if an asynchronous peripheral s outputs areconnected directly to the Avalon bus module, the designer must makesure that the output signals are stable before the rising edge of clk .

  • 8/8/2019 Avalon Bus Spec

    20/86

    20 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    The Avalon Bus Specification makes no attempt to dictate how signalstransition between clock edges. We know only that toggling signals aretriggered by the Avalon bus clock, and that signals must stabilize beforethe clock edge when they are captured. For this reason, the Avalon bustiming diagrams in this document are devoid of explicit timinginformation. The exact timing of signals toggling and stabilizing betweenclock edges will vary, depending upon the characteristics of the AlteraPLD selected to implement the system. By the same token, there is noinherent maximum performance of the Avalon bus. After synthesis andplace-and-route of the System Module for a specific device, the designermust perform standard timing analysis on the System Module todetermine the maximum speed at which Avalon bus transfers can beperformed.

    Avalon Bus SignalsBecause the Avalon bus is an on-chip bus architecture synthesized fromHDL files, special attention must be given to the connections between theAvalon bus module and Avalon peripherals. The situation is verydifferent from a passive, off-chip bus architecture in which all peripheralsshare access to a pre-defined and constant group of physical metal wires.In the case of the Avalon bus, the SOPC Builder must know exactly whatAvalon ports are present on each peripheral so that it can connect theperipherals to Avalon bus module. Furthermore, it must know the nameof each port and the role of each port. The name and role for each port onan Avalon peripheral is declared in the system PTF file.

    The Avalon Bus Specification does not mandate the existence of any porton an Avalon peripheral. It only defines the possible types of signals (suchas address, data, clock ) that can exist on a peripheral. Each port ona peripheral is assigned a valid Avalon signal type, which determines theport s role. A port may also be user-defined, in which case the SOPCBuilder does not connect the port to the Avalon bus module.Fundamentally, the Avalon signal types are classified as either slave portsignals or master port signals. Therefore, the signal types used by aperipheral are determined first and foremost by the master/slave role ofthe port. Each master or slave port may have up to one of each signal type.The set of signal types used by an individual master or slave port isdependent on the design of the peripheral. For example, the design for anoutput-only PIO slave peripheral would define only ports for writetransfers (the output direction), but no ports for read transfers. Such aperipheral also probably would have no use for an Interrupt Request(IRQ) output, even though an IRQ output is an allowed signal type for aslave port.

  • 8/8/2019 Avalon Bus Spec

    21/86

    Altera Corporation 21

    $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO $YDORQ %XV 6SHFLILFDWLRQ

    The Avalon Bus Specification does not dictate a naming convention for theports on an Avalon peripheral. The role of each port is well defined, butthe name of the port is defined by the peripheral design. The port may benamed the same as its signal type, or it may be named differently tocomply with a system-wide naming convention. The discussion of Avalon

    bus transfers in the following sections refers to Avalon signals as, forexample, the readdata signal or the irq signal. The name of the signaltype has been used here as the port name, but the actual names given toports on peripherals in the System Module may be different.

    Table 1 shows a partial list of the signal types available to an Avalon slaveport as an example. The signal direction is from the perspective of theperipheral. For example, the clock signal clk (listed as an input) is aninput to the slave peripheral, but it is an output from the Avalon busmodule.

    Table 1. Partial List of Avalon Slave Signals

    Signal Type Width Direction Required Description

    clk LQ QR *OREDO FORFN VLJQDO IRU WKH V\VWHP PRGXOHDQG $YDORQ EXV PRGXOH $OO EXV WUDQVDFWLRQVDUH V\QFKURQRXV WRclk 2QO\ DV\QFKURQRXVVODYH SRUWV FDQ RPLWclk

    address LQ QR $GGUHVV OLQHV IURP WKH $YDORQ EXV PRGXOHaddress LV E\WH DGGUHVVDEOH

    read LQ QR 5HDG UHTXHVW VLJQDO WR VODYH 1RW UHTXLUHG LWKH VODYH QHYHU RXWSXWV GDWD WR D PDVWHU ,IXVHGreaddata PXVW DOVR EH XVHG

    readdata RXW QR 'DWD OLQHV WR WKH $YDORQ EXV PRGXOH IRU UHDGWUDQVIHUV 1RW UHTXLUHG LI WKH VODYH QHYHURXWSXWV GDWD WR D PDVWHU ,I XVHGread VLJQDOPXVW DOVR EH XVHG

    write LQ QR :ULWH UHTXHVW VLJQDO WR VODYH 1RW UHTXLUHGWKH VODYH QHYHU UHFHLYHV GDWD IURP D PDVWHU,I XVHG writedata PXVW DOVR EH XVHG

    writedata LQ QR 'DWD OLQHV IURP WKH $YDORQ EXV PRGXOH IRU ZULWH WUDQVIHUV 1RW UHTXLUHG LI WKH VODYH QHYUHFHLYHV GDWD IURP D PDVWHU ,I XVHG writeVLJQDO PXVW DOVR EH XVHG

    irq RXW QR ,QWHUUXSW UHTXHVW 6ODYH DVVHUWVirq ZKHQ LWQHHGV WR EH VHUYLFHG E\ D PDVWHU

  • 8/8/2019 Avalon Bus Spec

    22/86

    22 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    The signal types listed in Table 1 are active high. However, the Avalon busalso offers the negated version of each signal type. By appending _n tothe signal type name (e.g., irq_n, read_n ) in the PTF declaration, thecorresponding port is declared active low. This is useful for many off-chipperipherals that use active-low logic.

    The Avalon bus signals and their operation is the same, whether aperipheral is implemented inside the system module or outside thesystem module. In the inside case, the SOPC Builder automaticallyconnects the peripheral s master or slave port to the Avalon bus module.In the outside case, the designer must manually connect the master orslave port to the system module. In either case, the Avalon bus signals

    behave the same.

    f For additional System Builder and PTF file information see the SOPCBuilder Data Sheet.

    Simultaneous Multi-Master Avalon Bus Considerations

    The Avalon bus accommodates multiple master ports connected to theAvalon bus module. However, no special signals external to the Avalon

    bus module are used to implement simultaneous multi-master Avalon bus functionality. Slave-side arbitration logic inside the Avalon busmodule arbitrates conflicts when multiple master peripherals attempt toaccess the same slave peripheral at the same time. The arbitration schemeis entirely hidden from Avalon bus peripherals. Therefore, the protocolfor Avalon bus transfers as perceived by master and slave ports is thesame, whether arbitration is used or not.

    In other words, slave ports are not aware that multiple masters havesimultaneously requested a bus transfer. Likewise, a master peripheralthat is forced to wait by the arbitration logic is not aware of the othervictorious master. The master port simply sees its wait-request signalasserted, and knows that it must wait until the target slave is ready toproceed with the bus transfer. Hiding the details of arbitration inside theAvalon bus module greatly simplifies peripheral design, because anyAvalon peripheral can be used both in single-master and multi-masterarchitectures.

    f See Simultaneous Multi-Mastering with the Avalon Bus Application Note (AN184) for more information.

  • 8/8/2019 Avalon Bus Spec

    23/86

    Altera Corporation 23

    $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO $YDORQ %XV 6SHFLILFDWLRQ

    Avalon SlaveTransfers

    The following sections discuss bus transfers between a slave port and theAvalon bus. From an abstract, system-level viewpoint, master peripheralsexchange data with slave peripherals. However, from the viewpoint of aslave peripheral, data is transferred between the peripheral s slave portand the Avalon bus module. In the following discussion of bus transferswith slave ports, it is assumed that a master peripheral somewhere on theAvalon bus has successfully initiated a transfer on the master side of theAvalon bus module. As a result, the Avalon bus module then initiates thetransfer with the appropriate slave port. The interface between the Avalon

    bus module and the slave port is the exclusive focus of this section.

    Avalon Signals for Slave Transfers

    Table 2 below lists the signal types that interface a peripheral s slave portto the Avalon bus module. The signal direction is from the perspective ofthe slave port. Not all of the signal types listed in Table 2 will be presenton all peripherals, depending on the peripheral design and the portsdeclared in the PTF file. Table 2 gives a brief description of which signalsare required and under what circumstances

    Table 2. Avalon Slave Port Signals

    Signal Type Width Direction Required Description

    clk LQ QR *OREDO FORFN VLJQDO IRU WKH V\VWHP PRGXOH DQG $YDORQ EXV PRGXOH $OO EXV WUDQVDFWLRQV DUHV\QFKURQRXV WRclk 2QO\ DV\QFKURQRXV VODYHSRUWV FDQ RPLWclk

    reset LQ QR *OREDO UHVHW VLJQDO ,PSOHPHQWDWLRQ LV SHULSKHUDVSHFLILF

    chipselect LQ \HV &KLS VHOHFW VLJQDO WR WKH VODYH 7KH VODYH SRUWVKRXOG LJQRUH DOO RWKHU $YDORQ VLJQDO LQSXWV XQOHVchipselect LV DVVHUWHG

    address LQ QR $GGUHVV OLQHV IURP WKH $YDORQ EXV PRGXOHaddress LV E\WH DGGUHVVDEOH

    byteenable LQ QR %\WH HQDEOH VLJQDOV WR HQDEOH VSHFLILF E\WH ODQHGXULQJ WUDQVIHUV WR PHPRULHV RI ZLGWK JUHDWHU WKDQ

    ELWV ,PSOHPHQWDWLRQ LV SHULSKHUDO VSHFLILF

    read LQ QR 5HDG UHTXHVW VLJQDO WR VODYH 1RW UHTXLUHG LI WKVODYH QHYHU RXWSXWV GDWD WR D PDVWHU ,I XVHGreaddata PXVW DOVR EH XVHG

    readdata RXW QR 'DWD OLQHV WR WKH $YDORQ EXV PRGXOH IRU UHDGWUDQVIHUV 1RW UHTXLUHG LI WKH VODYH QHYHU RXWSXWGDWD WR D PDVWHU ,I XVHGread VLJQDO PXVW DOVR EHXVHG

  • 8/8/2019 Avalon Bus Spec

    24/86

    24 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    In the following discussions of Avalon slave transfers, the read , write and byteenable signals are used in their active-low form, which issimilar to the traditional convention of using active-low read enable, writeenable and byte enable signals. Note the following:

    I These signals appear in the form read_n , write_n and byteenable_n .

    I byteenable_n is often abbreviated be_n .I Any port of an Avalon signal type may be used with active high or

    low polarity, based on the port s declaration in the PTF file.

    write LQ QR :ULWH UHTXHVW VLJQDO WR VODYH 1RW UHTXLUHG LI WVODYH QHYHU UHFHLYHV GDWD IURP D PDVWHU ,I XVHG

    writedata PXVW DOVR EH XVHG

    writedata LQ QR 'DWD OLQHV IURP WKH $YDORQ EXV PRGXOH IRU ZULWHWUDQVIHUV 1RW UHTXLUHG LI WKH VODYH QHYHU UHFHLYGDWD IURP D PDVWHU ,I XVHG write VLJQDO PXVWDOVR EH XVHG

    waitrequest RXW QR 8VHG WR VWDOO WKH $YDORQ EXV PRGXOH ZKHQ VODYHSRUW LV QRW DEOH WR UHVSRQG LPPHGLDWHO\

    readyfordata RXW QR 6LJQDO IRU VWUHDPLQJ WUDQVIHUV ,QGLFDWHV WKDW WVWUHDPLQJ VODYH FDQ UHFHLYH GDWD

    dataavailable RXW QR 6LJQDO IRU VWUHDPLQJ WUDQVIHUV ,QGLFDWHV WKDW WVWUHDPLQJ VODYH KDV GDWD DYDLODEOH

    endofpacket RXW QR 6LJQDO IRU VWUHDPLQJ WUDQVIHUV 0D\ EH XVHG WRLQGLFDWH DQ HQG RI SDFNHW FRQGLWLRQ WR WKH PDVWHSRUW ,PSOHPHQWDWLRQ LV SHULSKHUDO VSHFLILF

    irq RXW QR ,QWHUUXSW UHTXHVW 6ODYH DVVHUWVirq ZKHQ LW QHHGVWR EH VHUYLFHG E\ D PDVWHU

    resetrequest RXW QR $ UHVHW VLJQDO DOORZLQJ D SHULSKHUDO WR UHVHW WHQWLUH V\VWHP PRGXOH

    begintransfer RXW QR $VVHUWHG GXULQJ WKH ILUVW EXV F\FOH RI HDFK QHZ $YDORQ EXV WUDQVIHU 8VDJH LV SHULSKHUDO VSHFLILF

  • 8/8/2019 Avalon Bus Spec

    25/86

    Altera Corporation 25

    $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO $YDORQ %XV 6SHFLILFDWLRQ

    Slave Read Transfers on the Avalon Bus

    In the discussions of read transfers below, it is important to realize thatunder realistic circumstances, bus transfers are not isolated events. Theytypically happen in continuous succession. For example, a slave readtransfer may immediately precede or follow an unrelated write transfer.During the read transfer, the target peripheral s read_n andchipselect signals are necessarily asserted, as shown in the timingdiagrams. However, after the read transfer terminates, chipselect andread_n may remain asserted if another bus transfer with this slave portfollows on the next bus cycle. The timing diagrams below show undefinedvalues on the slave port signals before and after the read transfer.Fundamental slave read transfers have no latency.

    Fundamental Slave Read Transfer

    The fundamental slave read transfer is the basis for all Avalon slave readtransfers. All other slave read transfer modes use a superset of thefundamental signals, and implement a variation of the fundamental slaveread timing. The fundamental slave read transfer is initiated by theAvalon bus module, and transfers one unit of data, the full width of theperipheral s data port, from the slave port to the Avalon bus module.Fundamental slave read transfers have no latency.

    Example 1 shows an example of the fundamental read transfer. In thefundamental Avalon read transfer, the bus transfer starts on a rising clockedge, no wait states are incurred, and the read transfer completes on thenext rising clock edge. For the transfer to complete in a single bus cycle,the target peripheral must immediately and asynchronously output the

    contents of the addressed location to the Avalon bus module.

    On the first rising edge of clk , the Avalon bus passes the address , be_n and read_n signals to the target peripheral. The Avalon bus moduledecodes address internally, generates a chip select and drives thecombinatorial chipselect signal to the slave port. Once chipselect isasserted, the slave port drives out its readdata as soon as it is available.Finally, the Avalon bus module captures the readdata on the next risingedge of the clock.

    Example 1. Fundamental Slave Read Transfers

    This Example Demonstrates: Relevant PTF Parameters:

    5HDG WUDQVIHU IURP DQ DV\QFKURQRXV SHULSKHUDO

    =HUR ZDLW VWDWHV 5HDGB:DLWB6WDWHV

    =HUR VHWXS 6HWXSB7LPH

  • 8/8/2019 Avalon Bus Spec

    26/86

    26 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    IXQGDPHQWDO 6ODYH 5HDG 7UDQVIHU

    ([DPSOH 7LPH 5HIHUHQFH 'HVFULSWLRQ$ )LUVW EXV F\FOH VWDUWV RQ WKH ULVLQJ HGJH RIclk% 5HJLVWHUHG RXWSXWVaddress DQGread_n IURP $YDORQ EXV WR VODYH DUH YDOLG& $YDORQ EXV GHFRGHVaddress DVVHUWV YDOLGchipselect WR VODYH' 6ODYH SRUW UHWXUQV YDOLG GDWD GXULQJ WKH ILUVW EXV F\FOH

    ( $YDORQ EXV FDSWXUHVreaddata RQ WKH QH[W ULVLQJ HGJH RIclk DQG WKH UHDG WUDQVIHU HQGVKHUH 7KH QH[W EXV F\FOH FRXOG EH WKH VWDUW RI DQRWKHU EXV WUDQVIHU

    Notice that this fundamental read transfer with zero wait states isappropriate only for truly asynchronous peripherals, such as on-chipRAM or fast off-chip SRAM. The target peripheral must present data tothe Avalon bus immediately when the peripheral is selected and/or theaddress changes. For the transfer to work properly, readdata s outputmust be valid and stable by the next rising clock edge.

    Synchronous peripherals that register the input or output ports cannot usethe fundamental slave read transfer with zero wait states. Most on-chipperipherals will use a synchronous interface that requires at least oneclock to capture data, which necessitates at least one wait state during theread transfer.

    3 H U L S K H U D O

    3 H U L S K H U D O

    p y x

    h q q r i r f

    6 O D Y H 3 R U W

    0 D V W H U 3 R U W

    $ Y D O R Q % X V

    0 R G X O H

    8 y

    9 h h

    6 q q r

    v r f

    p u v r y r p

    v r q h h

    h v

    r r

    FON

    DGGUHVV EHBQ

    UHDGQ

    FKLSVHOHFW

    UHDGGDWD

    DGGUHVV EHBQ

    UHDGGDWD

    $ & ' (%

  • 8/8/2019 Avalon Bus Spec

    27/86

    Altera Corporation 27

    $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO $YDORQ %XV 6SHFLILFDWLRQ

    The byte enable lines be_n may be connected to the peripheral s slaveport. Interpretation of be_n is peripheral dependent for slave readtransfers. In the simplest case, the slave port ignores be_n , and alwaysdrives all byte lanes whenever read_n is asserted. The Avalon busmodule captures the full bit width of the readdata port every readtransfer. Therefore, if an individual byte lane is not enabled during a readtransfer, the value returned to the Avalon bus module is undefined, whichmay or may not affect the master that ultimately receives the data.

    When chipselect is deasserted, all other input signals should beignored. The slave port outputs may be driven or left undefined when theslave port is not selected. The chipselect signal driven to the targetperipheral may be combinatorial, based on registered address values.Furthermore, a low-to-high edge on chipselect or a high-to-low edgeon read_n cannot be used as a start read transfer trigger, because such anedge is not guaranteed.

    Slave Read Transfer with Fixed Wait States

    The ports used for a slave read transfer with fixed wait states are identicalto those used for a fundamental read transfer. The difference is in thetiming of signals only. Slave read transfers with wait states are useful forperipherals that cannot present data within a single clock cycle. Forexample, with one fixed wait state specified, the Avalon bus modulepresents a valid address and control, but waits for one clock cycle beforecapturing the peripheral s data. Fixed wait states for a peripheral aredeclared in the PTF file. They are fixed because the Avalon bus modulewaits a fixed number of bus cycles every read transfer.

    Example 2 shows an example slave read transfer with one wait state. TheAvalon bus module presents address , be_n , read_n and chipselect during the first bus cycle. Because of the wait state, the peripheral does nothave to present readdata within the first bus cycle; the first bus cycle isthe first (and only) wait state. The slave port may capture address andcontrol signals at any time. On-chip, synchronous peripherals willprobably capture address and control on the rising edge of clk at the startof the second bus cycle (the end of the wait state). During the second buscycle, the target peripheral presents its readdata to the Avalon busmodule. On the 3rd and final rising clock edge, the Avalon bus modulecaptures readdata from the slave port, and completes the transfer.

  • 8/8/2019 Avalon Bus Spec

    28/86

    28 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    Example 2. Slave Read Transfer with One Fixed Wait State

    ([DPSOH 7LPH 5HIHUHQFH 'HVFULSWLRQ

    $ )LUVW EXV F\FOH VWDUWV RQ WKH ULVLQJ HGJH RIclk% 5HJLVWHUHG RXWSXWVaddress DQGread_n IURP $YDORQ EXV WR VODYH DUH YDOLG& $YDORQ EXV GHFRGHVaddress DVVHUWVchipselect' 5LVLQJ HGJH RIclk PDUNV WKH HQG RI WKH ILUVW DQG RQO\ ZDLW VWDWH EXV F\FOH ,I W

    LV V\QFKURQRXV LW SUREDEO\ FDSWXUHVaddress read_n chipselect RQ WKLV ULVLQJHGJH RIclk

    ( 3HULSKHUDO SUHVHQWV YDOLGreaddata GXULQJ WKH VHFRQG EXV F\FOH) $YDORQ EXV PRGXOH FDSWXUHVreaddata RQ WKH ULVLQJ HGJH RIclk DQG WKH UHDG WUDQVIHU

    HQGV KHUH 7KH QH[W EXV F\FOH FRXOG EH WKH VWDUW RI DQRWKHU EXV WUDQVIHU

    This Example Demonstrates Relevant PTF Parameters

    5HDG WUDQVIHU IURP D V\QFKURQRXV SHULSKHUDO

    IL[HG ZDLW VWDWH 5HDGB:DLWB6WDWHV

    1R VHWXS WLPH 6HWXSB7LPH

    3 H U L S K H U D O

    3 H U L S K H

    U D O

    FON

    DGGUHVV EHBQ

    6 O D Y H 3 R U W

    0 D V W H U 3 R U W

    $ Y D O R Q %

    X V

    0 R G X O H

    &RQWURO

    'DWD

    $GGUHVV

    ZULWHBQ

    FKLSVHOHFW

    ZULWHGDWD ZDLW

    UHTXHVW

    FON

    GGUHVV EHBQ

    UHDGQ

    FKLSVHOHFW

    UHDGGDWD

    DGGUHVV EHBQ

    UHDGGDWD

    $ % & ' ( )

  • 8/8/2019 Avalon Bus Spec

    29/86

    Altera Corporation 29

    $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO $YDORQ %XV 6SHFLILFDWLRQ

    Read transfers with a single wait state are frequently used forsynchronous, on-chip peripherals. Sound PLD design methodologydictates that the interface between modules should be synchronized withregisters. Adding a wait state makes the transfer more amenable to PLDdesign, because the peripheral can capture synchronous signals address ,be_n , read_n and chipselect on the rising edge of clk afterchipselect is asserted. The target peripheral then has at least one full

    bus cycle to present data back to the Avalon bus module.

    Example 3 shows a read transfer with multiple fixed wait states. This caseis almost identical to Example 2 , except that the Avalon Bus now waits formore than one bus cycle before sampling the readdata from the slaveperipheral.

    Example 3. Slave Read Transfer with Multiple Fixed Wait States

    This Example Demonstrates: Relevant PTF Parameters:

    5HDG WUDQVIHU IURP D V\QFKURQRXV SHULSKHUDO

    IL[HG ZDLW VWDWHV 5HDGB:DLWB6WDWHV

    1R VHWXS WLPH 6HWXSB7LPH

    3 H U L S K H

    U D O

    3 H U L S K H U D O

    FON

    DGGUHVV EHBQ

    6 O D Y H 3 R U W

    0 D V W H U 3

    R U W

    $ Y D O R Q % X V

    0 R G X O H

    &RQWURO

    'DWD

    $GGUHVV ZULWHBQ

    FKLSVHOHFW

    ZULWHGDWD ZDLW

    UHTXHVW

  • 8/8/2019 Avalon Bus Spec

    30/86

    30 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    ([DPSOH 7LPH 5HIHUHQFH 'HVFULSWLRQ

    $ )LUVW EXV F\FOH VWDUWV RQ WKH ULVLQJ HGJH RIclk

    % 5HJLVWHUHG RXWSXWVaddress DQGread_n IURP $YDORQ EXV WR VODYH DUH YDOLG& $YDORQ EXV GHFRGHVaddress WKHQ DVVHUWVchipselect' 5LVLQJ HGJH RIclk PDUNV WKH HQG RI WKH ILUVW ZDLW VWDWH EXV F\FOH ,I WKH VODY

    V\QFKURQRXV LW SUREDEO\ FDSWXUHVaddress read_n chipselect RQ WKLV ULVLQJ HGJHRI clk

    ( 5LVLQJ HGJH RIclk PDUNV WKH HQG RI WKH VHFRQG DQG ODVW ZDLW VWDWH) 3HULSKHUDO SUHVHQWV YDOLGreaddata VRPHWLPH GXULQJ WKH WKLUG F\FOH* $YDORQ EXV PRGXOH FDSWXUHVreaddata RQ WKH ULVLQJ HGJH RIclk DQG WKH UHDG WUDQVIHU

    HQGV KHUH 7KH QH[W EXV F\FOH FRXOG EH WKH VWDUW RI DQRWKHU EXV WUDQVIHU

    Slave Read Transfer with Peripheral-Controlled Wait States

    Peripheral-controlled wait states allow a target peripheral to stall theAvalon bus module for as many bus cycles as required to present data.Using this transfer mode, a peripheral can take a variable amount of timeto present data to the Avalon bus module.

    Example 4 shows slave read transfer with peripheral-controlled waitstates. The peripheral-controlled wait state mode uses the waitrequest signal, which is an output from the slave port. After read_n is assertedto the slave port, the slave port must return waitrequest within the first

    bus cycle if it wishes to extend the read transfer. When asserted, waitrequest stalls the Avalon bus module and prevents it from

    capturing readdata . The Avalon bus module will capture readdata onthe next rising edge of clk after waitrequest is deasserted.

    The Avalon bus module does not have a time-out feature to limit howlong the slave port can stall. When the Avalon bus module is stalled,somewhere in the System Module there is a master peripheral that isstalled as well, waiting for the requested data to come back from theaddressed slave peripheral. A slave port could permanently hang themaster port. Therefore, the peripheral designer must ensure that a slaveperipheral does not assert waitrequest indefinitely.

    FON

    DGGUHVV EHBQ

    UHDGQ

    FKLSVHOHFW

    UHDGGDWD

    DGGUHVV EHBQ

    UHDGGDWD

    $ % & ' ( ) *

  • 8/8/2019 Avalon Bus Spec

    31/86

    Altera Corporation 31

    $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO $YDORQ %XV 6SHFLILFDWLRQ

    Example 4. Slave Read Transfer with Peripheral-Controlled Wait States

    ([DPSOH 7LPH 5HIHUHQFH 'HVFULSWLRQ

    $ )LUVW EXV F\FOH VWDUWV RQ WKH ULVLQJ HGJH RIclk% 5HJLVWHUHG RXWSXWVaddress DQGread_n IURP $YDORQ EXV WR VODYH DUH YDOLG& $YDORQ EXV GHFRGHVaddress WKHQ DVVHUWVchipselect' 6ODYH SRUW DVVHUWV waitrequest EHIRUH WKH QH[W ULVLQJ HGJH RIclk( $YDORQ EXV PRGXOH VDPSOHV waitrequest DW WKH ULVLQJ HGJH RIclk waitrequest LV

    DVVHUWHG VRreaddata LV QRW FDSWXUHG RQ WKLV FORFN HGJH) * :LWK waitrequest DVVHUWHG WKURXJKRXW DQ LQILQLWH QXPEHU RI EXV F\FOHV HODSV

    + 6ODYH SRUW SUHVHQWV YDOLGreaddata, 6ODYH SRUW GHDVVHUWV waitrequest- $YDORQ EXV PRGXOH FDSWXUHVreaddata RQ WKH QH[W ULVLQJ HGJH RIclk DQG WKH UHDG

    WUDQVIHU HQGV KHUH 7KH QH[W EXV F\FOH FRXOG EH WKH VWDUW RI DQRWKHU EXV

    This Example Demonstrates Relevant PTF Parameters

    5HDG WUDQVIHU IURP V\QFKURQRXV SHULSKHUDO

    0RUH WKDQ RQH SHULSKHUDO FRQWUROOHG ZDLW VWDWH 5HDGB:DLWB6WDWHV SHULSKHUDOBFRQWUROO

    1R VHWXS 6HWXSB7LPH

    FON

    DGGUHVV EHBQ

    UHDGQ

    FKLSVHOHFW

    ZDLWUHTXHVW

    UHDGGDWD

    DGGUHVV EHBQ DGGUHVV EHBQ

    UHDGGDWD

    % & ' ( * + , -) $

  • 8/8/2019 Avalon Bus Spec

    32/86

    32 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    When peripheral-controlled wait states are specified, the followingrestrictions apply to other bus transfer modes. These restrictions applyonly to transfers with this specific slave port, not to any other peripheralconnected to the Avalon bus module.

    If peripheral-controlled wait states are specified, setup and hold waitstates cannot be used. In almost all cases, a peripheral that can generatethe waitrequest signal will be on-chip and synchronous causing setupand hold time considerations unnecessary.

    Slave Read Transfer with Setup Time

    The Avalon bus module automatically accommodates setup timerequirements for each slave port, based on declarations made in the PTFfile. The master peripheral that initiates the read transfer does not need toconsider the setup and hold requirements of each slave port. The portsused for a read transfer with setup time are identical to those used for afundamental read transfer. The difference is in the timing of signals only.

    Setup time is generally used for off-chip peripherals that require address and chipselect signals to be stable for a period of time before the readenable signal is asserted. A nonzero setup time of N means that, afteraddress , be_n and chipselect signals are presented to the slave port,there is a delay of N bus cycles before read_n is asserted. Note thatchipselect is not affected by the setup time. If the peripheral requires asetup time for both read_n and chipselect , then the designer mustmanually add the appropriate logic (one AND gate) to the interface.

    The total number of bus cycles to complete the bus transfer depends onsetup and wait-state bus cycles. For example, a peripheral withSetup_Time = 2 and Read_Wait_States = 3 will take 6 bus cycles tocomplete the transfer:

    I 2 setup bus cycles plus;I 3 wait-state bus cycles plus;I 1 bus cycle to capture data.

    Example 5 shows a slave read transfers with one bus cycle of setup andone fixed wait state.

  • 8/8/2019 Avalon Bus Spec

    33/86

    Altera Corporation 33

    $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO $YDORQ %XV 6SHFLILFDWLRQ

    Figure 5. Slave Read Transfer with Setup Time

    ([DPSOH 7LPH 5HIHUHQFH 'HVFULSWLRQ

    $ )LUVW EXV F\FOH RQ WKH ULVLQJ HGJH RIclk% 5HJLVWHUHG RXWSXWaddress DQGbe_n IURP WKH $YDORQ EXV PRGXOH DUH YDOLGread_n

    UHPDLQV GHDVVHUWHG& $YDORQ EXV PRGXOH GHFRGHVaddress WKHQ DVVHUWVchipselect' 5LVLQJ HGJH RIclk GHILQHV WKH HQG RI WKH VHWXSWLPH EXV F\FOH 7VX DQG WKH V

    ZDLW VWDWH EXV F\FOH( $YDORQ EXV PRGXOH DVVHUWVread_n

    ) 5LVLQJ HGJH RIclk PDUNV WKH HQG RI WKH ZDLW VWDWH EXV F\FOH* 3HULSKHUDO SUHVHQWV YDOLGreaddata+ $YDORQ EXV PRGXOH FDSWXUHVreaddata DW WKH ULVLQJ HGJH RI clk DQG WKH UHDG WUDQVIHU

    HQGV KHUH 7KH QH[W EXV F\FOH FRXOG EH WKH VWDUW RI DQRWKHU EXV WUDQVIHU

    This Example Demonstrates: Relevant PTF Parameters:

    5HDG WUDQVIHU IURP V\QFKURQRXV SHULSKHUDO

    EXV F\FOH RI VHWXS WLPH 6HWXSB7LPH

    IL[HG ZDLW VWDWH 5HDGB:DLWB6WDWHV

    3 H U L S K H U D O

    3 H U L S K

    H U D O

    FON

    DGGUHVV EHBQ

    6 O D Y H 3 R U W

    0 D V W H U 3 R U W

    $ Y D O R Q

    % X V

    0 R G X

    O H

    &RQWURO

    'DWD

    $GGUHVV ZULWHBQ

    FKLSVHOHFW

    ZULWHGDWD ZDLW

    UHTXHVW

    FON

    DGGUHVV EHBQ

    FKLSVHOHFW

    UHDGQ

    UHDGGDWD

    DGGUHVV EHBQ

    UHDGGDWD

    7VX

    $ % & ' ( ) * +

  • 8/8/2019 Avalon Bus Spec

    34/86

    34 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    When setup time is specified for a peripheral on the Avalon bus, thefollowing restrictions apply to other bus transfer modes. Theserestrictions apply only to this slave port, not to other peripheralsconnected to the Avalon bus module.

    If a peripheral is capable of both read and write bus transfers, and setuptime is specified, then the same setup time is applied to both read andwrite transfers. Setup time cannot be used if the slave port usesperipheral-controlled wait states.

    Slave Write Transfers on the Avalon Bus

    In the discussions of write transfers below, it is important to realize thatunder realistic circumstances, bus transfers are not isolated events. Forexample, a write transfer may immediately precede or follow an unrelatedread transfer. During the write bus transfer, the target peripheral schipselect and write_n signals are necessarily asserted, as shown inthe timing diagrams. However, after the write transfer terminates,chipselect and write_n may remain asserted if another transfer withthis slave port follows on the next bus cycle. Therefore, the timingdiagrams below show unknown values on the slave port signals beforeand after the write transfer.

    Fundamental Slave Write Transfer

    The fundamental slave write transfer is the basis for all Avalon writetransfers. All other slave write transfer modes use a superset of thefundamental signals, and implements a variation of the fundamentaltiming. The fundamental slave write transfer is initiated by the Avalon

    bus module, and transfers one unit of data from the Avalon bus moduleto the slave port. Fundamental slave write transfers have no latency.

    Example 6 shows the fundamental slave write transfer. There are zerowait states, and no setup-time or hold-time wait states. The Avalon busmodule presents address , writedata , be_n , and write_n , and thenasserts chipselect . The slave port captures the address, data andcontrol on the next rising clock edge, and the write transfer terminatesimmediately. The entire transfer takes only one bus cycle. The slaveperipheral may then take additional clock cycles to actually process thewrite data after the transfer terminates. If the peripheral cannot sustainconsecutive write transfers on every bus cycle, then additional designconsiderations are required to generate wait states.

  • 8/8/2019 Avalon Bus Spec

    35/86

    Altera Corporation 35

    $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO $YDORQ %XV 6SHFLILFDWLRQ

    Figure 6. Fundamental Slave Write Transfer

    ([DPSOH 7LPH 5HIHUHQFH 'HVFULSWLRQ

    $ :ULWH WUDQVIHU VWDUWV RQ WKH ULVLQJ HGJH RIclk% 5HJLVWHUHG writedata address be_n DQG write_n VLJQDOV IURP WKH $YDORQ EXV

    PRGXOH DUH YDOLG& $YDORQ EXV PRGXOH GHFRGHVaddress DQG DVVHUWV YDOLGchipselect WR VODYH' $YDORQ EXV PRGXOH FDSWXUHV writedata address write_n EHBQ DQGchipselect

    RQ WKH ULVLQJ HGJH RIclk DQG WKH WUDQVIHU WHUPLQDWHV $QRWKHU UHDG RU ZULWH WUIROORZ RQ WKH QH[W EXV F\FOH

    This Example Demonstrates Relevant PTF Parameters

    $ VLQJOH ZULWH WUDQVIHU WR D V\QFKURQRXV SHULSKHUDO

    1R IL[HG ZDLW VWDWH :ULWHB:DLWB6WDWHV

    1R VHWXS WLPH 6HWXSB7LPH

    1R KROG WLPH +ROGB7LPH

    3 H U L S K H U D O

    3 H U L S K H U D O

    FON

    DGGUHVV EHBQ

    6 O D Y H 3 R U W

    0 D V W H U 3 R U W

    $ Y D O R Q % X V

    0 R G X O H

    &RQWURO

    'DWD

    $GGUHVV ZULWHBQ

    FKLSVHOHFW

    ZULWHGDWD ZDLW

    UHTXHVW

    FON

    DGGUHVV EHBQ

    ZULWHGDWD

    ZULWHQ

    FKLSVHOHFW

    DGGUHVV EHBQ

    ZULWHGDWD

    $ % & '

  • 8/8/2019 Avalon Bus Spec

    36/86

    36 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    The fundamental write transfer is only appropriate for synchronousperipherals, which includes many on-chip peripherals, such as PIOs andtimers for the Nios processor. The timing for a fundamental writetransfer is not appropriate for asynchronous peripherals, because alloutput signals including write_n and chipselect are all deasserted atthe same time. This would cause a race condition in, for example, an off-chip asynchronous memory. For such a memory, the Avalon bus moduleprovides several hold time options, which are discussed in subsequentsections.

    The byte enable lines be_n may be connected to the peripheral s slaveport, and may be used to write a specific byte lane when writedata iswider than one byte wide. be_n is a bus with one bit for every byte lanein writedata . be_n is usually necessary for slave write transfers to off-chip, 16-bit or 32-bit memory devices that are word addressable. Whenwriting a single byte of data, address specifies only an appropriate wordor half-word address, while be_n specifies exactly which byte(s) to write.Some example cases of be_n are specified below in Table 3 , assuming theslave port is a 32-bit external memory.

    When chipselect is deasserted, all slave port input signals should beignored. The slave port s outputs may be driven or left undefined whenthe slave port is not selected. Note that the chipselect signal from theAvalon bus module may be combinatorial, and therefore may glitch,

    based on transitions on the address port. Furthermore, a low-to-highedge on chipselect or a high-to-low edge on write_n cannot be usedas a start write transfer trigger, because such an edge is not guaranteed to

    be clean. If this is not taken into consideration, the slave port will interpreterroneous write operations into unknown locations specified by anundefined address .

    Table 3. Byte Enable Usage

    be_n[3:0] Write action

    :ULWH IXOO ELWV

    :ULWH ORZHU E\WHV

    :ULWH XSSHU E\WHV

    :ULWH E\WH RQO\

    :ULWH E\WH RQO\

  • 8/8/2019 Avalon Bus Spec

    37/86

    Altera Corporation 37

    $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO $YDORQ %XV 6SHFLILFDWLRQ

    Slave Write Transfer with Fixed Wait States

    The ports used for a write transfer with fixed wait states are identical tothose used for a fundamental write transfer. The only difference is in thetiming of signals. For example, with one fixed wait state specified, theAvalon bus module waits for one additional clock cycle before deassertingthe address, data and control signals. Wait states are specified bydeclarations made in the PTF file. They are fixed because the Avalon busmodule inserts the same number of wait states for every bus transfer.

    Write transfers with wait states are typically used for peripherals thatcannot capture data from the Avalon bus module in a single bus cycle. Inthis transfer mode, the Avalon bus module presents address ,

    writedata , be_n, write_n and chipselect during the first bus cycle,exactly like the start of a fundamental write transfer. During the wait

    states, these signals are held constant. The slave port eventually capturesdata from the Avalon bus module within the fixed number or wait states.The transfer then terminates, and the Avalon bus module deasserts allsignals at the same time.

    Example 7 shows an example of a slave write transfer with one wait state.

    Example 7. Slave Write Transfer with One Fixed Wait State

    This Example Demonstrates: Relevant PTF Parameters

    :ULWH WUDQVIHU ZLWK ZDLW VWDWHV WR D V\QFKURQRXV VODYH SHULSKHUDO

    2QH IL[HG ZDLW VWDWH :ULWHB:DLWB6WDWHV

    1R VHWXS WLPH 6HWXSB7LPH 1R KROG WLPH +ROGB7LPH

    3 H U L S K H U D O

    3 H U L S K H U D O

    FON

    DGGUHVV EHBQ

    6 O D Y H 3 R U W

    0 D V W H U 3 R U W

    $ Y D O R Q % X V

    0 R G X O H

    &RQWURO

    'DWD

    $GGUHVV ZULWHBQ

    FKLSVHOHFW

    ZULWHGDWD ZDLW

    UHTXHVW

  • 8/8/2019 Avalon Bus Spec

    38/86

    38 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    ([DPSOH 7LPH 5HIHUHQFH 'HVFULSWLRQ

    $ :ULWH WUDQVIHU F\FOH VWDUWV RQ WKH ULVLQJ HGJH RIclk% 5HJLVWHUHG writedata address be_n DQG write_n VLJQDOV IURP $YDORQ EXV

    PRGXOH DUH YDOLG& $YDORQ EXV PRGXOH GHFRGHVaddress DQG DVVHUWV YDOLGchipselect WR VODYH' )LUVW DQG RQO\ ZDLW VWDWH EXV F\FOH HQGV DW WKH ULVLQJ HGJH RIclk $OO VLJQDOV IURP $YDORQ

    EXV PRGXOH UHPDLQ FRQVWDQW( 3HULSKHUDO FDSWXUHV writedata address be_n write_n DQGchipselect RQ RU

    EHIRUH WKH ULVLQJ HGJH RIclk DQG WKH ZULWH WUDQVIHU WHUPLQDWHV

    Slave Write Transfer with Peripheral-Controlled Wait States

    Peripheral-controlled wait states allow a target peripheral to stall theAvalon bus module for as many bus cycles as required to capture

    writedata . This feature is useful for peripherals that may require anindefinite number of bus cycles to capture the write data, depending onconditions that vary from transfer to transfer.

    The peripheral-controlled wait state mode uses the waitrequest signal,which is an output from the slave port. The Avalon bus module presentsaddress , writedata , be_n , write_n and chipselect during thefirst bus cycle, exactly like the start of a fundamental write transfer. If theslave port needs extra time to capture the data, then it must assert

    waitrequest before the next rising clock edge. When asserted, waitrequest stalls the Avalon bus module, and forces it to hold

    address , writedata , be_n , write_n and chipselect constant. Afterthe slave deasserts waitrequest , the bus transfer terminates on the nextrising clock edge.

    The Avalon bus module does not have a time-out feature to limit howlong the slave peripheral can stall. When the Avalon bus module is stalled,somewhere in the System Module there is a master peripheral that is

    stalled as well, waiting for the slave port to capture the write data. A slaveperipheral could permanently hang a master peripheral. Therefore, theperipheral designer must ensure that a slave port does not assert

    waitrequest indefinitely.

    FON

    DGGUHVV EHBQ

    ZULWHGDWD

    ZULWHQ

    FKLSVHOHFW

    DGUHVV EHBQ

    ZULWHGDWD

    % & ' ( $

  • 8/8/2019 Avalon Bus Spec

    39/86

  • 8/8/2019 Avalon Bus Spec

    40/86

    40 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    When peripheral-controlled wait states are specified, the followingrestrictions apply to other bus transfer modes. These restrictions applyonly to this slave port, not to other slave ports connected to the Avalon busmodule.

    If peripheral-controlled wait states are specified, setup and hold waitstates cannot be used. In almost all cases, a peripheral that can generatethe waitrequest signal will be on-chip and synchronous that causessetup and hold time considerations unnecessary.

    Slave Write Transfer with Setup and Hold Time

    The Avalon bus module automatically accommodates setup and holdtime requirements for each slave port, based on declarations made in thePTF file. The master peripheral that initiates the write transfer does notneed to consider the setup and hold requirements of each slave port. Theports used for a write transfer with setup and hold time are identical tothose used for a fundamental write transfer. The difference is in the timingof signals only.

    Setup and hold time are generally used for off-chip peripherals thatrequire address , be_n , writedata , and chipselect to remain stablefor some amount of time before and/or after the write_n pulse. Anonzero setup time of M means that, after address , be_n, writedata and chipselect signals are presented to the slave peripheral, there is adelay of M bus cycles before write_n is asserted. Likewise, a nonzerohold time of N means that, after write_n is deasserted, address , be_n,

    writedata and chipselect remain constant for N more bus cycles.Note that chipselect is not affected by the setup or hold time. If theperipheral requires a setup or hold time for both write_n andchipselect , then the designer must manually add the appropriate logic(one AND gate) to the slave port interface.

    The total number of bus cycles to complete the bus transfer depends onsetup, wait-state and hold bus cycles. For example, a peripheral withSetup_Time = 2 and Write_Wait_States = 3 and Hold_Time = 2 willtake 8 bus cycles to complete the transfer:

    I 2 setup bus cycles plus;I 3 wait-state bus cycles plus;I 2 hold bus cycles plus;I 1 bus cycle to capture data.

    A slave port does not have to use both setup and hold time at the sametime; transfers with only setup or only hold time are acceptable. Example 9 shows a write transfer with both a setup and a hold timerequirement.

  • 8/8/2019 Avalon Bus Spec

    41/86

    Altera Corporation 41

    $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO $YDORQ %XV 6SHFLILFDWLRQ

    Figure 9. Slave Write Transfer with Setup and Hold Times

    ([DPSOH 7LPH 5HIHUHQFH 'HVFULSWLRQ

    $ )LUVW EXV F\FOH VWDUWV RQ WKH ULVLQJ HGJH RIclk% 5HJLVWHUHG RXWSXWVaddress EHBQ DQG writedata VLJQDOV IURP $YDORQ EXV PRGXOH DUH

    YDOLG write_n UHPDLQV GHDVVHUWHG& $YDORQ EXV PRGXOH GHFRGHVaddress WKHQ DVVHUWVchipselect' 5LVLQJ HGJH RIclk PDUNV WKH HQG RI WKH VHWXS EXV F\FOH( $YDORQ EXV PRGXOH DVVHUWV write_n) $YDORQ EXV PRGXOH GHDVVHUWV write_n DIWHU WKH QH[W ULVLQJ HGJH RIclk address,

    be_n writedata DQGchipselect UHPDLQ FRQVWDQW DV WKH KROG WLPH EXV F\FOH EHJL* $YDORQ EXV PRGXOH GHDVVHUWVaddress be_n writedata DQGchipselect RQ WKH

    QH[W ULVLQJ HGJH RIclk DQG WKH ZULWH WUDQVIHU WHUPLQDWHV

    This Example Demonstrates: Relevant PTF Parameters:

    ZULWH WUDQVIHU WR V\QFKURQRXV SHULSKHUDO

    1R IL[HG ZDLW VWDWH :ULWHB:DLWB6WDWHV

    EXV F\FOH RI VHWXS WLPH 6HWXSB7LPH

    EXV F\FOH RI KROG WLPH +ROGB7LPH

    3 H U L S K H U D

    O

    3 H U L S K H U D O

    FON

    DGGUHVV EHBQ

    6 O D Y H 3 R U W

    0 D V W H U 3 R U W

    $ Y D O R Q % X V

    0 R G X O H

    &RQWURO

    'DWD

    $GGUHVV ZULWHBQ

    FKLSVHOHFW

    ZULWHGDWD ZDLW

    UHTXHVW

    FON

    DGGUHVV EHBQ

    ZULWHGDWD ZULWHBQ

    FKLSVHOHFW

    DGGUHVV EHBQ

    ZULWHGDWD

    % & ' ( ) $ *

  • 8/8/2019 Avalon Bus Spec

    42/86

    42 Altera Corporation

    $YDORQ %XV 6SHFLILFDWLRQ $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO

    When setup and/or hold time is specified for a slave port on the Avalon bus, the following restrictions apply to other bus transfer modes. Theserestrictions apply only to this slave port, not to other peripheralsconnected to the Avalon bus module.

    If a setup time is specified for a slave peripheral, then the same setup timeis applied to both read transfers and write transfers. Setup and hold timecannot be used if the slave port uses peripheral-controlled wait states.

    Avalon MasterTransfers

    The following sections discuss bus transfers between a master port andthe Avalon bus. From an abstract, system-level viewpoint, masterperipherals exchange data with slave peripherals. However, from theviewpoint of a master peripheral, data is transferred between theperipheral s master port and the Avalon bus module only. If the masterperipheral does notaccess a defined address in an existing slave peripheralwith a slave port connected to the Avalon bus module, an undefined

    behavior will result. However, the existence of the slave peripheral doesnot affect the master port interface to the Avalon bus module. It is theAvalon bus module that accepts a transfer from the master port. TheAvalon bus module not the master port then initiates a slave transferwith the appropriate slave port, and terminates the slave transfer.Therefore, in the following discussions the interface between the masterport and the Avalon bus module is the exclusive focus of our discussion.

    Compared to the numerous Avalon slave transfer modes, master transfermodes are few and simple. The following discussions assume that theAvalon master peripheral is a synchronous, on-chip module, which isalmost always true for Avalon master peripherals. This eliminates theneed to consider the myriad requirements of interfacing to off-chip

    devices. In the event that the master peripheral must reside off-chip--especially in the case that the master address and/or data lines share a tri-state bus--an on-chip bridge module is required to relay the off-chipmaster s signals to an on-chip Avalon master port.

    There is essentially one golden rule of master transactions: Assert allsignals to initiate the bus transfer, and then wait until the Avalon busmodule deasserts waitrequest . With this one rule and the fundamentalslave read and write transfers in mind, the master port interface is readilyunderstood.

  • 8/8/2019 Avalon Bus Spec

    43/86

    Altera Corporation 43

    $YDORQ %XV 6SHFLILFDWLRQ 5HIHUHQFH 0DQXDO $YDORQ %XV 6SHFLILFDWLRQ

    It is important to realize that under realistic circumstances, bus transfersare not isolated events. They typically happen in continuous succession.For example, a master port may initiate a read transfer from a slave portimmediately before or after a write transfer to an unrelated peripheral.During the read bus transfer, the master port s read enable signal isnecessarily asserted. However, after the read transfer terminates, the readenable may remain asserted if another read transfer will be initiated on thenext bus cycle.

    Avalon Signals for Master Transfers

    Table 4 below lists the signal names that interface a peripheral s masterport to the Avalon bus module and gives a brief description of which portsare required and under what circumstances. Not all of the signals listed inTable 4 will be present on all peripherals, depending on the peripheraldesign and the ports declared in the peripheral s PTF file.

    Table 4. Avalon Master Port Signals

    Signal Type Width Direction Required Description

    clk LQ \HV *OREDO FORFN VLJQDO IRU WKH V\VWHP PRGXOH DQG $YDORQ EXV PRGXOH $OO EXV WUDQVDFWLRQV DUHV\QFKURQRXV WRclk

    reset LQ QR *OREDO UHVHW VLJQDO ,PSOHPHQWDWLRQ LV SHULSKHUDVSHFLILF

    address RXW \HV $GGUHVV OLQHV IURP WKH $YDORQ EXV PRGXOHaddress LV E\WH DGGUHVVDEOH

    byteenable RXW QR %\WH HQDEOH VLJQDOV WR HQDEOH VSHFLILF E\WH ODQGXULQJ WUDQVIHUV WR PHPRULHV RI ZLGWK JUHDWHU WKDQ

    ELWV ,PSOHPHQWDWLRQ LV SHULSKHUDO VSHFLILF

    read RXW QR 5HDG UHTXHVW VLJQDO IURP PDVWHU SRUW 1RWUHTXLUHG LI PDVWHU QHYHU SHUIRUPV UHDG WUDQVIHUVXVHGreaddata PXVW DOVR EH XVHG

    readdata LQ QR 'DWD OLQHV WR WKH $YDORQ EXV PRGXOH IRU UHDGWUDQVIHUV 1RW UHTXLUHG LI WKH PDVWHU QHYHUSHUIRUPV UHDG WUDQVIHUV ,I XVHGread PXVW DOVREH XVHG

    write RXW QR :ULWH UHTXHVW VLJQDO IURP PDVWHU SRUW 1RWUHTXLUHG LI WKH PDVWHU QHYHU SHUIRUPV ZULWHWUDQV