Microsoft PowerPoint – Week 6 2021
Week 6
Outline
• Finish up Week 5 (Sequential Circuits):
• Analysing sequential circuits
• Mid‐sem review
• Introduction to computer architecture
Reminder: Timing Diagrams
What are different types of latches/FFs?
• https://canvas.sydney.edu.au/courses/35882/pages/5‐dot‐2‐flip‐
flops?module_item_id=1278358
Activity 1/2
Registers
• What are registers?
Activity 3
Analysing sequential circuits
• Assume combinational circuit with latch/FF
• How do we determine outputs?
Analysing sequential circuits
• Assume combinational circuit with latch/FF
• How do we determine outputs?
• Example:
• D‐latch vs DFF with NAND x input and itself
Activity 4
FSMs
• Tool to capture sequence of states
• Enables immediate translation to hardware
• Easiest to understand by example
• Consider a door.
• Three sensors: Person detected, door fully open/shut
• Combine fully open/fully shut signals into single sensor.
Activity 5
Mid‐sem review
• Encoding & Numbers:
• How do we encode sequences in a range, how many bits do we need
• What are different bases, what are their properties
• What are different number systems
• How do each represent values
• What ranges of inputs can you describe
• What are the errors associated with different number systems
Mid‐sem review
• Memory
• Given a memory, what is the relationship between total size, number of bytes
per cell, number of cells, number of address bits
• How many bits are used to store a Java/C array?
• How many bits are used to store a pointer to a Java/C array
• What is the difference between big and little‐endian
• What happens when you read/write to memory
• What is the relationship between memory that encodes address and data
Mid‐sem review
• Boolean algebra
• Understand basic Boolean expressions, when do they evaluate to 1
• Be able to complete truth‐tables for basic Boolean algebra expressions
• Digital logic:
• Be able to determine the output of simple digital circuits
• And convert to simple Boolean expressions
Mid‐sem review
• Sequential circuits
• Understand the different types of latches/flip-flops
• (level/edge/JK/RS/D)
• Work out how the output changes for a circuit with logic & gates on
the clock edge
• Understand how data passes through registers given a clock signal
• Understand basic FSM transitions
• And how you can translate this to gates.
Computer Architecture
Course plan
• First half (we’ve completed this):
• Basic digital system concepts.
• Encoding/number systems
• Combinational logic
• Sequential Logic
• Basic General Computer Concepts
• Memory
• Higher level computer architecture:
• Understand structure of computer system
• Gain ability to program any architecture
• Need to be confident with assembly
• Understand connection with programming language
• Arbitrarily chose AVR
Why AVR?
• AVR architecture is what you use for your robot
• (In arduino)
Stuff to consider
• We consider AVR design decisions
• Not same for all processors
• Reasons?
Stuff to consider
• We consider AVR design decisions
• Not same for all processors
• Reasons?
• Size
• Power
• Performance
Stuff to consider
• We consider AVR design decisions
• Not same for all processors
• Reasons?
• Size
• Power
• Performance
• Mistakes!
Details on AVR
• Detailed instruction set:
• http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega48A‐PA‐88A‐
PA‐168A‐PA‐328‐P‐DS‐DS40002061A.pdf
• (~700 pages)
• (Can be thousands for complex processors)
• Don’t memorise. Learn how to understand
• We study a subset of instructions
• Lots are similar between different processors
• (especially in similar class. ARM/Imagination)
Outline
• Understand AVR architecture
• Understand AVR Execution Cycle
• Pipelining
• Understand the Stack
Notes away. Get a blank sheet of
paper.
Draw me a microprocessor
Draw me a microprocessor
AVR Microprocessor walk through
Program memory
• What does it do?
• What operations does it perform?
• What are it’s properties?
Program memory
• What does it do?
• Store instructions
• What operations does it perform?
• Read /write
• What are it’s properties?
• Each cell is ?‐bit.
• Read/write is always ? bits
• Different to data memory
• 32KB memory. How many address bits?
Program memory
• What does it do?
• Store instructions
• What operations does it perform?
• Read /write
• What are it’s properties?
• Each cell is ?‐bit.
• Read/write is always ? bits
• Different to data memory
• 32KB memory. How many address bits?
• 2^15=32768
• 2 byte cells.
• Need address for each cell, not each byte => 2^14 ‐> 14 into PC
Program counter
• What is it?
• What type of digital circuit is it?
Program counter
• What does it do?
• (Think it’s like your finger holding a book open)
• Stores address of next instruction
• Increments when move to next instruction
• How much to increment by? +1, +2 (instructions are 16 bits)
• What type of digital circuit is it?
• Register
• Adder (conditional)
• Multiplexer
Register File
• What is it?
• What digital circuit is this?
Register File
• What is it?
• Tiny, local memory
• Temporary storage
• What digital circuit is this?
• 32 8‐bit Registers (r0 to r31)
Register File
• What are X,Y,Z?
Register File
• What are X,Y,Z?
• A design decision
• Enable 26,27 (x), 28,29 (y), 30,31 (z) to be 16‐bit manipulations
• Why?
• Useful for certain instructions
• Ld R2 X
Register File
• How many bits do you need to encode a register?
ALU
• What does it do?
• Calculations
• Add/Sub/Conjunction/Negation…
• How many bits can it add?
ALU
• What does it do?
ALU
• What does it do?
• Calculations
• Add/Sub/Conjunction/Negation…
• How many bits can it add?
• Tied to a register
Status Register
• What does it do?
Status Register
• What does it do?
Status Register
• What does it do?
• Stores flags of special conditions
• Zero/overflow
Status Register
• What does it do?
• Stores flags of special conditions
• Zero/overflow
• What does it listen to?
• How does it store info?
Status Register
• What does it do?
• Stores flags of special conditions
• Zero/overflow
• What does it listen to?
• ALU
• How does it store info?
• Enable signal.
Data memory
• What does it do?
• Does it store instructions?
• 2KB. How many address bits?
Data memory
• What does it do?
• Stores integers Arrays…
• Does it store instructions?
• No.
• 2KB. How many address bits?
• Needs 11.
• Actually has 12
• Pretend larger memory
• Gives 256 additional fake address
• Allows some faster operations.
Instruction register
• What does it do?
Instruction register
• What does it do?
• Remembers current instruction
Instruction register
• What does it do?
• Remembers current instruction
• Why 16 bit?
Instruction register
• What does it do?
• Remembers current instruction
• Why 16 bit?
• Most instructions need 16 bits.
Instruction decoder
• What does it do?
Instruction decoder
• What does it do
• Open instruction, decide what to do
• Controls rest of circuit
• Operation: Adding/subtracting
• Operands
• Where to write result
Instruction decoder
• Is it combinational/sequential circuit?
Instruction decoder
• Is it combinational/sequential circuit?
• You need to do different things at different times
Execution cycle
• Say I want to do the instruction:
• Add R0,R1
• What happens?
• What goes first?
Activity 1
Pipelining
• Analogous to assembly line
Two stage pipeline
Activity 2
Long instructions
Stack
• What is the stack?
Stack
• What is the stack?
• Area in data memory
• Special position: stack pointer
• Top of stack
Push operation
• Read or write?
Push operation
• Increase or decrease stack pointer?
Push operation
• Increase or decrease stack pointer?
Pop
• Get data
• Take off stack
Stack
• push r1
• push r2
• push r3
• Do some other work with r1 to r3
• How do you get data back into r1 to r3?
Activity 3
Revision challenges
Design an adder
• https://canvas.sydney.edu.au/courses/17907/pages/4‐dot‐5‐14‐
design‐an‐adder
FSM from wk 5
• https://canvas.sydney.edu.au/courses/17907/pages/week‐
5?module_item_id=577686