2012. 5. 24. 01:08

AMBA AXI PROTOCOL v1.0 - CHANNEL HANDSHAKE I

오늘은 CHANNEL HANDSHAKE에 대해서 공부하겠습니다.

 

이번 챕터에서는 핸드쉐이크의 개요와 READY/VALID 핸드쉐이크 시그널의 기본값에 대해서 알아보도록 하겠습니다.

 

3.1 HANDSHAKE PROCESS

지난 시간에 AMBA AXI PROTOCOL은 5개의 채널(READ ADDRESS CHANNEL, READ DATA CHANNEL, WRITE ADDRESS CHANNEL, WRITE DATA CHANNEL, WRITE RESPOSE CHANNEL)을 가지고 있다고 언급하였습니다.


5개 채널 모두 DATA나 CONTROL INFORMATION을 전송하기 위해 동일한 VALID/READY 핸드쉐이크 메커니즘을 사용합니다. 이것을 TWO-WAY 핸드쉐이크 메커니즘으로 부릅니다. TWO-WAY 핸드쉐이크 메커니즘은 마스터와 슬레이브 모두 DATA와 CONTROL INFORMATION의 전송율을 제어할 수 있도록 합니다.
스펙 원문에서보면 시그널을 전달하는 쪽을 SOURCE, 받는 쪽을 DESTINATION이라고 표현하고 있습니다만, 이것은 상황에 따라서 마스터나 슬레이브가 SOURCE가 될 수도 있고 반대로 DESTINATION이 될 수도 있습니다.
(1.3.3절 WRITE BURST EXAMPLE에서 AWVALID, AWREADY, BVALID, BREADY 시그널 참조)

 

SOURCE에서는 DATA나 CONTROL INFORMATION이 이용 가능할 때를 의미하는 VALID 시그널을 생성하고 DESTINATION에서는 DATA나 CONTROL INFORMATION을 수락 가능 여부를 나타내기 위한 READY 시그널을 생성합니다. 그래서 VALID와 READY 시그널이 모두 HIGH일 때에만 전송을 시작합니다. 이때 마스터와 슬레이브 인터페이스에서 INPUT과 OUTPUT 시그널 간에 조합된 경로가 없어야 합니다.

 

Figure 3-1 to Figure 3-3 show examples of the handshake sequence. In Figure 3-1, the source presents the data or control information and drives the VALID signal HIGH. The data or control information from the source remains stable until the destination drives the READY signal HIGH, indicating that it accepts the data or control information. The arrow shows when the transfer occurs.

 

In Figure 3-2, the destination drives READY HIGH before the data or control information is valid. This indicates that the destination can accept the data or control information in a single cycle as soon as it becomes valid. The arrow shows when the transfer occurs.

 

 

In Figure 3-3, both the source and destination happen to indicate in the same cycle that they can transfer the data or control information. In this case the transfer occurs immediately. The arrow shows when the transfer occurs.

 

위의 그림 3-1, 3-2, 3-3에서 HANDSHAKE SEQUENCE에 대한 예제를 보여주고 있는데, 간단합니다. 우선 첫 번째로 3-1을 보시면 SOURCE에서 DATA와 CONTROL INFORMATION을 보여주고 있고 VALID 시그널이 HIGH인 상황인데요. DESTINATION의 READY 시그널이 HIGH가 될 때까지 SOURCE로부터 전송하고 있는 DATA나 CONTROL INFORMATION 시그널은 계속 유지가 됩니다. 그러다가 DESTINATION에서 DATA나 CONTROL INFORMATION이 수락 가능한 상황 즉, READY가 HIGH가 될 때 다음 사이클의 RIGING EDGE에 샘플링(화살표)되고 전송이 이루어집니다. 3-2에서는 3-1과 반대로 DESTINATION에서 수락 가능한 상황이지만 SOURCE에서 준비가 되지 않은 상태를 유지하다가 마찬가지로 VALID가 HIGH되는 시점에 전송이 이루어지고, 3-3은 둘 다 지연없이 HIGH가 되어 곧 바로 전송이 되는 것을 보여주고 있습니다.

 

 

아래 내용은 각 채널에서 VALID/READY HANDSHAKE 메커니즘을 다룰 때, 준수해야 할 세부적인 규칙에 대한 설명입니다.

 

3.1.1 Write address channel
The master can assert the AWVALID signal only when it drives valid address and control information. It must remain asserted until the slave accepts the address and control information and asserts the associated AWREADY signal. The default value of AWREADY can be either HIGH or LOW. The recommended default value is HIGH, although if AWREADY is HIGH then the slave must be able to accept any valid address that is presented to it. A default AWREADY value of LOW is possible but not recommended, because it implies that the transfer takes at least two cycles, one to assert AWVALID and another to assert AWREADY.

 

각 채널마다 비슷한 내용으로 세부적인 부분을 다루고 있습니다만, WRITE ADDRESS CHANNEL 경우를 보면 마스터는 보낼 ADDRESS와 CONTROL INFORMATION이 존재할 때, AWVALID 시그널을 HIGH로 보낼 수 있고 슬레이브는 마스터가 보낸 ADDRESS와 CONTROL INFORMATION을 AWREADY 시그널이 수락할 때까지 ISSUING(계속 보내는 상태로 유지)합니다. AWREADY 시그널의 기본적인 값은 스펙 원문에 나온 것과 같이 HIGH나 LOW 값을 가질 수 있는데 스펙에서는 기본값으로 HIGH를 권장하고 있습니다. AWREADY가 HIGH라면 슬레이브는 반드시 어떤 유효한 ADDRESS를 수락할 수 있어야 합니다. 물론 AWREADY의 기본값을 LOW를 가질 수도 있지만 스펙에서는 추천하지 않습니다. LOW인 상태에서 (AWREADY가 아무리 빨리 HIGH로 트랜지션하여도) 최소 2 CYCLE 지연이 있다고 나와 있습니다.


적절한 예로 아래의 그림 3-1을 보시면 이해할 수 있습니다. READY 시그널이 LOW로 시작하고 있고 READY가 3번째 사이클 타임에서 HIGH가 되었지만 곧바로 샘플링되지 않고(X표시) 4번째 사이클에서 샘플링(O표시)되는 것을 확인할 수 있습니다. 다시 돌아와서 AWVALID 1 사이클 + AWREADY 1 사이클이 되기 때문에 최소 2 사이클 소요가 됨을 의미합니다.

 

 

나머지 채널에서 세부적으로 설명하는 부분들도 비슷하기 때문에 추가로 다루지 않겠습니다.

 

3.1.2 Write data channel
During a write burst, the master can assert the WVALID signal only when it drives valid write data. WVALID must remain asserted until the slave accepts the write data and asserts the WREADY signal. The default value of WREADY can be HIGH, but only if the slave can always accept write data in a single cycle. The master must assert the WLAST signal when it drives the final write transfer in the burst. When WVALID is LOW, the WSTRB[3:0] signals can take any value, although it is recommended that they are either driven LOW or held at their previous value.

 

3.1.3 Write response channel
The slave can assert the BVALID signal only when it drives a valid write response. BVALID must remain asserted until the master accepts the write response and asserts BREADY. The default value of BREADY can be HIGH, but only if the master can always accept a write response in a single cycle.

 

3.1.4 Read address channel
The master can assert the ARVALID signal only when it drives valid address and control information. It must remain asserted until the slave accepts the address and control information and asserts the associated ARREADY signal. The default value of ARREADY can be either HIGH or LOW. The recommended default value is HIGH, although if ARREADY is HIGH then the slave must be able to accept any valid address that is presented to it. A default ARREADY value of LOW is possible but not recommended, because it implies that the transfer takes at least two cycles, one to assert ARVALID and another to assert ARREADY.

 

3.1.5 Read data channel
The slave can assert the RVALID signal only when it drives valid read data. RVALID must remain asserted until the master accepts the data and asserts the RREADY signal. Even if a slave has only one source of read data, it must assert the RVALID signal only in response to a request for the data. The master interface uses the RREADY signal to indicate that it accepts the data. The default value of RREADY can be HIGH, but only if the master is able to accept read data immediately, whenever it performs a read transaction. The slave must assert the RLAST signal when it drives the final read transfer in the burst.

 

위의 스펙 원문에 ASSERT라는 동사가 자주 나오는데요. SPEC P.17에 ASSERTED 용어에 대한 설명이 있습니다만, 시그널을 Assert한다는 의미는 active-HIGH나 active-LOW 상태를 가지는 것을 의미합니다. 아래에는 위키델피아에서 발췌한 Logic level에서 Active state에 대한 일부 설명입니다.

Active-high and active-low states can be mixed at will: for example, a read only memory integrated circuit may have a chip-select signal that is active-low, but the data and address bits are conventionally active-high. Occasionally a logic design is simplified by inverting the choice of active level (see DeMorgan's theorem).

 

 

이 파트에서 궁금한 내용에 대해 질문을 주시면 아는 범위 내에서 답변을 드리도록 하겠습니다.

오늘은 여기까지 정리하도록 하겠습니다. 편안한 밤 보내세요.

 

 

Written by Simhyeon, Choe

 

 

2012. 5. 8. 00:45

AMBA AXI PROTOCOL v1.0 - BASIC TRANSACTIONS II

OVERLAPPING READ BURST와 WRITE BURST를 정리하도록 하겠습니다.

 

 

1.3.2 Overlapping read burst example


 Figure 1-5 shows how a master can drive another burst address after the slave accepts the first address. This enables a slave to begin processing data for the second burst in parallel with the completion of the first burst.

위의 그림에서 보시는 것과 같이 마스터는 슬레이브에게 BURST ADDRESS를 ISSUE하고(CONTROL INFORMATION도 함께) 슬레이브가 그 ADDRESS를 ACCEPT한 한 직후, 마스터는 다른 BURST ADDRESS를 ISSUE합니다. 그리고 T4 사이클에서 보면 마스터가 슬레이브에게 두 번째(B) BURST에 대한 ADDRESS를 ISSUE하는 중에 슬레이브는 마스터에게 첫 번째(A) 데이터를 전송하는 것을 볼 수 있는데, 이와 같이 병렬적인 처리가 가능한 이유가 BURST TRANSACTION을 완료하기전에 다음 BURST의 ADDRESS를 ISSUE할 수 있는 MULTIPLE OUTSTANDING ADDRESS 스킴과 함께 ADDRESS CHANNEL과 DATA CHANNEL이 분리되어 있기 때문입니다. 이것은 이전 시간에도 이미 언급했던 SKIM들입니다. 그 이후에는 "READ BURST" 예제와 동일하게 두 번째 트랜잭션을 마지막 DATA TRANSFER의 전송과 함께 RLAST 시그널을 마스터에게 보내고 트랜잭션을 마무리합니다.

 

 

1.3.3 Write burst example

 

Figure 1-6 shows a write transaction. The process starts when the master sends an address and control information on the write address channel. The master then sends each item of write data over the write data channel. When the master sends the last data item, the WLAST signal goes HIGH. When the slave has accepted all the data items, it drives a write response back to the master to indicate that the write transaction is complete.

WRITE BURST의 경우에는 READ BURST에 비해서 조금 복잡해 보일 수도 있지만, 동작 흐름은 크게 다르지 않습니다. 마스터는 WRITE 대상의 슬레이브에게 보낼 준비가 된 CONTROL INFORMATION과 WRITE ADDRESS를 ISSUE합니다. 슬레이브는 T2 사이클에서 해당 BURST ADDRESS를 수락함과 동시에 마스터가 바로 DATA TRANSFER를 전송하게 되는데 이것은 WVALID 시그널이 HIGH 상태 즉, 보낼 DATA TRANSFER가 바로 유효한 상태로 샘플링되었기 때문에 그렇습니다. T4 사이클에서 보면 슬레이브가 마스터로부터 DATA TRANSFER를 수락할 준비가 되면 하나의 DATA TRANSFER 전송이 완료되고 이후의 흐름도 동일하게 이어지다가 T9 사이클에서 마찬가지로 마스터가 슬레이브에게 마지막 DATA TRANSFER와 마지막 DATA임을 알리는 WLAST 시그널을 전송하게 되고 슬레이브는 WRITE 트랜잭션을 정상적으로 완료했다는 BRESP 시그널을 마스터에게 보냅니다. 마스터는 BREADY 시그널로 BRESP 시그널을 수락한 준비가 된 상태(HIGH)에서 슬레이브에서 보낸 BRESP 시그널을 수신함과 동시에 BREADY 시그널은 LOW 상태로 트랜지션합니다. 이로써 하나의 WRITE TRANSACTION이 완전히 마무리됩니다.

 

 

1.3.4 Transaction ordering

 

AXI Protocol은 OUT-OF-ORDER TRANSACTION 완료가 가능하다고 하였습니다. 모든 트랜잭션에 ID 태그가 주어지는데, 동일한 ID 태그를 가진 트랜잭션들은 순차적으로 완료해야 하지만 다른 ID 태그를 가진 트랜잭션은 비순차적으로 완료할 수 있다는 의미입니다.

 

첫 번째 강좌에서 이미 언급해 드렸지만 OUT-OF-ORDER 트랜잭션은 두가지 방법을 통해 성능을 향상시킬 수 있습니다


1) The interconnect can enable transactions with fast-responding slaves to complete

   in advance of earlier transactions with slower slaves.

 

2) Complex slaves can return read data out of order. For example, a data item for a later

  access might be available from an internal buffer before the data for an earlier access is 

  available.

 

첫 번째 방법은 마스터A가 슬레이브B에게 ADDRESS ISSUE를 먼저하고 다음에 슬레이브C에게ADDRESS ISSUE를 한 상황으로 가정합시다. AHB 프로토콜의 경우에는 순차적으로 트랜잭션을 마무리할 수 있는데, 만약 슬레이브B가 슬레이브C보다 응답이 느린 디바이스라고 해도 슬레이브B의 트랜잭션 동작이 먼저 처리가 되어야만 슬레이브C의 동작을 처리할 수 있습니다. 반면에 AXI 프로토콜에서는 응답속도가 더 빠른 슬레이브의 트랜잭션을 먼저 처리할 수 있기 때문에 성능에 이점이 있습니다.

 

두 번째 방법은 내부 버퍼에 1, 2, 3, 4 이렇게 순서대로 데이터 쌓여 있고 1이 먼저 처리되어야 할 순서라고 가정하겠습니다. 슬레이브 입장에서는 1보다 4부터 먼저 처리하기를 원하는 경우가 있다면 그럴 경우에 4, 3, 2, 1과 같이 비순차적으로 사용 가능하기 때문에 성능적인 측면에서 더욱 좋습니다.

 

If a master requires that transactions are completed in the same order that they are
issued, then they must all have the same ID tag. If, however, a master does not require
in-order transaction completion, it can supply the transactions with different ID tags,
enabling them to be completed in any order.
In a multimaster system, the interconnect is responsible for appending additional
information to the ID tag to ensure that ID tags from all masters are unique. The ID tag
is similar to a master number, but with the extension that each master can implement
multiple virtual masters within the same port by supplying an ID tag to indicate the
virtual master number.
Although complex devices can make use of the out-of-order facility, simple devices are
not required to use it. Simple masters can issue every transaction with the same ID tag,
and simple slaves can respond to every transaction in order, irrespective of the ID tag.

 

위의 스펙을 보시면 ID 태그에 대한 많은 설명이 나오는데요. ID 태그가 동일한 트랜잭션들은 반드시 순서대로 처리가 완료되어야 하지만 다른 ID 태그를 가진 트랜잭션은 비순차적으로 완료할 수 있다는 내용이 핵심인 것만 알아두시면 됩니다. 시간이 늦어 이만 강좌를 마치도록 하겠습니다. 궁금한 내용은 블로그에 얼마든지 질문해 주시면 아는데까지 성심껏 답변을 드리겠습니다. 편안한 밤 보내세요.

 

 

Written by Simhyeon, Choe

 

 

 

2012. 4. 16. 22:30

AMBA AXI PROTOCOL v1.0 - BASIC TRANSACTIONS I

오늘은 READ BURST, OVERLAPPING READ BURST, WRITE BURST 트랜잭션의 타이밍 다이어그램을 살펴보도록 합시다.

 

1.3 Basic transactions
This section gives examples of basic AXI protocol transactions. Each example shows
the VALID and READY handshake mechanism. Transfer of either address information
or data occurs when both the VALID and READY signals are HIGH. The examples are
provided in:
• Read burst example
• Overlapping read burst example
• Write burst example

 
1.3.1 Read burst example
Figure 1-4 shows a read burst of four transfers. In this example, the master drives the
address, and the slave accepts it one cycle later.

- Note -

 The master also drives a set of control signals showing the length and type of the burst, but these signals are omitted from the figure for clarity.

After the address appears on the address bus, the data transfer occurs on the read data
channel. The slave keeps the VALID signal LOW until the read data is available. For
the final data transfer of the burst, the slave asserts the RLAST signal to show that the
last data item is being transferred.

 

AXI BUS PROTOCOL은 AHB BUS PROTOCOL과 마찬가지로 모든 시그널은 RIGING EDGE에서 샘플링됩니다. 그리고 각 시그널에 대한 레퍼런스는 AMBA AXI PROTOCOL v1.0 SPEC P.31의 SIGNAL DESCRIPTION에 설명되어 있습니다.

위의 타이밍 다이어그램을 살펴보면, 모든 시그널의 샘플링을 전역으로 참조할 수 있도록 ACLK이 있고 녹색으로 표시된 부분은 마스터가 슬레이브에게 보내는 시그널이며 파란색으로 표시된 부분은 슬레이브가 마스터에게 보내는 시그널을 의미합니다(혼돈하기 쉽기 때문에 표시하였습니다). 그리고 각 시그널에는 AR, AW, R, W와 같이 시그널 앞에 PREFIX가 붙어 있는데요. AR은 "Read Address"를 뜻하고 AW는 "WRITE ADDRESS"를 의미합니다. 그냥 R과 W는 DATA에 대한 R/W를 말합니다. 몇 가지 예를 들어보도록 하겠습니다.

ARADDR = READ ADDRESS (FROM MASTER TO SLAVE)

RDATA   = READ DATA (FROM MASTER TO SLAVE)

RREADY = READ DATA READY (FROM SLAVE TO MASTER)

위와 같이 해석합니다. 전혀 어렵지 않죠? READ BRUST 동작은 간단합니다. 버스의 모든 동작은 항상 마스터가 아비터로부터 버스 사용 권한을 획득하여 컨트롤 시그널과 어드레스 시그널을 슬레이브에게 보냄으로써 시작됩니다. 컨트롤 시그널은 버스트 타입, 크기, 길이와 같은 정보들을 포함하고 있으며 어드레스 시그널은 특정 SLAVE의 주소 공간을 의미합니다. 그렇다면 MASTER가 여러 개의 SLAVE가 존재하는 버스에서 R/W할 대상 SLAVE는 어떻게 선택할까요?

그 해답은 아래와 같이 AXI PROTOCOL 특징에 설명되어 있습니다.

 

In memory mapped AXI (AXI3, AXI4, and AXI4-Lite), all transactions involve the concept
of a target address within a system memory space and data to be transferred.
Memory mapped systems often provide a more homogeneous way to view the system,
because the IPs operate around a defined memory map.

(AXI REFERENCE GUIDE P.11 - MEMORY MAPPED PROTOCOLS)

 

따라서, AMBA BUS를 사용하는 모든 IP들은 하나의 메모리 레이아웃으로 맵핑되어 있기 때문에 어떤 SLAVE인지는 관심가질 필요가 없으며 단지 SLAVE 영역에 해당하는 어드레스에 접근하기만 하면 됩니다.

 

첫 번째 T0에서 T1 사이클을 보면, 마스터가 슬레이브로 읽는 동작이 유효할 경우 ARVALID 시그널을 HIGH로 트랜지션합니다. 그 직후 바로 해당 슬레이브의 ADDRESS로 ISSUE(ISSUE는 보낸다는 의미)합니다. 언제까지 ISSUE할까요? 물론 SLAVE가 ARREADY 시그널이 HIGH로 트랜지션할 때까지 말이죠. T2 사이클에 ARREADY의 시그널이 HIGH로 샘플링됨과 동시에 ARVALID와 ARADDR이 LOW로 TRANSTION합니다(첫 번째 빨간 박스). T3에서 T4 사이클을 보면 RREADY 시그널이 HIGH로 되어 있는데 즉, 마스터는 이미 데이터를 받을 준비가 되어 있는 상태임을 알 수 있습니다. T5에서 T6 사이클에서 슬레이브가 마스터에게 보낼 데이터가 유효하다는 RVALID - HIGH 시그널을 보내고 바로 DATA를 전송함으로써 RREADY가 LOW로 트랜지션되는 것을 볼 수 있습니다. 이후 똑같은 과정으로 모든 데이터 전송을 진행하다가 마지막 DATA TRANSFER를 보낼 때 마지막이라는 것을 슬레이브가 마스터에게 알리기 위해 RLAST 시그널을 전송함으로써 하나의 버스트 트랜잭션을 완료합니다(세번 째 빨간 박스). 오늘은 READ BURST까지만 정리하고 다음 시간에는 OVERLAPPING READ BURST, WRITE BURST의 WAVEFORM을 살펴 보도록 하겠습니다.

 

Written by Simhyeon, Choe