Professional Documents
Culture Documents
and Architecture
intmain(){
intmain(){
inti,a=2,b=3,sum=0;
inti,a=2,b=3,sum=0;
sum=a+b;
sum=a+b;
}}
What
Whatthe
the
Programmer
Programmersees.
sees.
What does the hardware see?
intmain(){
intmain(){
inti,a=2,b=3,sum=0;
inti,a=2,b=3,sum=0;
sum=a+b;
sum=a+b;
}}
What
Whatthe
the
Programmer
Programmersees.
sees.
Compiler
Compiler
What does the hardware see?
Binary
BinaryCode
Code
intmain(){
intmain(){
inti,a=2,b=3,sum=0;
inti,a=2,b=3,sum=0;
sum=a+b;
sum=a+b;
}}
What
Whatthe
the
Programmer
Programmersees.
sees.
What
Whatthe
the
Machine
Machinesees.
sees.
Compiler
Compiler
What does the hardware see?
Binary
BinaryCode
Code
What
Whatdoes
doesthe
thebinary
binarycode
code
(a.out)
(a.out)contain?
contain?
What happens when do
What happens when do
$./a.out
$./a.out
The Program
intmain(){
intmain(){ Start
Starthere!
here!
inta=2,b=3,sum=0;
inta=2,b=3,sum=0;
sum=a+b;
sum=a+b;
}}
The Program
intmain(){
intmain(){
inta=2,b=3,sum=0; Allocate
Allocatespace
spaceinin
inta=2,b=3,sum=0; memory
memoryforforthese
thesedata!
data!
sum=a+b;
sum=a+b;
}}
The Program
intmain(){
intmain(){
inta=2,b=3,sum=0;
inta=2,b=3,sum=0;
sum=a+b; Add
Addaaand
andbband
andstore
store
sum=a+b;
the
theresult
resultin
inc.
c.
}}
The Program
intmain(){
intmain(){
inta=2,b=3,sum=0;
inta=2,b=3,sum=0;
sum=a+b;
sum=a+b;
}} Exit
Exitthe
theprogram!
program!
What goes on under the hood?
intmain(){
intmain(){
inta=2,b=3,sum=0;
inta=2,b=3,sum=0;
sum=a+b;
sum=a+b; Add
Addaaand
andbband
andstore
store
sum=a+b;
sum=a+b;
the
theresult
resultin
inc.
c.
}}
What goes on under the hood?
intmain(){
intmain(){
inta=2,b=3,sum=0;
inta=2,b=3,sum=0;
sum=a+b;
sum=a+b; Add
Addaaand
andbband
andstore
store
sum=a+b;
sum=a+b;
the
theresult
resultin
inc.
c.
}}
PROCESSOR MEMORY
Programs and
All the work is Data reside here
done here
What goes on under the hood?
aa bb cc
PROCESSOR
PROCESSOR MEMORY
MEMORY
intmain(){
intmain(){
inta=2,b=3,sum=0;
inta=2,b=3,sum=0;
sum=a+b;
sum=a+b; Add
Addaaand
andbband
andstore
store
sum=a+b;
sum=a+b;
the result in c.
the result in c.
}}
What goes on under the hood?
00 aa bb cc
ALU
ALU
MEMORY
MEMORY
PROCESSOR
PROCESSOR
intmain(){
intmain(){
inta=2,b=3,sum=0;
inta=2,b=3,sum=0;
sum=a+b;
sum=a+b; Add
Addaaand
andbband
andstore
store
sum=a+b;
sum=a+b;
the result in c.
the result in c.
}}
What goes on under the hood?
11 aa bb cc
ALU
ALU aa bb
Load MEMORY
Loada,
a,bb MEMORY
PROCESSOR
PROCESSOR
intmain(){
intmain(){
inta=2,b=3,sum=0;
inta=2,b=3,sum=0;
sum=a+b;
sum=a+b; Add
Addaaand
andbband
andstore
store
sum=a+b;
sum=a+b;
the result in c.
the result in c.
}}
What goes on under the hood?
11 aa bb cc
ALU
ALU
MEMORY
MEMORY
aa bb
PROCESSOR
PROCESSOR
intmain(){
intmain(){
inta=2,b=3,sum=0;
inta=2,b=3,sum=0;
sum=a+b;
sum=a+b; Add
Addaaand
andbband
andstore
store
sum=a+b;
sum=a+b;
the result in c.
the result in c.
}}
What goes on under the hood?
22 aa bb cc
aaALU
bb
ALU
MEMORY
MEMORY
Feed
Feeda,
a,bb aa bb
to
toALU
ALU
PROCESSOR
PROCESSOR
intmain(){
intmain(){
inta=2,b=3,sum=0;
inta=2,b=3,sum=0;
sum=a+b;
sum=a+b; Add
Addaaand
andbband
andstore
store
sum=a+b;
sum=a+b;
the result in c.
the result in c.
}}
What goes on under the hood?
22 aa bb cc
bb ++
aaALU
ALU
MEMORY
MEMORY
Addition
Addition aa bb
in
inALU
ALU
PROCESSOR
PROCESSOR
intmain(){
intmain(){
inta=2,b=3,sum=0;
inta=2,b=3,sum=0;
sum=a+b;
sum=a+b; Add
Addaaand
andbband
andstore
store
sum=a+b;
sum=a+b;
the result in c.
the result in c.
}}
What goes on under the hood?
22 aa bb cc
aALU
aALU
bb
Add MEMORY
MEMORY
Adda, a,b.
b. aa bb a+b
a+b
Write
Writea+b.
a+b.
PROCESSOR
PROCESSOR
intmain(){
intmain(){
inta=2,b=3,sum=0;
inta=2,b=3,sum=0;
sum=a+b;
sum=a+b; Add
Addaaand
andbband
andstore
store
sum=a+b;
sum=a+b;
the result in c.
the result in c.
}}
What goes on under the hood?
33 aa bb a+b
a+b
ALU a+b
a+b
ALU
MEMORY
MEMORY
Store
Storea+b
a+binin aa bb a+b
a+b
memory
memory inc
in c
PROCESSOR
PROCESSOR
intmain(){
intmain(){
inta=2,b=3,sum=0;
inta=2,b=3,sum=0;
sum=a+b;
sum=a+b; Add
Addaaand
andbband
andstore
store
sum=a+b;
sum=a+b;
the result in c.
the result in c.
}}
What goes on under the hood?
intmain(){
intmain(){
inta=2,b=3,sum=0;
inta=2,b=3,sum=0;
sum=a+b;
sum=a+b; Add
Addaaand
andbband
andstore
store
sum=a+b;
sum=a+b;
the
theresult
resultin
inc.
c.
}}
Variables
Variablesmemory
memorylocations
locations
Load the values from memory into the processor
Load the values from memory into the processor
intcalculate_sum(inta[],inti){
intcalculate_sum(inta[],inti){
intsum=0;
intsum=0;
i=0;
i=0;
for(i=0;i<5;i++)
for(i=0;i<5;i++)
sum=sum+a[i];
sum=sum+a[i];
returnsum;
returnsum;
}}
intmain(){
intmain(){
inti,a[5]={2,3,5,7,11},sum=0;
inti,a[5]={2,3,5,7,11},sum=0;
sum=calculate_sum(a,5);
sum=calculate_sum(a,5);
}}
A Bigger Program
intcalculate_sum(inta[],inti){
intcalculate_sum(inta[],inti){
intsum=0;
intsum=0;
i=0;
i=0;
for(i=0;i<5;i++)
for(i=0;i<5;i++)
sum=sum+a[i];
sum=sum+a[i];
Condition
Conditionevaluation
evaluation
returnsum;
returnsum; Function call and return
Function call and return
}}
Parameters
Parameterspass
passand
and
intmain(){
intmain(){
inti,a[5]={2,3,5,7,11},sum=0;
return
return
inti,a[5]={2,3,5,7,11},sum=0;
sum=calculate_sum(a,5);
sum=calculate_sum(a,5);
}}
An Even Bigger Program !
intcalculate_sum(inta[],inti){
intcalculate_sum(inta[],inti){
intsum=0;
intsum=0;
i=0;
i=0;
for(i=0;i<5;i++)
for(i=0;i<5;i++)
sum=sum+a[i];
sum=sum+a[i];
returnsum;
returnsum;
}}
intmain(){
intmain(){
inti,a[5]={2,3,5,7,11},sum=0;
inti,a[5]={2,3,5,7,11},sum=0;
sum=calculate_sum(a,5);
sum=calculate_sum(a,5);
printf(thesum:%d.,sum);
printf(thesum:%d.,sum);
}}
An Even Bigger Program !
intcalculate_sum(inta[],inti){
intcalculate_sum(inta[],inti){
intsum=0;
intsum=0;
i=0;
i=0;
for(i=0;i<5;i++)
for(i=0;i<5;i++)
sum=sum+a[i];
sum=sum+a[i];
returnsum;
returnsum;
}}
intmain(){
intmain(){
inti,a[5]={2,3,5,7,11},sum=0;
inti,a[5]={2,3,5,7,11},sum=0;
sum=calculate_sum(a,5);
sum=calculate_sum(a,5);
printf(thesum:%d.,sum);
printf(thesum:%d.,sum);
I/O
I/Ooperation
operation!!
}}
Computer Organization and
Architecture This Course
Binary Code
Instructions
Instructions
The
TheBinary
BinaryProgram
Program Data
Data
(a.out)
(a.out)
Function
FunctionCalls
Calls
I/O
I/OOperations
Operations
Computer Organization and
Architecture This Course
ALU
ALUDesign
Design
Instructions
Instructions
The
TheBinary
BinaryProgram
Program Data Datapath
DatapathDesign
Design
Data
(a.out)
(a.out)
Function
FunctionCalls
Calls Control
ControlUnit
UnitDesign
Design
I/O
I/OOperations
Operations Memory
MemoryHierarchy
Hierarchy
Course Details
Assignments (~4)
MIPS Assembly language programming
Hardware design - Build components in SystemC
Tutorials (8 10)
Solve problems in class; Teams of 2; Every week.
Quizzes (2), Midterm and Final Exam
Class slides will be on the course website
Course Reference Texts
David A Patterson and John L Hennessy. Computer Organization
and Design The Hardware/Software Interface. 5e, Morgan
Kaufmann. 2014.
Hamacher, Vranesic, Zaky. Computer Organization, 5e. Tata McGraw
Hill, 2011.
John P Hayes. Computer Architecture and Organization, 3e. McGraw
Hill, 1998.
M. Morris Mano. Computer System Architecture. 3e. Pearson, 2007.
David Harris and Sarah Harris. Digital Design and Computer
Architecture. 2e. MK. 2013.
NPTEL Courses (www.nptel.co.in)
Matthew Jacob High Performance Computing, Bhaskaran Raman Computer
Organisation and Architecture, S. Raman Computer Organization, Jatindra
Kumar Deka Computer Organisation and Architecture.