Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
IIT Bombay
Computer ProgrammingDr. Deepak B Phatak
Dr. Supratik ChakrabortyDepartment of Computer Science and Engineering
IIT Bombay
Session: Computer Architecture
1Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay
IIT Bombay
• Dumbo model of computing
• Named drawers for storing/retrieving values
• Workbench registers for computing
• Input and output using carts
2 Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay
Quick Recap of Relevant Topics
IIT Bombay
• What is it that we will actually be programming• From Dumbo to a real computer (almost a Dumbo!)
• Simplified architecture of a computer
• Functionalities of different parts
• Bits and bytes of information
3 Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay
Overview of This Lecture
IIT Bombay
A Simple Real Computer
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 4
Register 0Arithmeticand LogicalUnit (ALU)
Register 1Register 2Register 3
Central Processing Unit (CPU)
Address
Data
Controller
Mai
n M
em
ory
Location 0
Location 1
Location 2
…
BUS
Input DeviceOutput DeviceDisk
Dumbo’sDrawers
Dumbo’sWorkbench
Dumbo’sCart
Dumbo’sCart
Dumbo’sCart
IIT Bombay
Parts of a Computer
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 5
Register 0Arithmeticand LogicalUnit (ALU)
Register 1Register 2Register 3
Central Processing Unit (CPU)
Address
Data
Controller
Location 0
Location 1
Location 2
…
BUS
Input DeviceOutput DeviceDisk
Mai
n M
em
ory
IIT Bombay
Main Memory
• Usually called “Random Access Memory” (RAM) or simply “Memory”
• Large number of addressable locations
• Each location stores exactly one value at a time• Even if you don’t store a value at a location, “garbage”
value exists
• Writing to a location destroys value originally there
• Reading a location makes a copy, does not destroy value
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 6
IIT Bombay
Parts of a Computer
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 7
Register 0Arithmeticand LogicalUnit (ALU)
Register 1Register 2Register 3
Central Processing Unit (CPU)
Address
Data
Controller
Location 0
Location 1
Location 2
…
BUS
Input DeviceOutput DeviceDisk
Mai
n M
em
ory
IIT Bombay
Registers
• Much faster, costlier and smaller than main memory
• Won’t see much of these in our programs• Works behind the scenes
• Advanced programming can refer to registers directly• We won’t get to cover this in this course
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 8
IIT Bombay
Parts of a Computer
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 9
Register 0Arithmeticand LogicalUnit (ALU)
Register 1Register 2Register 3
Central Processing Unit (CPU)
Address
Data
Controller
Location 0
Location 1
Location 2
…
BUS
Input DeviceOutput DeviceDisk
Mai
n M
em
ory
IIT Bombay
ALU and Controller
• Arithmetic Logic Unit (ALU)• Workhorse of computer
• All arithmetic (add, multiply …) and logical (and, or …) operations happen here
• Takes operands from registers, stores result in registers
• Controller• Sequences various actions involved in executing instructions
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 10
IIT Bombay
Parts of a Computer
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 11
Register 0Arithmeticand LogicalUnit (ALU)
Register 1Register 2Register 3
Central Processing Unit (CPU)
Address
Data
Controller
Location 0
Location 1
Location 2
…
BUS
Input DeviceOutput DeviceDisk
Mai
n M
em
ory
IIT Bombay
Disks and Input/Output Devices
• Disks• Longer term storage for files (programs, data, logs, outputs …)
• Like main memory, but much slower, larger, cheaper
• More later when we study about files
• Input/Output (aka I/O) Devices• Allows computer to interact with world outside
• Input device: Keyboard for us
• Output device: Console (screen) for us
• Computers can interact with other kinds of I/O devices too!
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 12
IIT Bombay
Parts of a Computer
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 13
Register 0Arithmeticand LogicalUnit (ALU)
Register 1Register 2Register 3
Central Processing Unit (CPU)
Address
Data
Controller
Location 0
Location 1
Location 2
…
BUS
Input DeviceOutput DeviceDisk
Mai
n M
em
ory
IIT Bombay
Buses
• Highways for transfering information between different parts
• Address bus, data bus, I/O bus, external device bus (Universal Serial Bus)
• We won’t see these in our study• Works behind the scenes
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 14
IIT Bombay
How is Information Represented?
• All information represented as sequences of 0’s and 1’s
• Snapshot:
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 15
00001111 00011010+
11110111
CPU
Address
DataMai
n M
em
ory
01101101
…
BUS
000010110000100101101111
0111111111101100
11011100
10011110
10011111
10011111 1001010110010111
11011100
IIT Bombay
Internal Representation of Information
• Electronic circuits in a computer can efficiently store and process two states of electrical signals
• Call them ‘0’ and ‘1’
• Information represented using ‘0’ and ‘1’• Binary representation• ‘0’ and ‘1’ called bits (binary digits)
• Information accessed in chunks of 8 bits: a byte• Memory access, I/O access, register access, addresses, …
• Important to understand how numbers, characters, strings … are represented using bits and bytes
• Topic of another lecture …
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 16
IIT Bombay
Summary
• Architecture of a simple real computer• Main memory
• Registers
• ALU
• Input/Output devices
• Disk
• Bus
• Representing information: Bits and bytes
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 17