Anization
Anization
●
Compiler converts a=b+c into a list of tasks
the processor can accomplish
Instruction Tasks
aa == bb ++ c;
c;
●
Compiler converts a=b+c into a list of tasks the
processor can accomplish
●
Inputs: b and c. Output: a. Operation: addition.
Instruction Tasks
aa == bb ++ c;
c;
●
Compiler converts a=b+c into a list of tasks the
processor can accomplish
●
Inputs: b and c. Output: a. Operation: addition.
●
Addition operations is performed in the
Processor
– Arithmetic and Logic Unit
Instruction Tasks
aa == bb ++ c;
c;
●
Compiler converts a=b+c into a list of tasks the
processor can accomplish
●
Inputs: b and c. Output: a. Operation: addition.
●
Addition operations is performed in the Processor
– Arithmetic and Logic Unit
●
a, b, and c are in the Memory
– Assume: they have to be inside the processor for
addition to begin
Minor
MinorDetour
Detour--
Memory
Memory
The Program in Memory
Simplified View
Last Byte
DATA
DATA
INSTRUCTIONS
INSTRUCTIONS
Byte 0
The Program in Memory
Simplified View
DATA
DATA
a b c
INSTRUCTIONS
INSTRUCTIONS
PROCESSOR
PROCESSOR MEMORY
MEMORY
Interconnect
Interconnect
I/O
I/ODevices
Devices I/O
I/ODevices
Devices I/O
I/ODevices
Devices
Instruction Tasks
aa == bb ++ c;
c;
PROCESSOR MEMORY
Interconnect
Interconnect
1
Instruction Tasks
aa == bb ++ c;
c;
PROCESSOR MEMORY
(1)
Interconnect
Interconnect
PROCESSOR MEMORY
(1) (2)
PROCESSOR MEMORY
(1) (2)
PROCESSOR MEMORY
(1) (2)
b
c
+ b+c MEMORY
b+c
+ MEMORY
●
Load value from memory location b
●
Load value from memory location c
●
Add these values
●
Store sum into memory location ‘a’
Load
Loadand
andStore
Storeare
arememory
memorytransfer
transferoperations.
operations.
Add
Addisisan
anALU
ALUoperation
operation
Instruction Tasks
Load
Load bb
Load
Load cc
aa == bb ++ c;
c;
Add
Add
Store
Store aa
●
Load value from memory location b
●
Load value from memory location c
●
Add these values
●
Store sum into memory location ‘a’
Instruction Tasks
aa == bb ++ c;
c;
dd == bb ++ cc ++ a;
a;
ff == dd ++ aa ++ e;
e;
●
List the fundamental tasks.
●
Observations?
●
Can you improve on the design?
Instruction Tasks
aa == bb ++ c;
c;
dd == bb ++ cc ++ a;
a;
ff == dd ++ aa ++ e;
e;
●
Loads are repeated – b, c, a.
●
Store and Load pairs – a, d.
Instruction Tasks
aa == bb ++ c;
c;
dd == bb ++ cc ++ a;
a;
ff == dd ++ aa ++ e;
e;
●
Loads are repeated – b, c, a.
●
Store and Load pairs – a, d.
●
Eliminate repetitive/redundant operations
– Store intermediate results
– Register File (RF)
x0
x1
Register File ...
x31
●
Fast storage for quick access by the processor
x0
x1
Register File ...
x31
●
Fast storage for quick access by the processor
●
Small number of data elements Eg. 32.
●
Accessed as registers x0, x1, x2, … x31.
x0
x1
Register File ...
x31
●
Fast storage for quick access by the processor
●
Small number of data elements Eg. 32.
●
Accessed as registers x0, x1, x2, … x31.
●
“load from memory into the processor” = “fetch
data from memory and write into Register File”
x0
x1
Register File ...
x31
●
Fast storage for quick access by the processor
●
Small number of data elements Eg. 32.
●
Accessed as registers x0, x1, x2, … x31.
●
“load from memory into the processor” = “fetch
data from memory and write into Register File”
●
Loaded values go in the RF; Results of
computations go into the RF; Values from RF
can be stored into memory
Instruction Tasks
Load x1, b
Load x2, c
aa == bb ++ c;
c; Add x3, x1, x2
Store x3, a
Instruction Tasks
Load x1, b
Load x2, c
aa == bb ++ c;
c; Add x3, x1, x2
Store x3, a
●
Load value from memory location b into x1
●
Load value from from memory location c into x2
●
Add contents of x1 and x2 and save the sum into
x3
●
Store contents of x3 into memory location ‘a’
The Computer System
+ RF
MEMORY
MEMORY
ALU
Interconnect
Interconnect
I/O
I/ODevices
Devices I/O
I/ODevices
Devices I/O
I/ODevices
Devices
Assembly Level Language
●
Expression of high level language statements as
their fundamental tasks
Assembly Level Language
●
Expression of high level language statements as
their fundamental tasks
●
1-to-1 mapping to the binary code
Assembly Level Language
●
Expression of high level language statements as
their fundamental tasks
●
1-to-1 mapping to the binary code
●
ISA – list of instructions implemented in the
processor
Assembly Level Language
●
Expression of high level language statements as
their fundamental tasks
●
1-to-1 mapping to the binary code
●
ISA – list of instructions implemented in the
processor
●
Specific to a processor
Assembly Level Language
Assembly Level
High Level Language Statements Binary Code
Language
Statement Load
Loadx1,
x1,bb 10010111000011110000111100001111
10010111000011110000111100001111
Load
Loadx2,
x2,cc 01100011001001001111110000111001
01100011001001001111110000111001
aa==bb++c;
c; 00100100110110011000111100001111
Add
Addx3,
x3,x1,
x1,x2
x2 00100100110110011000111100001111
Store 01001100110000111100010110010111
Storex3,
x3,aa 01001100110000111100010110010111
Instruction Set Architecture
●
Also called “Architecture”
●
Informally, a list of capabilities of the processor
Instruction Set Architecture
●
Also called “Architecture”
●
Informally, a list of capabilities of the processor
– What operations are supported by this processor?
Instruction Set Architecture
●
Also called “Architecture”
●
Informally, a list of capabilities of the processor
– What operations are supported by this processor?
– What kind of data does the operation act on?
Instruction Set Architecture
●
Also called “Architecture”
●
Informally, a list of capabilities of the processor
– What operations are supported by this processor?
– What kind of data does the operation act on?
– Where does the data for the operation come from?
Instruction Set Architecture
●
Also called “Architecture”
●
Informally, a list of capabilities of the processor
– What operations are supported by this processor?
– What kind of data does the operation act on?
– Where does the data for the operation come from?
– Which types of data are valid for an operation.
Instruction Set Architecture
●
Also called “Architecture”
●
Defines instructions (operations) the processor
implements (supports)
●
Input operands – number, size, type
●
Input from Memory or from Registers
●
Data Representation – Types/Sizes
ADD x3, x2, x1
ADD x3, x2, x1
●
Operation: ADD. Input operands: x1, x2. Output
Operand: x3
ADD x3, x2, x1
●
Operation: ADD. Input operands: x1, x2. Output
Operand: x3.
●
Both input operands are 32b signed integers (x1
and x2)
– vs. ADDU, ADDI
ADD x3, x2, x1
●
Operation: ADD. Input operands: x1, x2. Output
Operand: x3.
●
Both input operands are 32b signed integers (x1
and x2)
– vs. ADDU, ADDI
●
Both input operands come from the Register File
ADD x3, x2, x1
●
Operation: ADD. Input operands: x1, x2. Output
Operand: x3.
●
Both input operands are 32b signed integers (x1
and x2)
●
Both input operands come from the Register File
●
Processor contains hardware to feed the ALU
from the RF
ADD x3, x2, x1
●
Operation: ADD. Input operands: x1, x2. Output
Operand: x3.
●
Both input operands are 32b signed integers (x1
and x2)
●
Both input operands come from the Register File
●
Processor contains hardware to feed the ALU
from the RF
●
ALU contains hardware to add two numbers
(Adder)
ADD x3, x2, x1
●
Operation: ADD. Input operands: x1, x2. Output
Operand: x3.
●
Both input operands are 32b signed integers (x1
and x2)
●
Both input operands come from the Register File
●
Processor contains hardware to feed the ALU from
the RF
●
ALU contains hardware to add two numbers (Adder)
●
Processor contains hardware to connect the ALU to
update the RF with the result
Organization
●
Also called Microarchitecture
Organization
●
Also called Microarchitecture
●
Several Adder circuits exist
– Each with different gate counts and costs
Organization
●
Also called Microarchitecture
●
Several Adder circuits exist
– Each with different gate counts and costs
●
Choosing one adder that fits the space and cost
constraints is an organization challenge
Organization
●
Also called Microarchitecture
●
Several Adder circuits exist
– Each with different gate counts and costs
●
Choosing one adder that fits the space and cost
constraints is an organization challenge
●
Informally, Organization is the way a given ISA is
implemented in hardware on a processor
Organization
●
Also called Microarchitecture
●
Several Adder circuits exist
– Each with different gate counts and costs
●
Choosing one adder that fits the space and cost
constraints is an organization challenge
●
Informally, Organization is the way a given ISA is
implemented in hardware on a processor
●
Architecture describes what the computer does
and organization describes how it does it.
Same Architecture, Different Microarchitectures
●
AMD Athlon II X4 ●
Intel Atom
– –
Application
Physics
The Compute Stack
Application
Physics
The Compute Stack
Application
Algorithm
Physics
The Compute Stack
Application
Algorithm
Programming Language
Physics
The Compute Stack
Application
Algorithm
Programming Language
Operating System/Virtual Machines
Physics
The Compute Stack
Application
Algorithm
Programming Language
Operating System/Virtual Machines
Devices
Physics
The Compute Stack
Application
Algorithm
Programming Language
Operating System/Virtual Machines
Circuits
Devices
Physics
The Compute Stack
Application
Algorithm
Programming Language
Operating System/Virtual Machines
Gates
Circuits
Devices
Physics
The Compute Stack
Application
Algorithm
Programming Language
Operating System/Virtual Machines
Instruction Set Architecture
Organization/Microarchitecture
Register-Transfer Level
Gates
Circuits
Devices
Physics
Memory Detour