Professional Documents
Culture Documents
CPU + Memory + IO
Topics
➢ CPU
– Architecture: CISC / RISC
– ARM Cortex M0+ Programming Model
➢ Memory
– Memory Types: ROM / RAM
– Memory Organization and Addressing
A CPU includes:
1. The ALU
Performs arithmetic and logic operations.
2. Registers
– General purpose registers:
Hold operands to operate on.
– Special purpose registers:
Each of these register has a function such as the
Program Counter & the Stack Pointer
ARM Cortex-M processors adopt Harvard architecture. It has separate data and instruction buses.
• Instructions are fetched from flash ROM using the ICode bus
• Data are exchanged with RAM and I/O via the system bus.
Some internal peripherals, like the NVIC, communicate directly with the processor via the private peripheral
bus (PPB) to provide fast interrupt handling.
CPU Architecture Types
RISC CISC
Memory is referenced only through LOAD & STORE Can do arithmetic & logical operations with operands in
instructions (Load-Store architecture) memory (Definitely through some inaccessible CPU registers)
To do an operation with an operand in memory
7
HC12 Programming Model
CISC Example
HC12 Core Registers
Types of NVM:
―ROM: Read only memory. This term is usually used to refer to devices programmed by the manufacturer.
―PROM: Programmable read only memory. Programmed once by the user with special hardware.
―EPROM: Erasable programmable read only memory. Erased as a whole with ultra violet light, and
reprogrammed with special hardware.
―EEPROM: Like EPROM but it is erasable and reprogrammable by electrical signal, (no UV).
It can be reprogrammed on board one word at a time. Holds constants.
―FLASH: A type of EEPROM that can be erased and programmed in sectors (blocks). Used to hold the code
(program and constants)
➢ New technologies for NVM are still emerging; suitable for big data applications.
Memory Organization
➢ Memory is usually byte-organized (byte-addressable)
↪ Each byte in memory has a distinct address.
The maximum addressable memory size is 2𝑁𝐴 bytes
The memory is interfaced to the CPU through:
• The first location address is 0
• Address bus (𝑁𝐴 bits)
• The last location address is 2𝑁𝐴 − 1
• Data bus (𝑁𝐷 bits)
10-bit address bits can address 2𝑁𝐴 = 1024 i.e.,1k
• Control signals (Read/Write, Wait …) of memory.
A 64k memory needs 16-bit address.
The CPU can read/write multiple bytes, two-byte or four-byte words,
in a single read/write in accordance with the data bus size 𝑁𝐷 .
Example:
A 4-byte read from address 0x1000 through a 4-byte data bus
retrieves four bytes from locations
0x1000
0x1001
0x1002
0x1003
Input/Output Addressing
Memory-Mapped IO Isolated (Port-Mapped) IO
➢ The CPU uses the memory reference instructions, ➢ The CPU instruction set has distinct IN and OUT
LOAD and STORE, to do input and output instructions to do input and output operations, as in
operations. the intel processors
➢ IO port addresses do not overlap with memory ➢ IO port addresses can overlap with memory locations
locations addresses. addresses.
➢ IO ports have separate addresses.
➢ Used in ARM processors. ➢ Used in intel x86, i5 and i7 line of processors.
➢ The same MemRead and MemWrite signals on ➢ The control bus has a signal that
the control bus used in memory reference cycles differentiate I/O cycles from memory cycles.
are also used to reference IO ports as well. = 0 when executing a memory ref. instruction
= 1 when executing an IN or OUT instruction
Memory-Mapped I/O
R/𝐖 Operation Instruction
Memory Write ST reg, mem
0 or Output
Memory Read LD reg, mem
1 or Input
Memory
ഥ
R/W
I/O
Memory
I/O