Microcontrollers
Move away from a special purpose digital circuit
-
Circuit should execute a fixed number of general-purpose instructions
-
How do we design a general purpose digital circuit?
-
How do we decide what instructions to allow?
-
How do we implement it?
Overall Architecture of a microcontroller/microprocess
-
Control Unit
-
State machine that specifies how the CPU is to carry out specific instructions
-
Execution is controlled by a set of control registers and the program instructions
-
Can have microcoded instructions where the control unit is it's own state machine
-
Can use a hardwired design where the instruction contains all of the commands
-
Two important questions the control unit must answer
-
What are the operands for this instruction?
-
What is the operation that is supposed to happen?
-
Where does the operand go when its finished?
-
Where does the next instruction come from?
-
ALU
-
Executes addition, logical operations, increment and decrement
-
Combinational circuit controlled by the CU
-
Internal Memory / register file
-
register file that allows temporary data storage
-
Sequential register file controlled by the CU
-
I/O interface
-
How the microprocessor/microcontroller communicates with the external world
-
Sequential/combinational circuit controlled by CU
-
Internal bus
-
How data is moved around internally between registers, ALU, I/O channels
-
A set of wires connected through buffers and latches, controlled by the CU
Control-Unit: Fetch-Execute Cycle
-
Fetch the instruction
-
Increment the program counter / load from the stack / do nothing
-
Send the instruction's address to memory so that it appears on the memory output lines
-
At the beginning of the execute cycle, latch the address into the instruction register
-
Decode the instruction
-
Read the data/operand
-
Process the data
-
Write the data