1
OPB - On-chip Peripherial BusOPB - On-chip Peripherial BusAXI – Advance eXtensible InterfaceAXI – Advance eXtensible Interface
by Ernest Jamro
Katedra Elektroniki, AGH Kraków
2
Przykład magistrali OPBPrzykład magistrali OPB
OPB – magistrala wewnętrzna, łącząca moduły wewnątrz pojedynczego układu scalonego
3
OPB, AXI OPB, AXI MagistralMagistralee synchronicznsynchronicznee
Wszystkie sygnały są próbkowane wraz z narastającym sygnałem zegarowym.
4
Różne rodzaje urządzeń:Różne rodzaje urządzeń: Master – inicjuje transfer: podaje sygnał
gotowości do transmisji (sygnał Select lub adres na magistrale adresową, dane (w przypadku zapisu) na magistralę
Slave (OPB) – zachowuje się podobnie jak pamięć – czyli odczytuje adres i wystawia dane (w przypadku odczytu).
Arbiter – Transmisja jest wykonywana tylko pomiędzy jednym urządzeniem Master i jednym urządzeniem Slave. Dlatego Arbiter przyznaje magistrale wybranemu pojedynczemu urządzeniu Master (Initiator) w wybranej chwili czasowej.
5
Współdzielenie Współdzielenie (multipleksacja) sygnałów na (multipleksacja) sygnałów na
magistrali OPBmagistrali OPB
Y
D0
D1
Select
6
Fizyczne połączenie sygnałów magistrali OPBFizyczne połączenie sygnałów magistrali OPB
7
Prosty sposób transakcji - Prosty sposób transakcji - OPBOPB
clk
Slave – Ack
0 1 2 3 4 5 6
Master – Select
Urządzenie Master gotowe do transmisji: Select=‘1’
Urządzenie Slave odpowiada, że jest gotowe do transmisji: Ack=‘1’
Transfer danych tylko wtedy kiedy Ack=‘1’ (przy narastającym sygnale zegarowym – magistrala synchroniczna)
8
Prosty sposób transakcji - AXIProsty sposób transakcji - AXIValid przed Ready
Ready przed Valid
9
Algorytm Arbitrażu 1Algorytm Arbitrażu 1
Stały priorytet – każde urządzenie ma określony priorytet i magistrala jest przydzielana według priorytetu (urządzenie żądające magistrali o najwyższym priorytecie dostaje magistrale.
OPB_M0Grant<= M0_request -- [M0 – najwyższy priorytet]OPB_M1Grant<= M1_request and not M0_requestOPB_M2Grant<= M2_request and not
(M0_request or M1_request)OPB_M3Grant<= M3_request and not
(M0_request or M1_request or M2_request)
10
Algorytm Arbitrażu 2Algorytm Arbitrażu 2
Dynamiczny Priorytet – np. Least Recently Used (LRU) algorytm, dla którego po każdym arbitrażu magistrali Master, który ostatnio otrzymał magistralę ma ustawiony priorytet na najniższy, pozostałym urządzeniom priorytet jest podnoszony o 1.
M0_Priorytet<= 0 -- [M0 – przyznano właśnie magistra]
M1_Priorytet<= M1_Priorytet + 1
M2_Priorytet<= M2_Priorytet + 1
...
11
Arbitraż Magistrali OPBArbitraż Magistrali OPB
12
Pojedynczy odczyt na OPBPojedynczy odczyt na OPB
13
Pojedynczy odczyt i zapis na OPBPojedynczy odczyt i zapis na OPB
14
Adresowanie sekwencyjneAdresowanie sekwencyjne
15
Podstawowa funkcja modułu slavePodstawowa funkcja modułu slave
•Dekodowanie czy adres na magistrali Adres jest w zakresie lokacji adresowej urządzenia Slave (czyli od C_BASEADDR do C_HIGHADDR)
•Wystawienie sygnału ACK tylko wtedy, kiedy jest adresowane urządzenie użytkownika
•Kopiowanie stanu sygnałów drd na magistralę Sl_DBus w przypadku odczytu OPB_RNW=1 i aktywnego urządzenia
16
Budowa własnego modułu Budowa własnego modułu Slave (tylko zapis do rejestru)Slave (tylko zapis do rejestru)
axi_mój_moduł_nadrzędny
sygnały użyt.
IPIC moduł użytkownika
magistrala OPB / AXI
clk
17
AXI lite IPIFAXI lite IPIF
18
IPIF User Ports 1IPIF User Ports 1Bus2IP_Addr
Bus2IP_Addr is a 32-bit vector that drives valid when Bus2IP_CS and Bus2IP_RdCE or Bus2IP_WrCE drives high.
Bus2IP_Data
Bus2IP_Data is a vector of width C_S_AXI_DATA_WIDTH and drives valid on writes when Bus2IP_WrCE is high.
Bus2IP_RNW
Bus2IP_RNW is a signal indicating the type of transfer in progress and is valid when Bus2IP_CS and
Bus2IP_WrCE or Bus2IP_RdCE is asserted. A high on Bus2IP_RNW indicates the transfer request is a read of the user IP. A low on Bus2IP_RNW indicates the transfer request is a write to the user IP.
Bus2IP_CS
Bus2IP_CS is a vector of width C_ARD_ADDR_RANGE_ARRAY length / 2. In other words, for each address pair defined in C_ARD_ADDR_RANGE_ARRAY there is one Bus2IP_CS defined. This signal asserts at the beginning of a valid cycle on the IPIC. This signal used in conjunction with Bus2IP_RNW is especially suited for reading and writing to memory type devices.
Bus2IP_RdCE
Bus2IP_RdCE is a vector of a width that is the sum total of the values defined in C_ARD_NUM_CE_ARRAY. For each address pair defined in C_ARD_ADDR_RANGE_ARRAY, a number of CEs can be defined in C_ARD_NUM_CE_ARRAY. Bus2IP_RdCE goes High coincident with Bus2IP_CS for read type transfers and is especially suited for reading registers.
19
IPIF User Ports 2IPIF User Ports 2Bus2IP_WrCE
Bus2IP_WrCE is a vector of a width that is the sum total of the values defined in C_ARD_NUM_CE_ARRAY. For each address pair defined in C_ARD_ADDR_RANGE_ARRAY, a number of CEs can be defined in C_ARD_NUM_CE_ARRAY. Bus2IP_WrCE goes High when the write data is valid on Bus2IP_WrCE and is especially suited for writing to registers.
IP2Bus_Data
IP2Bus_Data is a vector of width C_S_AXI_DATA_WIDTH and is the read data bus. Read data should be valid when IP2Bus_RdAck is asserted by the user IP.
IP2Bus_RdAck
IP2Bus_RdAck is the read data acknowledge signal. This signal is used by the user IP to acknowledge a read cycle and causes read control signals, Bus2IP_RdCE, Bus2IP_CS and Bus2IP_RNW to deassert.
IP2Bus_WrAck
IP2Bus_WrAck is the write data acknowledge signal. This signal is used by the user IP to acknowledge a write cycle and causes write control signals, Bus2IP_WrCE, and Bus2IP_CS to deassert.
20
IPIF Usage exampleIPIF Usage exampleGPIO - General Purpose Input OutputGPIO - General Purpose Input Output
-- OUTPUT
process (Bus2IP_Clk)
begin
if Bus2IP_Clk 'event and Bus2IP_Clk ='1' then
if Bus2IP_WrCE(0)= '1' then
GPIO_OUT <= Bus2IP_Data;
end if;
end if;
end process;
IP2Bus_WrAck <= Bus2IP_WrCE(0);
-- Input
IP2Bus_Data <= GPIO_In;
IP2Bus_RdAck <= Bus2IP_RdCE(0);
21
IPIF GPIO2 –2 PortsIPIF GPIO2 –2 Ports-- OUTPUT
process (Bus2IP_Clk)
begin
if Bus2IP_Clk 'event and Bus2IP_Clk ='1' then
if Bus2IP_WrCE(0)= '1' then
GPIO_OUT0 <= Bus2IP_Data;
end if;
if Bus2IP_WrCE(1)= '1' then
GPIO_OUT1 <= Bus2IP_Data;
end if;
end if;
end process;
IP2Bus_WrAck <= Bus2IP_WrCE(0) or Bus2IP_WrCE(1);
-- Input
IP2Bus_Data <= GPIO_In0 when Bus2IP_RdCE(0) else GPIO_In1;
IP2Bus_RdAck <= Bus2IP_RdCE(0) or Bus2IP_RdCE(1);
22
IPIF – BRAM memoryIPIF – BRAM memoryBRAM_Adr<= Bus2IP_Addr;
BRAM_Din<= Bus2IP_Data;
IP2Bus_Data<= BRAM_Dout;
BRAM_WriteEnable<= Bus2IP_CS(0) and not Bus2IP_RNW;
IP2Bus_WrAck<= BRAM_WriteEnable;
process (Bus2IP_Clk) begin
if Bus2IP_Clk 'event and Bus2IP_Clk ='1' then
if Bus2IP_CS(0) = '1‘ and Bus2IP_RNW=‘1’ and IP2Bus_RdAck=‘0’ then
IP2Bus_RdAck<= ‘1’; -- one clock delay for BRAM reading
else
IP2Bus_RdAck<= ‘0’;
end if;
end if;
end process;
23
AXIAXI
• AXI4 (Memory-Mapped), a robust memory-mapped interface designed to
achieve maximum levels of on-chip performance. Allows variable bursts up to 256 data transfers per single address transfer.
• AXI4-Lite, a lightweight, single-transaction memory-mapped interface. It is a smaller logic footprint, a subset of the AXI4 interface, used for accessing control registers and low-performance peripherals.
• AXI4-Stream, used for high-speed streaming applications that do not require an address. Data burst size can be unlimited.
24
AXI - ArchitectureAXI - ArchitectureThe AXI protocol is burst-based and defines the following independent transaction channels:
• read address
• read data
• write address
• write data
• write response.
25
AXI – Point to Point AXI – Point to Point connectionconnection
26
Prosty sposób transakcji - AXIProsty sposób transakcji - AXIValid przed Ready
Ready przed Valid
27
AXI – transaction AXI – transaction handshakinghandshaking
Read
Write
may be before
must be before
28
Address Address transactiontransactionThe AXI protocol is burst-based. The master begins each burst by driving control information and the address of the first byte in the transaction to the slave. As the burst progresses, the slave must calculate the addresses of subsequent transfers in the burst. A burst must not cross a 4KB address boundary.
Burst length
The burst length is specified by:
• ARLEN[7:0], for read transfers
• AWLEN[7:0], for write transfers.
Burst_Length = AxLEN[7:0] + 1
29
Number of bytes to transfer in each data transfer
Burst size The maximum number of bytes to transfer in each data transfer, or beat, in a burst, is specified by:
• ARSIZE[2:0], for read transfers
• AWSIZE[2:0], for write transfers.AxSIZE[2:0] Bytes in transfer
0b000 1
0b001 2
0b010 4
0b011 8
0b100 16
0b101 32
0b110 64
0b111 128
30
Burst typeBurst typeFIXED In a fixed burst, the address is the same for every transfer in the burst.
This burst type is used for repeated accesses to the same location such as when loading or emptying a FIFO.
INCR Incrementing. In an incrementing burst, the address for each transfer in the burst is an increment of the address for the previous transfer. The increment value depends on the size of the transfer. For example, the address for each transfer in a burst with a size of four bytes is the previous address plus four.
WRAP A wrapping burst is similar to an incrementing burst, except that the address wraps around to a lower address if an upper address limit is reached.
AxBURST[1:0] Burst type
0b00 FIXED
0b01 INCR
0b10 WRAP
0b11 Reserved
31
Transaction IDTransaction IDThe AXI protocol includes AXI ID transaction identifiers. By using AXI IDs, a master can issue transactions without waiting for earlier transactions to complete. This can improve system performance, because it enables parallel processing of transactions. There is no requirement for slaves or masters to use AXI transaction IDs. Masters and slaves can process one transaction at a time, meaning transactions are processed in the order they are issued.
Transaction channel Transaction ID
Write address channel AWID[3:0]
Write data channel, AXI3 only WID[3:0]
Write response channel BID[3:0]
Read address channel ARID[3:0]
Read data channel RID[3:0]
32
33
AXI StreamAXI Stream clk
Slave – tready
0 1 2 3 4 5 6
Master – tvalid
Master – tdata D1 D2 D3 D4
Master – tlast
Moduł A
Moduł B
tvalid
tready S S M
tdata
tlast
tvalid
tready
tdata
tlast
tvalid
tready
data
tlast
34
ENDEND