CS222:ComputerOrganization
and Architecture andArchitecture
Dr.A.Sahu
Dept of Comp. Sc. & Engg. DeptofComp.Sc.&Engg.
IndianInstituteofTechnologyGuwahati
1
Outline Outline
Course Attendance Reference Book Course,Attendance,ReferenceBook
Whatdowestudyinthiscourse?
Whyshouldthisbestudied?
What is Computer Architecture ? Whatis ComputerArchitecture ?
Howisthecoursestructured?
2
CS222 Course CS222Course
75% A   d   i  M   d 75%AttendanceisMandatory
Manual&ElectronicsAttendanceSystem y
4Programmingassignment+2Takehome
A   ki d   f C   /Pl   i   i   l   d t   `F  AnykindofCopy/Plagiarismleadto`F
Grade
3
CS222 Course CS222Course
 TextBook
 StallingW.,ComputerOrganization&Architecture,
7
th
 Edition,PearsonEducationIndia,2010
 Hamacher C.etal,ComputerOrganization,5
th
Edition,McGrawHill,2002
 ReferenceBook
 Henneyssy J.L.,PattersonD.,Computer
OrganizationAndDesign:TheHardware/Software
Interface,MorganKaufmann,2008
4
CS222Course
 Coursewebsite:
http://jatinga iitg ernet in/~asahu/cs222/ http://jatinga.iitg.ernet.in/ asahu/cs222/
 Markdistribution
%   i   k  15%:Assignment+Homework
 40%:MidSemester
 45%:EndSemester
 ClassTiming&Venue
 Venue:1201,Timing:SlotC
 Mon:1011,Tue:1112,Thu:89MakeupSlot,Fri:910
5
CS222 Course Objectives CS222CourseObjectives
To learn  Tolearn
Howcomputerswork,basicprinciples
Howtoanalyzetheirperformance(or
hownotto!)
Howcomputersaredesignedandbuilt
Issues affecting modern processors Issuesaffectingmodernprocessors
(caches,pipelines,etc.)
6
CS222 Course Motivation CS222CourseMotivation
Thisknowledgewillbeusefulifyouneedto
 design/buildanewcomputer
 rareopportunity
 Design/buildanewversionofacomputer
 Improvesoftwareperformance p   p
 Purchaseacomputer
 Provide a solution with an embedded Provideasolutionwithanembedded
computer
7
Course Pre requisite CoursePrerequisite
Require Knowledge of Require Knowledgeof
 DigitalDesignFundamental
 DataStructureandC/C++Programming
 Basic10+2Standard
ProbabilityandMathematics
8
What is Computer Architecture Whatis ComputerArchitecture
Building architecture : Structural design Buildingarchitecture: Structuraldesign
(CivilEngg)
::
Computer architecture : Circuit design Computerarchitecture: Circuitdesign
(Electronics/CSEngg)
9
Abstraction Abstraction
 Delving into the depths reveals more Delvingintothedepthsrevealsmore
information
 Anabstractionomitsunneededdetail,
helpsuscopewithcomplexity
10
Software Abstraction
0x401040 <sum>:   0x55
SoftwareAbstraction
intsum(intx,inty)
  0x401040<sum>:   0x55
0x89
0xe5
0 8b
(   ,   y)
{
intt=x+y;
return t;
C
0x8b
0x45
0x0c
returnt;
}
sum:
0x03
0x45
0x08
_sum:
pushl%ebp
movl%esp,%ebp
l 12(% b ) %
assembly
0x08
0x89
0xec
0 5d
movl12(%ebp),%eax
addl8(%ebp),%eax
movl%ebp,%esp
0x5d
0xc3
popl%ebp
ret
  machine
code
  11
Hardware Abstraction HardwareAbstraction
Register file
ALU
CPU
System bus   Memory bus
PC
Main
memory
bridge Bus interface
I/O bus
  Expansion slots for
Disk 
controller
Graphics
adapter
USB
controller
p
other devices such
as network adapters
Mouse   Keyboard   Display
Disk
12
13
14
15
16
17
18
19
Hardware/software interface Hardware/softwareinterface
software
  C/C++
m/cinstr
our
reg,adder
our
focus
hardware
transistors
20
Architecture levels Architecturelevels
Instruction set architecture (ISA) Instructionsetarchitecture(ISA)
Lowestlevelvisibletoaprogrammer
Operation(add/sub/mul/shift)
Micro architecture Microarchitecture
Fillsthegapbetweeninstructionsand
logic modules logicmodules
OperationVsMicroOperation
21
Instruction Set Architecture
 Assembly Language View
  Application
InstructionSetArchitecture
 AssemblyLanguageView
 Processorstate(RF,mem)
Instruction set and encoding
  Compiler   OS
pp  cat o
Program
 Instructionsetandencoding
 LayerofAbstraction
Ab   h   t
  ISA
Compiler   OS
 Above:howtoprogram
machine HLL,OS
Below: what needs to be built
CPU
Design
Circuit
 Below:whatneedstobebuilt
 trickstomakeitrunfast
  Circuit
Design
Chip Chip
Layout
22
The Abstract Machine TheAbstractMachine
CPU
  Memory
Add
PC
  Registers
  Code + Data
Addresses
Data
ALU PC
Instructions
Stack
Condition
Codes
ALU
ProgrammerVisibleState
PCProgramCounter
  Memory
RegisterFile
Heavilyuseddata
   Bytearray
 Code+data
ConditionCodes
   stack
23
Some realities Somerealities
 Ints arenotIntegers,FloatsarenotReals g   ,
 Youvegottoknowassembly
 Chancesare,youllneverwriteprogramsin
assembly,butunderstandingassemblykeyto
machinelevelexecutionmodel
 Memory Matters  MemoryMatters
 Memoryisnotunbounded
 Memoryperformanceisnotuniform y p
 Theresmoretoperformancethanasymptotic
complexity
24
Embedded computers Embeddedcomputers
Processor as an intelligent electronic Processorasanintelligentelectronic
componentratherthanProcessorasa
computingengine
Real time operation Realtimeoperation
Requireshardwaresoftwarecodesign
Highlycustomized
25
Why different processors? Whydifferentprocessors?
 What is the difference between processors Whatisthedifferencebetweenprocessors
usedindesktops,laptops,mobilephones,
washing machines etc ? washingmachinesetc.?
 Performance/speed
P   i  Powerconsumption
 Cost
 Generalpurpose/specialpurpose
 DomainSpecific:Network,DSP,Image.Crypto
26
27
Topics to be covered Topicstobecovered
 Performanceissues
 Aspecificinstructionsetarchitecture
 ArithmeticandhowtobuildanALU
 Constructingaprocessortoexecute
instructions
 Pipeliningtoimproveperformance
 Memory:cachesandvirtualmemory
 Input/output
28