Embedded Lecture 4 ARM
Embedded Lecture 4 ARM
• History:
– Architectural sketch developed in 1983 by Acorn
Computers
• To replace the 8-bit 6502 microprocessor in BBC computers
– The company found in 1990
• Advanced RISC machine(ARM)
• Initially, owned by Acorn, Apple, and VLSI
– E.g., ARM7: ipod
ARM9: BenQ, SonyEriccsion
ARM11: Apple iphone, Nokia
– Till 2010, 90% of embedded applications use ARMs
– Widely, used in low-power battery operated devices
ARM Processors
• A simple RISC-based architecture with powerful design
• Design philosophy:
– small processor with low power
– High code density for limited memory and physical size
restriction
– Can interface with slow and low-cost memory systems
– Reduced die size for processor to accommodate more
peripherals.
ARM Processors
• ARM 7
– 3 pipeline stages (fetch/decode/execute)
– High code density and low power consumption
– Most widely used for low-end system
• ARM9
– Compatible with ARM7
– 5 stages (fetch/decode/execute/memory/write)
– Separate instruction and data cache
• ARM10
– 6 stages (fetch/issue/decode/execute/memory/write)
ARM Family Comparison
ARM7s ARM9s
and olders onwards
AHB
Bus I Data
Memory & Cache Cache
I/O
Bus Interface
AHB
Bus
Memory &
I/O
ARM 7 Architecture
ARM: Pipelining
• Pipelining: overlap execution of several tasks by dividing some
computations into a set of k-sub-computations
• Slight increase in cost but significant speed improvement (Ideally, k)
• Usage:
– Instruction execution:
– Arithmetic computations:
– Memory access:
• Buffer:
– To keep clothe on buffer until the machine accept new cloth
– Similarly, hardware needs latch or registers to between stages for
pipeline instructions
Synchronous k-stage pipelining
Number of Tasks
ARM Pipelines
1 clock cycle
1 clock cycle
ARM 7 Pipelining
Instruction
Time
Stall Cycles in Pipelining
1. ADD
2. STR
Instruction
3. ADD
4. ADD
5. ADD
Time
Pipelining: PC
➢In execution, Program counter is always 8
bytes ahead.
Processor Modes
Registers
• ARM has 37 registers of 32 bit long: 1 PC, 1 current program status
register (CPSR), 5 dedicated saved PSR (SPSR), 30 general purpose
registers (GPRs)
Mode Bits:
10000: User
10001: FIQ
10010: IRQ
10011: Supervisor
10111: Abort
11011: Undefined
11111: System
Program Counter
• Two mode of execution: ARM mode and
Thumb mode
– ARM Mode:
o All instructions are 32 bit wide and must be word aligned
o The last two bits of PC are not used (or zero)
o In pipelining, PC=PC+8 or PC= PC+12 in case of register
specified shift
Comparison Instructions:
• Multiply-Accumulate Instruction:
MLA r1,r2,r3,r4 ; r1=(r2 X r3+r4) [31:0]
Then,
LDR r0, [r1]; r0=mem[r1]
STR r0, [r1]; mem[r1]=r0
➢ No stack in ARM. Hence, LTM and STM can be used to implement software stack
Reducing the number of loops in ARM instructions:
r10
I/O Port
Data
Data/memory
Address
Address
Decoder
I/O Port
.
.
Select Lines
I/O Port
➢ No separate instruction for I/O, uses same select line for data memory, i/o, though
there are different specific addresses
Control Flow Instructions:
• These instructions change the execution flow of
PC instead of direct increment, PC=PC+4;
L
– Conditional Branch:
• Instructions:
– BEQ, BNE: Equal or not equal to zero
– BPL, PMI: Result positive or negative
– BCC, BCS: Carry set or clear
– BVC, BVS: Overflow set or clear
– BGT, BGE: Greater than, greater or equal
– BLT, BLE: Less than, less or equal
– Branch and Link:
• Used for subroutines in ARM
• The return address (current value in PC) is saved in r14
(link register)
• After returning from subroutine, jump to value in r14
• Similar, postfixs:
Pulse Width Modulation (PWM)
– It is a control mechanism an analog variable through
a rectangular digital signal.
– On-off behavior in PWM changes average power of
1 𝑇
the signal i.e., 𝑇 0 𝑓 𝑡 𝑑𝑡 = 𝑡𝑂𝑁 . 𝑉𝐻 + (1 − 𝑡𝑂𝑁 ) 𝑉𝐿
0
• Types of DAC
– Weighted register:
• Easier to implement
• Issues
– Resistive ladder
• More practical and easier to understand
• Complex circuitry
Weighted register type DAC
• For n-bit DAC, it has values of resistor values in magnitude of R, 2R,
4R, …. 2𝑛 -1R.
• The current produced by these resistors is inversely proportional.
• Finally, op-amp adds all current and converts to voltage at the
output.
To-Opamp as
voltage follower