CPU Architecture
• There are two basic types of architecture:1.Von Neumann
• Has a single, common memory space where both program instructions and data are stored.
• It must wait until these subsequent operations are complete before it can fetch and decode the next program instruction.
• The advantage: simplicity and economy
2.Harvard (Microcontrollers most often use a Harvard)
• Have separate memory areas for program memory and data.
• The CPU fetches instructions on the program memory bus.
If the fetched instruction requires an operation on data memory, the CPU can fetch the next program instruction while it uses the data bus for its data operation. This speeds up execution time
Instruction Set Architecture (ISA)
1- Complex Instruction Set Computing (CISC)- Small number of general purpose registers
- Variable size instruction words
- Instructions are complex (i.e. do more than one specific thing)
2- Reduced Instruction Set Computing (RISC)
- Large and uniform register file
- Fixed size instruction words
- Instruction simplicity
What is function of CPU?
CPU does all the computing:- Fetches, decodes and executes program instructions and
directs the flow of data to and from memory
- Performs the calculations required by program instructions and places the results of these calculations, if required, into memory space
CPU = ALU + Decoder + Sequencer + Registers
ALU
• Responsible for calculations and executing instructions
Decoder
• Converts instructions stored in program memory into codes which the ALU can
understand
Sequencer
• Manages the flow of the data along the microcontroller data bus
Registers
• Used by the CPU to temporarily store the data which are volatile and could be changed during program execution
• Some of the most common registers in Microcontrollers:
o The stack pointer (SP)
• Contains the address of the next location on the stack
• The address in the stack pointer is decremented when data is pushed on
the stack and incremented when data is popped from the stack
o The program counter (PC)
• holds the address of the next instruction in program memory space
o The accumulator
• Hold operands or results of operations as necessary
o The status register (SREG)
• Contains flags represent the status of the last operation to control the next instruction to be executed
• Flags are:Overflow flag, Negative flag, Zero flag, Carry flag, Half-carry flag and Global Interrupt mask
No comments:
Post a Comment