AMBA Specification
In this chapter, we introduce an on-chip communication standard, called
Advanced Microcontroller Bus Architecture (AMBA) [15] . AMBA specification
defines three distinct bus architectures. Advanced high-performance bus (AHB) and
advanced-system bus (ASB) are both for high clock frequency module. But ASB is
hardly used in peripheral module in popular SOC system recently. The last bus
architecture is advanced peripheral bus (APB), which is mainly used for low-power
peripheral modules. Section 2.1 talks about the usage and functionalities of three
distinct bus architectures. The signal declaration and all kinds of transfer type are
discussed in section 2.2. The last section of this chapter shows the architecture of
AHB component, including master wrapper, slave wrapper and direct-memoryaccess (DMA) controller.
is usually used for interfacing peripheral devices with low bandwidth and do not
require high performance like pipeline architecture.
Table 1 shows the features that each bus architecture support. We choose AHB
as our system bus. All the IP integrated in this system must be AHB-compliant.
AHB data transfer will be detailed in next section.
AHB
ASB
APB
High performance
High performance
Low power
Pipelined operation
Pipelined operation
Simple interface
Burst transfers
Burst transfer
Split transactions
Wider data bus configuration
(64 and 128 bit)
Table 1. AMBA Features
10
High-performance
ARM Processor
High-bandwidth
On-chip RAM
Uart
Expansion Memory
Interface
AHB or ASB
Bridge
AHB to APB Bridge
or
ASB to APB Bridge
DMA
Timer
APB
KeyPad
PIO
The bridge locates between system bus and peripheral bus. While transferring
data from processor to peripheral devices like UART, timer, peripheral I/O and
keyboard, the bridge convert the transferred signals from one type to another for
satisfying different performance and protocol.
Arbiter
HADDR
HWDATA
HADDR
HWDATA
Master #1
HRDATA
Address and
Control Mux
HRDATA
Slave #1
HADDR
HWDATA
HADDR
Master #2
HRDATA
HWDATA
HRDATA
Slave #2
HADDR
HWDATA
HRDATA
Slave #3
Decoder
12
Name
Width
Source
Destination
Description
HCLK
Global
All devices
HRESETn
Global
All devices
HBUSREQx
Masters
Arbiter
AHB supports at most 16 masters on a bus. There are at most 16 bus request lines in the system.
Arbiter will sample these requests to determine which master would be granted.
HLOCKx
Masters
Arbiter
There are 16 signal lines came from 16 masters in AHB. If the signal is high, it means that this
transfer should lock bus until transfer complete.
HADDR
32
Masters
HTRANS
Master
Slave
AHB master transfer type, which can be IDLE, BUSY, NONSEQ or SEQ. This signal comes from
the granted master.
HBURST
Master
Slave
This signal comes from the granted master. It indicates the type of burst transfer like SINGLE,
INCR, and WRAP.
HRESP
Slave
Master
This signal which comes from the selected slave can be OKAY, ERROR, RETRY or SPLIT.
HREADY
Slave
Master
This signal comes from the selected slave. When HREADY is equal to HIGH, it indicates that the
transfer has finished on the bus. Otherwise, it means the transfer should be extended or the
ERROR, RETRY and SPLIT may happen.
HGRANTx
Arbiter
Master
These signals would connect to each relative master. When one of the HGRANT signal is HIGH, it
means that one of master has the bus ownership and the master can perform the transfer operation.
HMASTER
Arbiter
Split-capable slave
This signal would show which master is granted on the bus. When a slave starts to do SPLIT
transaction, the slave needs to record the split master by storing this signal.
HMASTLOCK
Arbiter
Split-capable slave
This signal shows that which master is granted for doing lock transfer. If the transaction are lock
transfer, the slave could not do SPLIT transaction.
HSELx
Decoder
Slaves
This signal would connect to each slave. When this signal to one slave is HIGH, it means that the
slave has been selected.
Table 2. AHB Signal List
13
Address phase
Data phase
HCLK
HADDR[31:0
Control
Control
Data A
HWDATA[31:0
HREADY
Data A
HRDATA[31:0]
Slave device can insert wait cycles into transfer to have more time for
preparing valid data. When performing read operation, the slave device de-asserts
the HREADY signal until the read data is valid. When performing write operation,
the master device holds write data until the slave device asserts HREADY signal.
Figure 8 illustrates the waveform of basic transfer with wait cycle.
Address phase
Wait cycle
Data phase
HCLK
HADDR[31:0
Control
Control A
Data A
HWDATA[31:0
HREADY
Data A
HRDATA[31:0]
14
AHB can support pipeline operation. The data phase of first transfer and the
address phase of second transfer can overlap to get better performance. The
waveform is illustrated in Figure 9. Transfer A and transfer C have no wait cycles,
but transfer B has one. The wait cycle extends the data phase of transfer B and the
master device holds the control signals of transfer C one more clock cycle.
HCLK
HADDR[31:0
Control
HWDATA[31:0
Control A
Control B
Control C
Data B
Data A
Data C
HREADY
HRDATA[31:0]
Data A
Data B
Data C
Burst transfer is sequential transfer. Before we talk about the burst transfer, we
must detail the transfer type encoding signal, HTRANS first. There are four
different types of HTRANS includes IDLE, BUSY, NONSEQ (non-sequential), and
SEQ (sequential).
IDLE indicates that no data transfer is required. In this state, its not going to
perform any data transfer. BUSY allows the master device inserting idle cycles
during burst transfer. This transfer type indicates that the master device wants to
continue the burst transfer, but the next transfer cant take place immediately. The
address and control signals be held during BUSY transfer type.
15
NONSEQ indicates the first transfer of burst transfer or just a single transfer.
The address and control signals in this transfer type are not related to the previous
transfer. The followed transfer type in burst transfer is SEQ and the address and
control signals are related to the previous transfer. For incremental burst, the
followed address is equal to the address of the previous transfer plus the size of
transfer in byte. For wrapping burst, the address of the transfer wraps at the address
boundary equal to the size in bytes multiplied by the number of beats in the transfer.
Burst transfer must not exceed a 1KByte address boundary. Therefore it is
important that master device does not attempt to perform incremental or wrapping
burst transfer which crosses the address boundary. An incremental burst transfer can
be any length, but under the 1KByte address boundary constraint. Figure 10 shows
the waveform of burst transfer.
HCLK
HTRANS[1:0]
NONSEQ
BUSY
SEQ
SEQ
SEQ
HADDR[31:0]
0x20
0x24
0x24
0x28
0x2C
INCR
HBURST[2:0]
HWDATA[31:0
Data
0x20
Data
0x24
Data A
Data
0x24
Data
0x28
Data
0x2C
HREADY
HRDATA[31:0]
Data
0x2C
Data
0x2C
16
Select
RESET
HRESETn
HSELx
HADDR
Address HWRITE
HREADY
AHB
and HTRANS
HRESP
Slave
Device
Control HSIZE
Transfer
Response
HBURST
Data
HWDATA
HRDATA
HMASTER
HMASTLOCK
Split-capable
Slave
Data
HSPLITx
Lets consider the finite state machine of AHB slave device. It starts from idle
state. If the device is chosen, the state can move to address state then data state. The
two states map to the address phase and data phase of the transfer on AHB. We can
also define the error condition that leads the state to error state. In error state, the
response signal will be set to ERROR, RETRY, or SPLIT. Retry and split state
handle these two different conditions. Figure 12 illustrates the FSM of AHB slave
device. Wait state is to handle the wait cycle insertion.
17
IDLE
ADDRESS
DATA
WAIT
SPLIT
RETRY
ERROR
CLOCK
HCLK
RESET
HRESETn
Arbiter HGRANT
HBUSREQ
HLOCKx
Transfer
HREADY
Response HRESP
Data
HRDATA
HTRANS
AHB
Master
Device
HADDR
HWRITE
HPRONT
HSIZE
HBURST
HWDATA
18
Arbiter
Transfer type
Address
and
Control
Data
The FSM of AHB master device also starts from the IDLE state. When the
master device attempts to perform data transfer, BUSREQ is asserted to arbiter for
bus ownership. After granting the bus, the master device can perform single or burst
transfer. The behavior maps to the NONSEQ and SEQ states. The device can also
insert wait cycles during transfer. It map to BUSY state. WAIT state reflects the
wait cycles inserted by slave device. Figure 14 illustrates the FSM of AHB master
device.
BUSY
IDLE
BUSREQ
NONSEQ
ERROR
SEQ
WAIT
19
perform data transfer from source address to destination address. The mechanism is
memory-mapped I/O. Table 3 lists the memory-mapped register description. Figure
15 shows the architecture of DMA controller.
Address offset
Name
Type Width
Description
0x00 [0]
DMA_Enable
r/w
0x00 [10:1]
DMA_Beat_Count
r/w
10
0x04
DMA_Source
r/w
32
0x08
DMA_Destination
r/w
32
0x0C
DMA_Interrupt_Mask
r/w
20
3. The DMA controller starts to transfer data from source to destination address.
The performance is related to the number of buffer in controller.
4. If the transfer is complete, the DMA controller asserts the interrupt signal to
interrupt controller. Processor uses the DMA_Interrupt_Mask register to
disable the interrupt signal and then run interrupt subroutine.
Response
Register
Interface
File
FIFO Buffer
Master
Interface
Central Controller
of DMA
21