Escolar Documentos
Profissional Documentos
Cultura Documentos
AMBA classification
Advanced High-performance Bus (AHB)
AHB is for high-performance, high clock frequency system modules.
AMBA signals
AHB:
Data
HADDR[31:0] (Master -> Slave/Decoder) HWDATA[31:0] (Master -> Slave) HRDATA[31:0] (Slave -> Master)
Global control
HCLK (clock source -> Master) HRESETn (Reset Controller -> Master)
Control
HWRITE (Master -> Slave) HTRANS[1:0] (Master -> Slave)
AMBA signals
AHB:
Control
HBURST[1:0] (Master -> Slave) HPROT[3:0] (Master -> Slave)
Can be neglected for now.
HREADY (Slave -> Master) HRESP[1:0] (Slave -> Master) HSELx (Decoder -> Slave)
AMBA signals
Arbitration Signals
Control
HBUSREQx (Master -> Arbiter) HLOCKx (Master -> Arbiter) HGRANTx (Arbiter -> Master) HMASTER[3:0] (Arbiter -> Slave) HMASTERLOCK (Arbiter -> Slave) HSPLITx[1:0] (Slave -> Arbiter)
AMBA signals
APB:
Data
PADDR[31:0] (Bridge -> Slave) PWDATA (Bridge -> Slave)
Can up to 32 bit wide
Control
PCLK (Bridge -> Slave) PRESTn (Bridge -> Slave) PWRITE (Bridge -> Slave) PENABLE (Bridge -> Slave) PSELx (Bridge -> Slave)
AMBA AHB
AMBA AHB
burst transfers split transactions single cycle bus master handover single clock edge operation non-tristate implementation wider data bus configurations (64/128 bits).
AHB interconnection
Bus master drives the address and control Arbiter selects one of the masters
ERROR: transfer error RETRY and SPLIT: transfer cant complete immediately, but the bus master should continue to attempt the transfer
Address decoding
A central address decoder provides HSELx for each slave Minimum address space that can be allocated to a single slave is 1K Byte
AHB arbiter
Basic transfer
An AHB transfer consists of two distinct sections:
Master action
Slave action
Multiple Transfer
Transfer Type
Type
IDEL HTRANS[1:0]
Descripton
Slaves must always provide a zero wait state OKAY response to IDLE transfers and the transfer should be ignored by the slave. Masters cannot take next transfer place immediately during a burst transfer Indicates the first transfer of a burst or a single transfer The remaining transfers in a burst are SEQUENTIAL.
00
01 10 11
Burst Operation(1/2)
Type
SINGLE INCR WRAP4 INCR4 WRAP8 INCR8 WAP16 INCR16 HBURST[2:0] 000 001 010 011 100 101 110 111
Descripton Single Transfer Incrementing burst of unspecified length 4-beat wrapping burst 4-beat incrementing burst 8-beat wrapping burst 8-beat incrementing burst 16-beat wrapping burst 16-beat incrementing burst
Burst Operation(1/2)
Four-beat wrapping burst
WRAP4 0x30 0x34 0x38 0x3c 0x40 0x44
Two-cycle response
Split transfers
1. If the slave decides that it may take a large number of cycles to obtain the data, it returns a SPLIT response (instead of OK) to the arbiter and memorizes HMASTER 2. The arbiter grants the use of the bus to another master that requests it 3. When the slave is ready to complete the transfer, it asserts the appropriate bit of the HSPLITx (between 0 and 16) bus to the arbiter 4. The arbiter observes the HSPLITx signals every cycle. It will allow the master to complete the transfer if no higher priority master is using the bus 5. When the transfer eventually takes place the slave finishes with an OKAY transfer response
Split transfers
AMBA ASB
Disadvantages
Single, tri-state data bus Latch-based instead of register-based design Uses both clock edges Split transfers not supported
AMBA APB
AMBA APB
Low power Latched address and control Simple interface Suitable for many peripherals
APB specification
The APB specification is described under the following headings: State diagram Write transfer Read transfer
State diagram
Write transfer
SETUP ENABLE
1 0
1 1
Read transfer
SETUP ENABLE
1 0
1 1
APB bridge
Interface diagram
APB slave
Interface diagram
Monitir
EXAMPLE(1/3)
APB write transfer
task w_setup; input [(addr_size-1):0] addr; input [(data_size-1):0] data; begin paddr<=addr; pwrite<=1'b1; psel<=1'b1; penable<=1'b0; pwdata<=data; @(posedge clk); end endtask
task enable; begin psel<=1'b1; penable<=1'b1; @(posedge clk); psel<=1'b0; penable<=1'b0; end endtask
task w_transfer; input [(addr_size-1):0] addr; input [(data_size-1):0] data; begin w_setup(addr, data); enable; end endtask
EXAMPLE(2/3)
APB read transfer
task r_setup; input [(addr_size-1):0] addr; input [(data_size-1):0] data; begin paddr<=addr; pwrite<=1'b0; psel<=1'b1; penable<=1'b0; @(posedge clk); prdata<=data; end endtask
task enable; begin psel<=1'b1; penable<=1'b1; @(posedge clk); psel<=1'b0; penable<=1'b0; end endtask
task r_transfer; input [(addr_size-1):0] addr; input [(data_size-1):0] data; begin r_setup(addr, data); enable; end endtask
EXAMPLE(3/3)
Function Task
task test1; integer i; begin reset_wf; for (i=1;i<=num_regs;i=i+1) begin write_transfer(i,i); end for (i=1;i<=num_regs;i=i+1) begin read_transfer(i,i); end end endtask
Monitir
BFM
DUT
EXAMPLE(1/3)
Test bench for BRIDGE
EXAMPLE(2/3)
AHB to APB write transfer
task ahb_apb_write; input [31:0] address; input [31:0] wdata; output [1:0] response; begin //cycle 1 write_addr(address); response = #1 HRESP; //cycle 2 write_data(wdata); response = #1 HRESP; //cycle 3 idel; response = #1 HRESP; //cycle4 idel; response = #1 HRESP; end endtask
EXAMPLE(3/3)
AHB to APB read transfer
task ahb_apb_read; input [31:0] address; input [31:0] rdata; output [1:0] response; begin //cycle 1 read_addr(address); response = #1 HRESP; //cycle 2 reade_data(rdata); response = #1 HRESP; //cycle 3 reade_data(rdata); response = #1 HRESP; end endtask
XCV2000E
AHB decoder
8
Push bottom
Register peripheral
AHB
18
OSC
Keypad controller AHB To APB Bridge LCD controller interface USB device controller Interrupt controller
keypad
2D FDCT/IDCT nLMINT
AHB decoder
Select peripheral Address = C100_0000 ~ C5FF_FFFF
assign iHSELAHBAPB = ((iHSELLOGICMODULE == 1'b1) & ((HADDR[27:24] >= 4'b0001) & (HADDR[27:24] <= 4'b0101))) ? 1'b1 : 1'b0; assign iHSELDCT = ((iHSELLOGICMODULE == 1'b1) & (HADDR[27:20] == 4'b0000)) ? 1'b1 : 1'b0; assign iHSELDefault
Select 2D DCT/IDCT
= ((iHSELLOGICMODULE == 1'b1) Address = C000_0000 ~ C0FF_FFFF & ~((HADDR[27:24] >= 4'b0001) & (HADDR[27:24] <= 4'b0101)) & ~(HADDR[27:20] == 4'b0000)) ? 1'b1 : 1'b0;
Logic Module
HCLK HRESETn HTRANS[1:0] HWRITE HSIZE[1:0] HADDR[31:0] HDATA[31:0] HREADY HESP[1:0] HBUSREQ HLOCK HDRID[3:0] LED Switch
XCV2000E
AHB decoder
8
Push bottom
Register peripheral
AHB
18
OSC
Keypad controller AHB To APB Bridge LCD controller interface USB device controller Interrupt controller
keypad
2D FDCT/IDCT nLMINT
0xCFFF_FFFF
16MB
16MB
PCI
16MB Core module/ Motherboard Memory and peripherals 16MB
Peripheral Select
// constants for APB address decoding `define REGSBASE `define INTCBASE `define LCDBASE `define USBBASE `define KEYBASE 4'b0001 4'b0010 4'b0011 4'b0101 if (HAddrMux[27:24] == `USBBASE) PSELUSBint = 1'b1; if (HAddrMux[27:24] == `LCDBASE) PSELLCDint = 1'b1; if (HAddrMux[27:24] == `INTCBASE) PSELINTCint = 1'b1; if (HAddrMux[27:24] == `REGSBASE) PSELREGSint = 1'b1; if (HAddrMux[27:24] == `KEYBASE) 4'b0100 PSELKEYint = 1'b1;
keypad USB LCD Interrupt controller Logic Module Registers
0xC5FF_FFFF 0xC500_0000 0xC4FF_FFFF 0xC400_0000 0xC3FF_FFFF 0xC300_0000 0xC2FF_FFFF 0xC200_0000 0xC1FF_FFFF 0xC100_0000
Din[7:0] ND
EMPTY
RFD
FIFO_W_R Controller
RDY Dout[11:0]
FSM
EMPTY FULL RD WR
RST
AMBA APB
Interrupt Generation
CLK
Wrapper
Interface
FIFO_R
DCT
B us error response 0 x C 6 0 0 _ 00 0 0 0 x C 5 F F _ FF F F 0 x C 5 0 0 _ 00 0 0 0 x C 4 F F _ FF F F 0 x C 4 0 0 _ 00 0 0
LCD In terrup t con troller Log ic M od u le Reg isters 2D FD CT/ID CT
0 x F 0 0 0 0 00 0 0 x E 0 0 0 0 00 0 0 x D 0 0 0 0 00 0 0 x C 0 0 0 0 00 0
0 x C 3 F F _ FF F F 0 x C 3 0 0 _ 00 0 0 0 x C 2 F F _ FF F F 0 x C 2 0 0 _ 00 0 0 0 x C 1 F F _ FF F F 0 x C 1 0 0 _ 00 0 0 0 x C 0 F F _ FF F F 0 x C 0 0 0 _ 00 0 0
16M B
16M B
PCI
16M B Core m odu le/ M oth erb oard M em ory and periph erals 16M B
0xC0A0_0000~0xC0FF_FFFF
0xC050_0000~0xC09F_FFFF