SlideShare a Scribd company logo
1
EECS 373
Design of Microprocessor-Based Systems
Prabal Dutta
University of Michigan
AMBA: Advanced Microcontroller Bus Architecture
AHB: AMBA High-performance Bus
APB: Advanced Peripheral Bus
Slides developed in part by
Mark Brehob & Prabal Dutta
Busses: the glue that connects the pieces
2
Timers
Central
Processing
Unit
Software
Hardware
Internal
External
System Buses
AHB/APB
ldr (read)
str (write)
ISA
EECS 370
USART DAC/ADC
Internal &
External
Memory
GPIO/INT
C
Assembly
Machine Code
Interrupts
bl (int)
Today…
MMIO: Memory-Mapped I/O review
AMBA: Advanced Microcontroller Bus Architecture
APB: Advanced Peripheral Bus
AHB: AMBA High-performance Bus
3
Memory-Mapped I/O (MMIO)
• I/O model in which the same address bus/space is used to
• Do memory accesses (e.g. to RAM)
• Do I/O operations (e.g. to I/O pins or peripheral registers)
• Reading and writing memory addresses allows us to
• Read peripheral state (e.g. value of an I/O pin or FSM’s DFF)
• Issue peripheral commands (e.g. set an I/O pin or FSM’s state)
• How?
• Memory has an address and value
• Can equate a pointer to desired address
• Can set/get de-referenced value to change memory
• Can control peripheral state in this way
4
Reading register bits with MMIO
• How?
• Let’s say that red, green, and blue pushbuttons are mapped to memory address
0xB0000003 at bits 0, 1, and 2, respectively
• When pushed, we will read a ‘1’ from the corresponding bit
• When released, we will read a ‘0’ from the corresponding bit
Address  Bit 31 24 23 16 15 8 7 210
0xB0000003 -------- -------- -------- -----
• Must mask (and perhaps shift) to select target bits for reading
5
#define PBS_REG 0xB0000003
int isBlueButtonPressed() {
return (*((uint32_t *)PBS_REG) & 0x00000004) >> 2;
}
Writing register bits with MMIO
• How?
• Let’s say that red, green, and blue LEDs are mapped to memory address 0xB0000004
at bits 0, 1, and 2, respectively
• Writing a ‘1’ (‘0’) to the corresponding bit turns on (off) the LED
Address  Bit 31 24 23 16 15 8 7 210
0xB0000004 -------- -------- -------- -----
• When updating (set/clear) bits, must preserve remaining contents
• Use bitmask to select target bits for manipulation, e.g.
6
#define LED_REG 0xB0000004
void setRedLed() {
*((uint32_t *)LED_REG) |= 0x1;
}
void setGreenLed() {
*((uint32_t *)LED_REG) |= 0x2;
}
#define LED_REG 0xB0000004
void clearRedLed() {
*((uint32_t *)LED_REG) &= ~(0x00000001);
}
void clearBlueLed() {
*((uint32_t *)LED_REG) &= ~(0x00000004);
}
Some useful C keywords
• const
• Makes variable value or pointer parameter unmodifiable
• const foo = 32;
• register
• Tells compiler to locate variables in a CPU register if possible
• register int x;
• static
• Preserve variable value after its scope ends
• Does not go on the stack
• static int x;
• volatile
• Opposite of const
• Can be changed in the background
• volatile int I;
7
Today…
MMIO: Memory-Mapped I/O review
AMBA: Advanced Microcontroller Bus Architecture
APB: Advanced Peripheral Bus
AHB: AMBA High-performance Bus
8
Advanced Microcontroller Bus Architecture
(AMBA)
- Advanced/AMBA High-performance Bus (AHB)
- Advanced Peripheral Bus (APB)
AHB
• High performance
• Pipelined operation
• Burst transfers
• Multiple bus masters
• Split transactions
APB
• Low power
• Latched address/control
• Simple interface
• Suitable of many peripherals
9
Actel SmartFusion system/bus architecture
10
Today…
MMIO: Memory-Mapped I/O review
AMBA: Advanced Microcontroller Bus Architecture
APB: Advanced Peripheral Bus
AHB: AMBA High-performance Bus
11
APB: a simple bus that is easy to work with
• Low-cost
• Low-power
• Low-complexity
• Low-bandwidth
• Non-pipelined
• Ideal for peripherals
12
Notation
13
APB bus state machine
• IDLE
• Default APB state
• SETUP
• When transfer required
• PSELx is asserted
• Only one cycle
• ACCESS
• PENABLE is asserted
• Addr, write, select, and write data
remain stable
• Stay if PREADY = L
• Goto IDLE if PREADY = H and no
more data
• Goto SETUP is PREADY = H and
more data pending
14
Setup phase begins
with this rising edge
Setup
Phase
Access
Phase
APB signal definitions
• PCLK: the bus clock source (rising-edge triggered)
• PRESETn: the bus (and typically system) reset signal (active low)
• PADDR: the APB address bus (can be up to 32-bits wide)
• PSELx: the select line for each slave device
• PENABLE: indicates the 2nd and subsequent cycles of an APB xfer
• PWRITE: indicates transfer direction (Write=H, Read=L)
• PWDATA: the write data bus (can be up to 32-bits wide)
• PREADY: used to extend a transfer
• PRDATA: the read data bus (can be up to 32-bits wide)
• PSLVERR: indicates a transfer error (OKAY=L, ERROR=H)
15
APB bus signals in action
• PCLK
• Clock
• PADDR
• Address on bus
• PWRITE
• 1=Write, 0=Read
• PWDATA
• Data written to the I/O device.
Supplied by the bus
master/processor.
16
APB bus signals
• PSEL
• Asserted if the current bus
transaction is targeted to this
device
• PENABLE
• High during entire transaction
other than the first cycle.
• PREADY
• Driven by target. Similar to our
#ACK. Indicates if the target is
ready to do transaction.
Each target has it’s own
PREADY
17
A write transfer with no wait states
18
Setup phase begins
with this rising edge
Setup
Phase
Access
Phase
A write transfer with wait states
19
Setup phase begins
with this rising edge
Setup
Phase
Access
Phase
Wait
State
Wait
State
A read transfer with no wait states
20
Setup phase begins
with this rising edge
Setup
Phase
Access
Phase
A read transfer with wait states
21
Setup phase begins
with this rising edge
Setup
Phase
Access
Phase
Wait
State
Wait
State
Example setup
•We will assume we have one bus master “CPU”
and two slave devices (D1 and D2)
• D1 is mapped to 0x00001000-0x0000100F
• D2 is mapped to 0x00001010-0x0000101F
CPU stores to location 0x00001004 with no
stalls
23
D1
D2
Writes
Let’s do some hardware examples!
24
Design a device which writes to a register
whenever
any address in its range is written
25
32-bit Reg
D[31:0]
Q[31:0]
EN
C
We are assuming APB only gets lowest 8 bits of address here…
What if we want to have the LSB of this register control an
LED?
PREADY
PWDATA[31:0]
PWRITE
PENABLE
PSEL
PADDR[7:0]
PCLK
LED
Reg A should be written at address 0x00001000
Reg B should be written at address 0x00001004
26
32-bit Reg A
D[31:0]
Q[31:0]
EN
C
We are assuming APB only gets lowest 8 bits of address here…
32-bit Reg B
D[31:0]
Q[31:0]
EN
C
PREADY
PWDATA[31:0]
PWRITE
PENABLE
PSEL
PADDR[7:0]
PCLK
Reads…
27
The key thing here is that each slave device has its own read data (PRDATA) bus!
Recall that “R” is from the initiator’s viewpoint—the device drives data when read.
Let’s say we want a device that provides data from
a switch on a read to any address it is assigned.
(so returns a 0 or 1)
28
Mr.
Switch
PWRITE
PENABLE
PSEL
PADDR[7:0]
PCLK
PREADY
PRDATA[32:0]
Device provides data from switch A if address
0x00001000 is read from. B if address 0x00001004
is read from
29
Mr.
Switch
Mrs.
Switch
PWRITE
PENABLE
PSEL
PADDR[7:0]
PCLK
PREADY
PRDATA[31:0]
All reads read from register, all writes write…
30
PWDATA[31:0]
PWRITE
PENABLE
PSEL
PADDR[7:0]
PCLK
PREADY
32-bit Reg
D[31:0]
Q[31:0]
EN
C
We are assuming APB only gets lowest 8 bits of address here…
PREADY
PRDATA[31:0]
Things left out…
• There is another signal, PSLVERR (APB Slave Error) which we can drive
high if things go bad.
• We’ll just tie that to 0.
• PRESETn
• Active low system reset signal
• (needed for stateful peripherals)
• Note that we are assuming that our device need not stall.
• We could stall if needed.
• I can’t find a limit on how long, but I suspect at some point the processor would
generate an error.
31
Verilog!
32
/*** APB3 BUS INTERFACE ***/
input PCLK, // clock
input PRESERN, // system reset
input PSEL, // peripheral select
input PENABLE, // distinguishes access phase
output wire PREADY, // peripheral ready signal
output wire PSLVERR, // error signal
input PWRITE, // distinguishes read and write cycles
input [31:0] PADDR, // I/O address
input wire [31:0] PWDATA, // data from processor to I/O device (32 bits)
output reg [31:0] PRDATA, // data to processor from I/O device (32-bits)
/*** I/O PORTS DECLARATION ***/
output reg LEDOUT, // port to LED
input SW // port to switch
);
assign PSLVERR = 0;
assign PREADY = 1;
Actel/Microsemi implementation of
CoreAPB3
33
• ARM APB spec is silent about sharing signals
– PSEL, PREADY, PRDATA are shared
– Hence, every peripheral needs its own
decode logic…which is cumbersome
• Actel CoreAPB3 (and other) module(s) help
• Allocates per-slave signals
– PSEL, PREADY, PRDATA, PSLVERR broken out
– CoreAPB3 supports 16 slaves
– Performs address decoding for PSEL
– De-multiplexes PSEL signal
– Multiplexes PREADY, PRDATA, PSLVERR
Today…
MMIO: Memory-Mapped I/O review
AMBA: Advanced Microcontroller Bus Architecture
APB: Advanced Peripheral Bus
AHB: AMBA High-performance Bus
34
AHB-Lite supports single bus master
and provides high-bandwidth operation
• Burst transfers
• Single clock-edge operation
• Non-tri-state implementation
• Configurable bus width
35
AHB-Lite bus master/slave interface
• Global signals
• HCLK
• HRESETn
• Master out/slave in
• HADDR (address)
• HWDATA (write data)
• Control
• HWRITE
• HSIZE
• HBURST
• HPROT
• HTRANS
• HMASTLOCK
• Slave out/master in
• HRDATA (read data)
• HREADY
• HRESP
36
AHB-Lite signal definitions
• Global signals
• HCLK: the bus clock source (rising-edge triggered)
• HRESETn: the bus (and system) reset signal (active low)
• Master out/slave in
• HADDR[31:0]: the 32-bit system address bus
• HWDATA[31:0]: the system write data bus
• Control
• HWRITE: indicates transfer direction (Write=1, Read=0)
• HSIZE[2:0]: indicates size of transfer (byte, halfword, or word)
• HBURST[2:0]: indicates single or burst transfer (1, 4, 8, 16 beats)
• HPROT[3:0]: provides protection information (e.g. I or D; user or handler)
• HTRANS: indicates current transfer type (e.g. idle, busy, nonseq, seq)
• HMASTLOCK: indicates a locked (atomic) transfer sequence
• Slave out/master in
• HRDATA[31:0]: the slave read data bus
• HREADY: indicates previous transfer is complete
• HRESP: the transfer response (OKAY=0, ERROR=1)
37
Key to timing diagram conventions
• Timing diagrams
• Clock
• Stable values
• Transitions
• High-impedance
• Signal conventions
• Lower case ‘n’ denote active low
(e.g. RESETn)
• Prefix ‘H’ denotes AHB
• Prefix ‘P’ denotes APB
38
Basic read and write transfers with no wait states
39
Pipelined
Address
& Data
Transfer
Read transfer with two wait states
40
Two wait states
added by slave
by asserting
HREADY low
Valid data
produced
Write transfer with one wait state
41
One wait state
added by slave
by asserting
HREADY low
Valid data
held stable
Wait states extend the address phase of next
transfer
42
One wait state
added by slave
by asserting
HREADY low
Address stage of
the next transfer
is also extended
Today…
MMIO: Memory-Mapped I/O review
AMBA: Advanced Microcontroller Bus Architecture
APB: Advanced Peripheral Bus
AHB: AMBA High-performance Bus
- Low-level details included for completeness
- But we’ll skip most of these details
43
Transfers can be of four types (HTRANS[1:0])
• IDLE (b00)
• No data transfer is required
• Slave must OKAY w/o waiting
• Slave must ignore IDLE
• BUSY (b01)
• Insert idle cycles in a burst
• Burst will continue afterward
• Address/control reflects next transfer in burst
• Slave must OKAY w/o waiting
• Slave must ignore BUSY
• NONSEQ (b10)
• Indicates single transfer or first transfer of a burst
• Address/control unrelated to prior transfers
• SEQ (b11)
• Remaining transfers in a burst
• Addr = prior addr + transfer size
44
A four beat burst with master busy and slave
wait
45
One wait state
added by slave
by asserting
HREADY low
Master busy
indicated by
HTRANS[1:0]
Controlling the size (width) of a transfer
• HSIZE[2:0] encodes the size
• The cannot exceed the data bus width
(e.g. 32-bits)
• HSIZE + HBURST is determines
wrapping boundary for wrapping
bursts
• HSIZE must remain constant
throughout a burst transfer
46
Controlling the burst beats (length) of a
transfer
• Burst of 1, 4, 8, 16, and undef
• HBURST[2:0] encodes the type
• Incremental burst
• Wrapping bursts
• 4 beats x 4-byte words wrapping
• Wraps at 16 byte boundary
• E.g. 0x34, 0x38, 0x3c, 0x30,…
• Bursts must not cross 1KB address
boundaries
47
A four beat wrapping burst (WRAP4)
48
A four beat incrementing burst (INCR4)
49
An eight beat wrapping burst (WRAP8)
50
An eight beat incrementing burst
(INCR8) using half-word transfers
51
An undefined length incrementing burst
(INCR)
52
Multi-master AHB-Lite
requires a multi-layer interconnect
• AHB-Lite is single-master
• Multi-master operation
• Must isolate masters
• Each master assigned to layer
• Interconnect arbitrates slave accesses
• Full crossbar switch often
unneeded
• Slaves 1, 2, 3 are shared
• Slaves 4, 5 are local to Master 1
53
Questions?
Comments?
Discussion?
54

More Related Content

Similar to amba.ppt

Introduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM ProcessorIntroduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM Processor
Darling Jemima
 
The presentation is about USART and serial communication
The presentation is about USART and serial communicationThe presentation is about USART and serial communication
The presentation is about USART and serial communication
sinaankhalil
 
Microcontroller part 4
Microcontroller part 4Microcontroller part 4
Microcontroller part 4
Keroles karam khalil
 
Microprocessors-based systems (under graduate course) Lecture 1 of 9
Microprocessors-based systems (under graduate course) Lecture 1 of 9 Microprocessors-based systems (under graduate course) Lecture 1 of 9
Microprocessors-based systems (under graduate course) Lecture 1 of 9
Randa Elanwar
 
Architecture of pentium family
Architecture of pentium familyArchitecture of pentium family
Architecture of pentium family
University of Gujrat, Pakistan
 
Avr microcontroller
Avr microcontrollerAvr microcontroller
Avr microcontroller
Dhananjay Chauhan
 
Avr report
Avr reportAvr report
Avr report
NITISH KUMAR
 
8086 Micro-processor and MDA 8086 Trainer Kit
8086 Micro-processor and MDA 8086 Trainer Kit8086 Micro-processor and MDA 8086 Trainer Kit
8086 Micro-processor and MDA 8086 Trainer Kit
Amit Kumer Podder
 
ARDUINO AND ITS PIN CONFIGURATION
 ARDUINO AND ITS PIN  CONFIGURATION ARDUINO AND ITS PIN  CONFIGURATION
ARDUINO AND ITS PIN CONFIGURATION
soma saikiran
 
2014 ii c08t-sbc pic para ecg
2014 ii c08t-sbc pic para ecg 2014 ii c08t-sbc pic para ecg
2014 ii c08t-sbc pic para ecg
Aland Bravo Vecorena
 
Architecture and pin diagram of 8085
Architecture and pin diagram of 8085Architecture and pin diagram of 8085
Architecture and pin diagram of 8085
Suchismita Paul
 
Presentation
PresentationPresentation
Presentation
Abhijit Das
 
Microprocessor and Application (8085)
Microprocessor and Application (8085)Microprocessor and Application (8085)
Microprocessor and Application (8085)ufaq kk
 
Pentium processor
Pentium processorPentium processor
Pentium processor
Pranjali Deshmukh
 
chapter-4-microprocessor-interfacing.pptx
chapter-4-microprocessor-interfacing.pptxchapter-4-microprocessor-interfacing.pptx
chapter-4-microprocessor-interfacing.pptx
JaypeeFajanil
 
CAAL_CCSU_U1.pdf
CAAL_CCSU_U1.pdfCAAL_CCSU_U1.pdf
CAAL_CCSU_U1.pdf
salabhmehrotra
 
Assembler4
Assembler4Assembler4
Assembler4
Omar Sanchez
 
Introduction of 8086 micro processor .
Introduction of 8086 micro processor .Introduction of 8086 micro processor .
Introduction of 8086 micro processor .
Siraj Ahmed
 
MicroProcessors and MicroControllersUnit3
MicroProcessors and MicroControllersUnit3MicroProcessors and MicroControllersUnit3
MicroProcessors and MicroControllersUnit3
deepakdmaat
 
Training Report on embedded Systems and Robotics
Training Report on embedded  Systems and RoboticsTraining Report on embedded  Systems and Robotics
Training Report on embedded Systems and Robotics
NIT Raipur
 

Similar to amba.ppt (20)

Introduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM ProcessorIntroduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM Processor
 
The presentation is about USART and serial communication
The presentation is about USART and serial communicationThe presentation is about USART and serial communication
The presentation is about USART and serial communication
 
Microcontroller part 4
Microcontroller part 4Microcontroller part 4
Microcontroller part 4
 
Microprocessors-based systems (under graduate course) Lecture 1 of 9
Microprocessors-based systems (under graduate course) Lecture 1 of 9 Microprocessors-based systems (under graduate course) Lecture 1 of 9
Microprocessors-based systems (under graduate course) Lecture 1 of 9
 
Architecture of pentium family
Architecture of pentium familyArchitecture of pentium family
Architecture of pentium family
 
Avr microcontroller
Avr microcontrollerAvr microcontroller
Avr microcontroller
 
Avr report
Avr reportAvr report
Avr report
 
8086 Micro-processor and MDA 8086 Trainer Kit
8086 Micro-processor and MDA 8086 Trainer Kit8086 Micro-processor and MDA 8086 Trainer Kit
8086 Micro-processor and MDA 8086 Trainer Kit
 
ARDUINO AND ITS PIN CONFIGURATION
 ARDUINO AND ITS PIN  CONFIGURATION ARDUINO AND ITS PIN  CONFIGURATION
ARDUINO AND ITS PIN CONFIGURATION
 
2014 ii c08t-sbc pic para ecg
2014 ii c08t-sbc pic para ecg 2014 ii c08t-sbc pic para ecg
2014 ii c08t-sbc pic para ecg
 
Architecture and pin diagram of 8085
Architecture and pin diagram of 8085Architecture and pin diagram of 8085
Architecture and pin diagram of 8085
 
Presentation
PresentationPresentation
Presentation
 
Microprocessor and Application (8085)
Microprocessor and Application (8085)Microprocessor and Application (8085)
Microprocessor and Application (8085)
 
Pentium processor
Pentium processorPentium processor
Pentium processor
 
chapter-4-microprocessor-interfacing.pptx
chapter-4-microprocessor-interfacing.pptxchapter-4-microprocessor-interfacing.pptx
chapter-4-microprocessor-interfacing.pptx
 
CAAL_CCSU_U1.pdf
CAAL_CCSU_U1.pdfCAAL_CCSU_U1.pdf
CAAL_CCSU_U1.pdf
 
Assembler4
Assembler4Assembler4
Assembler4
 
Introduction of 8086 micro processor .
Introduction of 8086 micro processor .Introduction of 8086 micro processor .
Introduction of 8086 micro processor .
 
MicroProcessors and MicroControllersUnit3
MicroProcessors and MicroControllersUnit3MicroProcessors and MicroControllersUnit3
MicroProcessors and MicroControllersUnit3
 
Training Report on embedded Systems and Robotics
Training Report on embedded  Systems and RoboticsTraining Report on embedded  Systems and Robotics
Training Report on embedded Systems and Robotics
 

Recently uploaded

Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
Kamal Acharya
 

Recently uploaded (20)

Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 

amba.ppt

  • 1. 1 EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan AMBA: Advanced Microcontroller Bus Architecture AHB: AMBA High-performance Bus APB: Advanced Peripheral Bus Slides developed in part by Mark Brehob & Prabal Dutta
  • 2. Busses: the glue that connects the pieces 2 Timers Central Processing Unit Software Hardware Internal External System Buses AHB/APB ldr (read) str (write) ISA EECS 370 USART DAC/ADC Internal & External Memory GPIO/INT C Assembly Machine Code Interrupts bl (int)
  • 3. Today… MMIO: Memory-Mapped I/O review AMBA: Advanced Microcontroller Bus Architecture APB: Advanced Peripheral Bus AHB: AMBA High-performance Bus 3
  • 4. Memory-Mapped I/O (MMIO) • I/O model in which the same address bus/space is used to • Do memory accesses (e.g. to RAM) • Do I/O operations (e.g. to I/O pins or peripheral registers) • Reading and writing memory addresses allows us to • Read peripheral state (e.g. value of an I/O pin or FSM’s DFF) • Issue peripheral commands (e.g. set an I/O pin or FSM’s state) • How? • Memory has an address and value • Can equate a pointer to desired address • Can set/get de-referenced value to change memory • Can control peripheral state in this way 4
  • 5. Reading register bits with MMIO • How? • Let’s say that red, green, and blue pushbuttons are mapped to memory address 0xB0000003 at bits 0, 1, and 2, respectively • When pushed, we will read a ‘1’ from the corresponding bit • When released, we will read a ‘0’ from the corresponding bit Address Bit 31 24 23 16 15 8 7 210 0xB0000003 -------- -------- -------- ----- • Must mask (and perhaps shift) to select target bits for reading 5 #define PBS_REG 0xB0000003 int isBlueButtonPressed() { return (*((uint32_t *)PBS_REG) & 0x00000004) >> 2; }
  • 6. Writing register bits with MMIO • How? • Let’s say that red, green, and blue LEDs are mapped to memory address 0xB0000004 at bits 0, 1, and 2, respectively • Writing a ‘1’ (‘0’) to the corresponding bit turns on (off) the LED Address Bit 31 24 23 16 15 8 7 210 0xB0000004 -------- -------- -------- ----- • When updating (set/clear) bits, must preserve remaining contents • Use bitmask to select target bits for manipulation, e.g. 6 #define LED_REG 0xB0000004 void setRedLed() { *((uint32_t *)LED_REG) |= 0x1; } void setGreenLed() { *((uint32_t *)LED_REG) |= 0x2; } #define LED_REG 0xB0000004 void clearRedLed() { *((uint32_t *)LED_REG) &= ~(0x00000001); } void clearBlueLed() { *((uint32_t *)LED_REG) &= ~(0x00000004); }
  • 7. Some useful C keywords • const • Makes variable value or pointer parameter unmodifiable • const foo = 32; • register • Tells compiler to locate variables in a CPU register if possible • register int x; • static • Preserve variable value after its scope ends • Does not go on the stack • static int x; • volatile • Opposite of const • Can be changed in the background • volatile int I; 7
  • 8. Today… MMIO: Memory-Mapped I/O review AMBA: Advanced Microcontroller Bus Architecture APB: Advanced Peripheral Bus AHB: AMBA High-performance Bus 8
  • 9. Advanced Microcontroller Bus Architecture (AMBA) - Advanced/AMBA High-performance Bus (AHB) - Advanced Peripheral Bus (APB) AHB • High performance • Pipelined operation • Burst transfers • Multiple bus masters • Split transactions APB • Low power • Latched address/control • Simple interface • Suitable of many peripherals 9
  • 10. Actel SmartFusion system/bus architecture 10
  • 11. Today… MMIO: Memory-Mapped I/O review AMBA: Advanced Microcontroller Bus Architecture APB: Advanced Peripheral Bus AHB: AMBA High-performance Bus 11
  • 12. APB: a simple bus that is easy to work with • Low-cost • Low-power • Low-complexity • Low-bandwidth • Non-pipelined • Ideal for peripherals 12
  • 14. APB bus state machine • IDLE • Default APB state • SETUP • When transfer required • PSELx is asserted • Only one cycle • ACCESS • PENABLE is asserted • Addr, write, select, and write data remain stable • Stay if PREADY = L • Goto IDLE if PREADY = H and no more data • Goto SETUP is PREADY = H and more data pending 14 Setup phase begins with this rising edge Setup Phase Access Phase
  • 15. APB signal definitions • PCLK: the bus clock source (rising-edge triggered) • PRESETn: the bus (and typically system) reset signal (active low) • PADDR: the APB address bus (can be up to 32-bits wide) • PSELx: the select line for each slave device • PENABLE: indicates the 2nd and subsequent cycles of an APB xfer • PWRITE: indicates transfer direction (Write=H, Read=L) • PWDATA: the write data bus (can be up to 32-bits wide) • PREADY: used to extend a transfer • PRDATA: the read data bus (can be up to 32-bits wide) • PSLVERR: indicates a transfer error (OKAY=L, ERROR=H) 15
  • 16. APB bus signals in action • PCLK • Clock • PADDR • Address on bus • PWRITE • 1=Write, 0=Read • PWDATA • Data written to the I/O device. Supplied by the bus master/processor. 16
  • 17. APB bus signals • PSEL • Asserted if the current bus transaction is targeted to this device • PENABLE • High during entire transaction other than the first cycle. • PREADY • Driven by target. Similar to our #ACK. Indicates if the target is ready to do transaction. Each target has it’s own PREADY 17
  • 18. A write transfer with no wait states 18 Setup phase begins with this rising edge Setup Phase Access Phase
  • 19. A write transfer with wait states 19 Setup phase begins with this rising edge Setup Phase Access Phase Wait State Wait State
  • 20. A read transfer with no wait states 20 Setup phase begins with this rising edge Setup Phase Access Phase
  • 21. A read transfer with wait states 21 Setup phase begins with this rising edge Setup Phase Access Phase Wait State Wait State
  • 22. Example setup •We will assume we have one bus master “CPU” and two slave devices (D1 and D2) • D1 is mapped to 0x00001000-0x0000100F • D2 is mapped to 0x00001010-0x0000101F
  • 23. CPU stores to location 0x00001004 with no stalls 23 D1 D2
  • 24. Writes Let’s do some hardware examples! 24
  • 25. Design a device which writes to a register whenever any address in its range is written 25 32-bit Reg D[31:0] Q[31:0] EN C We are assuming APB only gets lowest 8 bits of address here… What if we want to have the LSB of this register control an LED? PREADY PWDATA[31:0] PWRITE PENABLE PSEL PADDR[7:0] PCLK LED
  • 26. Reg A should be written at address 0x00001000 Reg B should be written at address 0x00001004 26 32-bit Reg A D[31:0] Q[31:0] EN C We are assuming APB only gets lowest 8 bits of address here… 32-bit Reg B D[31:0] Q[31:0] EN C PREADY PWDATA[31:0] PWRITE PENABLE PSEL PADDR[7:0] PCLK
  • 27. Reads… 27 The key thing here is that each slave device has its own read data (PRDATA) bus! Recall that “R” is from the initiator’s viewpoint—the device drives data when read.
  • 28. Let’s say we want a device that provides data from a switch on a read to any address it is assigned. (so returns a 0 or 1) 28 Mr. Switch PWRITE PENABLE PSEL PADDR[7:0] PCLK PREADY PRDATA[32:0]
  • 29. Device provides data from switch A if address 0x00001000 is read from. B if address 0x00001004 is read from 29 Mr. Switch Mrs. Switch PWRITE PENABLE PSEL PADDR[7:0] PCLK PREADY PRDATA[31:0]
  • 30. All reads read from register, all writes write… 30 PWDATA[31:0] PWRITE PENABLE PSEL PADDR[7:0] PCLK PREADY 32-bit Reg D[31:0] Q[31:0] EN C We are assuming APB only gets lowest 8 bits of address here… PREADY PRDATA[31:0]
  • 31. Things left out… • There is another signal, PSLVERR (APB Slave Error) which we can drive high if things go bad. • We’ll just tie that to 0. • PRESETn • Active low system reset signal • (needed for stateful peripherals) • Note that we are assuming that our device need not stall. • We could stall if needed. • I can’t find a limit on how long, but I suspect at some point the processor would generate an error. 31
  • 32. Verilog! 32 /*** APB3 BUS INTERFACE ***/ input PCLK, // clock input PRESERN, // system reset input PSEL, // peripheral select input PENABLE, // distinguishes access phase output wire PREADY, // peripheral ready signal output wire PSLVERR, // error signal input PWRITE, // distinguishes read and write cycles input [31:0] PADDR, // I/O address input wire [31:0] PWDATA, // data from processor to I/O device (32 bits) output reg [31:0] PRDATA, // data to processor from I/O device (32-bits) /*** I/O PORTS DECLARATION ***/ output reg LEDOUT, // port to LED input SW // port to switch ); assign PSLVERR = 0; assign PREADY = 1;
  • 33. Actel/Microsemi implementation of CoreAPB3 33 • ARM APB spec is silent about sharing signals – PSEL, PREADY, PRDATA are shared – Hence, every peripheral needs its own decode logic…which is cumbersome • Actel CoreAPB3 (and other) module(s) help • Allocates per-slave signals – PSEL, PREADY, PRDATA, PSLVERR broken out – CoreAPB3 supports 16 slaves – Performs address decoding for PSEL – De-multiplexes PSEL signal – Multiplexes PREADY, PRDATA, PSLVERR
  • 34. Today… MMIO: Memory-Mapped I/O review AMBA: Advanced Microcontroller Bus Architecture APB: Advanced Peripheral Bus AHB: AMBA High-performance Bus 34
  • 35. AHB-Lite supports single bus master and provides high-bandwidth operation • Burst transfers • Single clock-edge operation • Non-tri-state implementation • Configurable bus width 35
  • 36. AHB-Lite bus master/slave interface • Global signals • HCLK • HRESETn • Master out/slave in • HADDR (address) • HWDATA (write data) • Control • HWRITE • HSIZE • HBURST • HPROT • HTRANS • HMASTLOCK • Slave out/master in • HRDATA (read data) • HREADY • HRESP 36
  • 37. AHB-Lite signal definitions • Global signals • HCLK: the bus clock source (rising-edge triggered) • HRESETn: the bus (and system) reset signal (active low) • Master out/slave in • HADDR[31:0]: the 32-bit system address bus • HWDATA[31:0]: the system write data bus • Control • HWRITE: indicates transfer direction (Write=1, Read=0) • HSIZE[2:0]: indicates size of transfer (byte, halfword, or word) • HBURST[2:0]: indicates single or burst transfer (1, 4, 8, 16 beats) • HPROT[3:0]: provides protection information (e.g. I or D; user or handler) • HTRANS: indicates current transfer type (e.g. idle, busy, nonseq, seq) • HMASTLOCK: indicates a locked (atomic) transfer sequence • Slave out/master in • HRDATA[31:0]: the slave read data bus • HREADY: indicates previous transfer is complete • HRESP: the transfer response (OKAY=0, ERROR=1) 37
  • 38. Key to timing diagram conventions • Timing diagrams • Clock • Stable values • Transitions • High-impedance • Signal conventions • Lower case ‘n’ denote active low (e.g. RESETn) • Prefix ‘H’ denotes AHB • Prefix ‘P’ denotes APB 38
  • 39. Basic read and write transfers with no wait states 39 Pipelined Address & Data Transfer
  • 40. Read transfer with two wait states 40 Two wait states added by slave by asserting HREADY low Valid data produced
  • 41. Write transfer with one wait state 41 One wait state added by slave by asserting HREADY low Valid data held stable
  • 42. Wait states extend the address phase of next transfer 42 One wait state added by slave by asserting HREADY low Address stage of the next transfer is also extended
  • 43. Today… MMIO: Memory-Mapped I/O review AMBA: Advanced Microcontroller Bus Architecture APB: Advanced Peripheral Bus AHB: AMBA High-performance Bus - Low-level details included for completeness - But we’ll skip most of these details 43
  • 44. Transfers can be of four types (HTRANS[1:0]) • IDLE (b00) • No data transfer is required • Slave must OKAY w/o waiting • Slave must ignore IDLE • BUSY (b01) • Insert idle cycles in a burst • Burst will continue afterward • Address/control reflects next transfer in burst • Slave must OKAY w/o waiting • Slave must ignore BUSY • NONSEQ (b10) • Indicates single transfer or first transfer of a burst • Address/control unrelated to prior transfers • SEQ (b11) • Remaining transfers in a burst • Addr = prior addr + transfer size 44
  • 45. A four beat burst with master busy and slave wait 45 One wait state added by slave by asserting HREADY low Master busy indicated by HTRANS[1:0]
  • 46. Controlling the size (width) of a transfer • HSIZE[2:0] encodes the size • The cannot exceed the data bus width (e.g. 32-bits) • HSIZE + HBURST is determines wrapping boundary for wrapping bursts • HSIZE must remain constant throughout a burst transfer 46
  • 47. Controlling the burst beats (length) of a transfer • Burst of 1, 4, 8, 16, and undef • HBURST[2:0] encodes the type • Incremental burst • Wrapping bursts • 4 beats x 4-byte words wrapping • Wraps at 16 byte boundary • E.g. 0x34, 0x38, 0x3c, 0x30,… • Bursts must not cross 1KB address boundaries 47
  • 48. A four beat wrapping burst (WRAP4) 48
  • 49. A four beat incrementing burst (INCR4) 49
  • 50. An eight beat wrapping burst (WRAP8) 50
  • 51. An eight beat incrementing burst (INCR8) using half-word transfers 51
  • 52. An undefined length incrementing burst (INCR) 52
  • 53. Multi-master AHB-Lite requires a multi-layer interconnect • AHB-Lite is single-master • Multi-master operation • Must isolate masters • Each master assigned to layer • Interconnect arbitrates slave accesses • Full crossbar switch often unneeded • Slaves 1, 2, 3 are shared • Slaves 4, 5 are local to Master 1 53