- Central Processing Unit (CPU)
- Contains arithmetic circuits, the called Arithmetic Logic Unit (ALU)
- Executes instructions
- Memory
- Holds the program(s)
- Holds data program(s) operate on
- Input Port(s)
- Output Port(s)
- All ports are 8-bits wide
Memory Types
There are two types of memory:
- Read/Write
- typically this memory is volatile — must keep power applied to memory chip in order for it to keep its state
- Two types:
- Static Random Access Memory (SRAM) — found on the ATmega32
- Uses a flip-flop to store state
- Dynamic Random Access Memory (DRAM) — found on
- Uses capacitor to store state
- Must refresh memory state frequently or capacitor will lose its charge
- Can get in high density
- Static Random Access Memory (SRAM) — found on the ATmega32
- Read Only Memory (ROM)
- typically this memory is non-volatile — keeps its state even without power
- FLASH
- EEPROM — Electrically Erasable Programable Read Only Memory
- Actually can write to it, but writing is very slow compared to reading
The ATmega32 uses SRAM for data and FLASH memory for the program
- This is know as the Harvard Architecture which is used by many modern processors
- This means that your program will still be there the next time you turn your board on, it will run your program (but all data will be lost)
- The Harvard architecture is safer because it prevents the program from overwriting itself and then executing the data
SRAM
- Allows storage of 1's and 0's
- The data is stored in groups of 8 bits per location
- Memory is organized as an array
- Each location has a unique address
- The ATmega32 has 2KiB (2048 bytes)
- We could represent each unique address with 11 bits, but the ATmega32 uses 16 bit address
- 0x60 is the first available address of SRAM
- 0x85F is the the last available address of SRAM
FLASH
- Also stores 1's and 0's
- The data is stored in groups of 16 bits per location
- Memory is organized as an array
- Each location has a unique address
- The ATmega32 has 32KiB (32768 bytes)
- Often 32KiB is referred to as 32KB, but as of November 2000, the correct prefixes for binary multiples are kibibytes (KiB), mebibytes (MiB), gibibytes (GiB), etc.
- Since each location is 16 bits, we have 32768/2 = 16384 locations
- We would need 14 bits to represent each unique address, since 214 = 16384
Programmable Registers
- ATmega32 has 32 registers
- The registers are each 8 bits wide
- They are located at r0 through r31
- The registers are located in SRAM at addresses 0x00 through 0x1F