AMBA – 3 AXI overview

AXI(Advanced eXtensible Interface)는 high performance, high frequency system에서 사용하는 bus로, APB나 AHB와 달리 write channel과 read channel이 분리되어 있다는 특징이 있습니다.

AXI Architecture

AXI bus는 다섯개의 독립적인 channel을 기반으로 동작합니다.

  • Write request, which has signal names beginning with AW
  • Write data, which has signal names beginning with W
  • Write response, which has signal names beginning with B
  • Read request, which has signal names beginning with AR
  • Read data, which has signal names beginning with R
글 설명 이미지, AXI channel
Bus channel

위의 다섯 channel에는 각각 data signal과 valid, ready signal이 있으며 양방향 handshake mechanism을 지원합니다.

AXI의 data width는 8, 16, 32, 64, 128, 256, 512, 그리고 1024-bit까지 지원합니다. Slave는 Master가 보내는 모든 write transaction마다 response를 보내어 해당 transaction을 완료합니다. Write channel과 달리, read channel은 data가 response이므로 read response가 필요 없습니다.

Multi-master system을 지원하며, master와 slave가 대부분 interconnect를 통해 연결됩니다.

Block diagram
Block diagram

Signals

APB, AHB 보다 더 성능이 좋은 bus여서 그러지, signal이 정말 많습니다;;;

Write channel signals

Write request channel signals
Write request channel signals

Write request channel signals는 master가 write transaction에 필요한 address와 control 정보를 전달하며, ‘AW’로 시작합니다.

Write data channel signals
Write data channel signals

Write data channel signals도 master가 보내는 signal이며 data와 control 정보를 포함하고, ‘W’로 시작합니다.

Write response channel signals
Write response channel signals

Write response channel signals는 slave가 보내는 response signal이며, ‘B’로 시작합니다.

Read channel signals

 Read request channel signals
Read request channel signals

Read request channel signals는 master가 read transaction에 필요한 address와 control 정보를 전달하며, ‘AR’로 시작합니다.

Read data channel signals
Read data channel signals

Read data channel signals는 slave가 보내는 read data와 response signal이며, ‘R’로 시작합니다.

Reset 상태일 때 master는 ARVALID, AWVALID, WVALID를 low로 유지하고 slave는 RVALID, BVALID를 low로 유지해야 합니다.

AXI transport

Clock and Reset

AXI signal 중 입력 signal과 출력 signal 사이에 combinational path가 있으면 안 됩니다. 즉, 입력 signal이 출력 signal에 영향을 주려면 적어도 1 ACLK의 delay가 필요합니다.

Reset은 clock에 asynchronous 하게 assert 할 수 있지만 deassertion은 clock과 synchronous 하게 작동해야 합니다. VALID는 reset이 풀리기 전에는 low여야 하며, reset이 풀린 뒤 VALID high가 될 수 있는 timing은 아래와 같습니다.

Exit from reset
Exit from reset

Channel handshake

Handshake
Handshake

Write/Read transaction 둘 다 VALID와 READY signal이 모두 high일 때 이루어집니다. Data source에서 data와 함께 valid high를 destination으로 보내면 destination에서 ready high를 보내야 transfer가 완료됩니다. VALID, READY의 assert 순서는 상관없습니다. 하지만 VALID가 assert 되기 전에 READY가 미리 assert 되어 있는 것이 performance 관점에서 더 좋습니다.

Handshake dependencies
Handshake dependencies

Write transaction

  • AWREADY: AWVALID, WVALID 보다 먼저 assert 될 수 있음
  • WREADY: AWVALID, WVALID 보다 먼저 assert 될 수 있음
  • BVALID: WVALID, WREADY 보다 먼저 assert 될 수 없음
  • BREADY: BVALID 보다 먼저 assert 될 수 있음

Read transaction

  • ARREADY: ARVALID 보다 먼저 assert 될 수 있음
  • RVALID: ARVALID, ARREAD 보다 먼저 assert 될 수 없음
  • RREADY: RVALID 보다 먼저 assert 될 수 있음

AXI4에서는 write transaction일 때 handshake dependency에 변화가 있습니다.

AXI4 write transaction handshake dependency
AXI4 write transaction handshake dependency

그러면 본격적으로 transaction 예시를 보면서 이해해 볼까요?

Read transfer

Read burst
Read burst

위 예시는 4 read transfer 예시입니다. 첫 번째 transfer 과정만 살펴보겠습니다.

  • T0 ~ T1: Master가 A라는 address와 address valid signal을 보냄
  • T1 ~ T2: Slave가 해당 주소의 read transaction을 할 준비가 됨을 알림 (ARREADY)
  • T3 ~ T5: Master가 read data를 받을 준비가 됨 (RREADY)
  • T5 ~ T6: Slave가 read data와 data valid signal을 보냄, RVALID와 RREADY 모두 high일 때 transaction 발생

여러 주소의 read transfer를 한 번에 진행할 수 있습니다.

Overlapping read bursts
Overlapping read bursts

AXI protocol은 Address phase와 Data phase가 중첩되어 진행되는 AHB protocol과 달리 transaction을 진행할 address를 미리 전송하고 data를 read 합니다. Slave는 각 address에 대한 data transaction이 끝나면 RLAST signal을 통해 Master에 address transaction 종료를 알립니다.

Write transfer

Write burst
Write burst

Write transfer에서는 master가 각 주소에 대한 마지막 transaction을 WLAST를 통해 slave에 알립니다. Write channel에는 response signal도 있어서 slave가 모든 data를 받은 뒤 BVALID, BREADY가 모두 high일 때 transaction에 대한 response를 나타내며 통신을 마무리합니다.

Addressing options

AXI protocol은 burst 기반이기 때문에 이를 control 하는 option이 있습니다.

Burst size, AXSIZE[2:0]

Burst size는 burst transfer 내에서 전송할 최대 byte를 정의합니다.

Burst size encoding
Burst size encoding

Burst length, AXLEN

Burst length는 해당 transfer에서 전달되는 data 수를 정의합니다. Size x Length가 transaction에서 전송할 수 있는 최대 byte이며, address가 unaligned 되거나 write strobe가 모두 high가 아니라면 실제 전송 byte는 줄어듭니다.

주의할 점은 AXI version에 따라 AXLEN width가 달라집니다.

AXI3: AXLEN[3:0]

AXI4: AXLEN[7:0]

AXLEN[7:0]
AXLEN[7:0]
  • Wrapping bursts, Length -> 2, 4, 8, 16
  • Fixed bursts, Length ≤ 16
  • 4KB address 이상 transaction 불가
  • Transaction 중간에 중단 불가

아래는 Size = 3’b10, Length = 8’h3인 burst 예시입니다.

Burst 예시
Burst 예시

Burst type, AXBURST[1:0]

Burst type는 transaction에서 address가 증가하는 방법을 정의합니다.

AxBURST encodings
AxBURST encodings

Fixed burst

  • 동일한 주소에 access 할 때 사용 (FIFO)
  • Byte lane은 모두 일정하지만, write strobe로 control 가능
  • Length of the burst ≤ 16

Incrementing burst (INCR)

Address가 이전 transaction address에서 일정하게 증가, normal sequential memory를 access 할 때 사용

Wrapping burst (WRAP)

INCR와 비슷하지만, address가 limit에 다다르면 wrapping 됩니다.

  • Length of the burst: 2, 4, 8, 16
  • Lowest address: Size * Length
  • Limit address: (wrap boundary)+ (Size * Length)
WRAP 주소 계산 방법
WRAP 주소 계산 방법

Atomic access

AxLOCK[1:0] signal을 통해 Normal, Exclusive, Locked access를 선택할 수 있습니다.

Atomic access encoding
Atomic access encoding

Exclusive access는 특정 master가 bus를 독점적으로 access를 시도할 때 사용합니다. 특정 master가 transaction이 끝날 때까지 다른 master가 bus를 사용할 수 없도록 막는 Locked access와 달리 해당 transaction이 끝날 때까지 다른 master의 개입이 있는지 없는지만 확인합니다. 다른 master의 개입은 slave response인 RRESP[1:0], BRESP[1:0] signal 통해 확인하며, 그렇기 때문에 Locked access 대비 system performance를 떨어뜨리지 않는다는 장점이 있습니다.

참고로, Exclusive access 중이어도 다른 Master가 read access 해도 됩니다.

Exclusive access process
Exclusive access process
  • Exclusive write의 size, length는 앞선 read의 것과 동일해야 함.
  • Exclusive read, write의 address, control signal은 같아야 함.
  • Exclusive access 주소는 align 되어야 함.
  • Exclusive access burst data: 1, 2, 4, 8, 16, 32, 64, or 128 bytes
Locked access
Locked access

다른 master의 access를 아예 제한하는 locked access는 성능을 저하한다는 특징이 있어 AXI4 이후로는 지원하지 않습니다.

Transaction response

RESP encoding
RESP encoding

OKAY, normal access success

OKAY는 normal transfer success나 exclusive access fail, 또는 slave가 exclusive access를 지원하지 않을 때 나타나는 response입니다.

EXOKAY, exclusive access success

말 그대로 exclusive access success를 의미합니다.

SLVERR, slave error

SLVERR는 unsuccessful transaction를 의미합니다.

  • FIFO, buffer overrun or underrun
  • 지원되지 않는 transfer size 접근 시도
  • Read-only에 write 시도
  • Slave time-out
  • Disabled/powered-down 된 기능에 접근 시도

DECERR, decode error

잘못된 address에 접근할 때 발생합니다. 이럴 경우, 미리 설정된 default slave가 DECERR response를 내보냅니다.

DECERR from default slave
DECERR from default slave

Ordering model

AXI protocol에서는 transaction ID를 통해 multiple outstanding addresses와 out-of-order transaction이 가능합니다. 같은 ID인 transaction은 순서대로 진행되어야 하지만, ID가 다른 transaction은 제한 사항이 없기 때문에 out-of-order transaction이 가능합니다.

  • Transactions from different Managers
  • Read and write transactions
  • Transactions with different IDs
  • Transactions to different Peripheral regions
  • Transactions to different Memory locations
Channel transaction ID
Channel transaction ID

ID를 사용하면 이전 transaction이 끝나지 않아도 transaction을 생성할 수 있기 때문에 outstanding address를 처리할 수 없었던 AHB protocol과 달리, system performance를 개선할 수 있습니다.

Transfer with ID
Transfer with ID

여기서 WID는 AXI3에서만 지원한다고 하는데 왜 AXI4에서는 지원하지 않을까요?

대부분의 slave는 out of order로 데이터를 처리하는 것이 불가능하기 때문에 write transfer 할 때 WID로 out of order 기능을 사용하는 일이 거의 없습니다. 게다가 master 입장에서는 slave가 out of order 기능 지원 여부를 알 수 있는 방법도 없죠;;;; 그래서 굳이 사용하지 않는 signal을 남겨놓을 필요가 없는 겁니다.

Additional control

Cache support

AxCACHE signal을 통해 memory와 peripheral slave와의 transaction attribute를 control 합니다.

Transaction attribute encoding
Transaction attribute encoding
  • AxCACHE[0], Bufferable (B) bit

Transaction이 destination에 도달하기까지 몇 clock을 지연시킬 수 있습니다. 그렇기 때문에 일반적으로 write transfer일 때 사용합니다.

  • AxCACHE[1], Cacheable (C) bit

Write transfer의 경우, 여러 write transfer를 병합하여 transaction이 일어나게 만들 수 있습니다. Read transfer의 경우, 원하는 주소의 정보를 pre-fetch 하거나 single data를 여러 번 읽어올 수 있습니다.

이 bit가 0이면, allocate transaction이 불가합니다.

  • AxCACHE[2], Read-allocate (RA) bit

Read allocation transfer를 사용하지만, 필수는 아닙니다.

  • AxCACHE[3], Write-allocate (WA) bit

Write allocation transfer를 사용하지만, 필수는 아닙니다.

AxCACHE에 따라 Write-back/Write-through, Allocate 기능을 사용할 수 있습니다.

AxCACHE encoding
AxCACHE encoding

위의 기능은 cache의 주요 성능인 cache hit/miss 상황에 따라 분류됩니다.

Write-back/Write-through, Allocate
Write-back/Write-through, Allocate
  • Write-Back: cache write hit 상황에서 cache의 data만 수정합니다. Main memory에는 miss가 발생해서 data가 교체될 때 반영합니다. 이럴 경우, data consistency issue가 발생할 수 있습니다.
  • Write-Through: cache write hit 상황에서 cache, main memory 모두 data를 수정합니다.
  • Allocate: cache write miss 상황에서 main memory의 data를 cache에 복사하고 수정이 이루어집니다.
  • no-Allocate: cache write miss 상황에서 main memory의 data를 cache에 복사하지 않고 main memory의 data를 직접 수정합니다. 해당 data를 다시 쓰지 않을 것 같을 때의 방식입니다.

Protection unit support

복잡한 system에서 illegal transaction을 방지하기 위해 AxPROT signal을 통해 protected access를 지원합니다.

Protection encoding
Protection encoding

Privileged access: 시스템 내에서 더 높은 권한을 가짐, 이를 통해 특정 작업이 더 많은 자원에 access 가능

Secure access: 민감한 data에 안전하게 access

Low-power Interface

Low-power Interface는 특정 peripheral의 저전력 모드에 들어가게 만들어 energy consumption을 최적화할 수 있는 optional extension입니다.

Low-power Interface 방식
Low-power Interface 방식

Signals

  • CACTIVE: Peripheral에 clock이 필요함을 나타냄
  • CSYSREQ: Peripheral이 저전력 모드에 들어가도록 clock controller가 하는 요청
  • CSYSACK: Peripheral이 저전력 모드에 들어갔음을 알리는 signal
CSYSREQ and CSYSACK handshake
CSYSREQ and CSYSACK handshake

Peripheral은 low-power mode에 들어가라는 clock controller의 요청을 수락할 수도 있고 거부할 수도 있습니다.

Acceptance of a low-power request
Acceptance of a low-power request
  • T1: 저전력 모드 요청
  • T2: 저전력 모드 수락
  • T3: 저전력 상태 진입 완료
 Denial of a low-power request
Denial of a low-power request
  • T1: 저전력 모드 요청
  • T2: 저전력 모드 요청 거부 (CACTIVE HIGH 유지)
  • T3: Handshake 종료 요청
  • T4: Handshake 종료 수락

저전력 모드 종료는 peripheral, clock controller 둘 다 요청할 수 있습니다.

System clock controller initiated exit
System clock controller initiated exit
  • T1: Clock controller가 exit 요청
  • T2: Peripheral이 exit accept
  • T3: Peripheral이 exit 완료 알림
Peripheral initiated exit
Peripheral initiated exit
  • T1: Peripheral이 exit 요청
  • T2: Clock controller가 exit accept
  • T3: Peripheral이 exit 완료 알림

참고: ARM® AMBA 5 AXI Protocol Specification

Similar Posts