Sie sind auf Seite 1von 17

IIT Bombay

Computer Programming
Dr. Deepak B Phatak
Dr. Supratik Chakraborty
Department of Computer Science and Engineering
IIT Bombay
Session: Computer Architecture

Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 1


Quick Recap of Relevant Topics
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


Overview of This Lecture
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


A Simple Real Computer
IIT Bombay

Location 0 Address
DumbosLocation 1 Register 0

Main Memory
Arithmetic
Cart Location 2 Register 1 and Logical
Register 2
Unit (ALU)
Register 3
Data
Dumbos Dumbos Controller
Drawers Cart
Central Processing Unit (CPU)
Dumbos
Workbench
Dumbos BUS
Cart

Disk Output Device Input Device

Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 4


Parts of a Computer
IIT Bombay

Location 0 Address
Location 1 Register 0

Main Memory
Arithmetic
Location 2 Register 1 and Logical
Register 2
Unit (ALU)
Register 3
Data

Controller
Central Processing Unit (CPU)

BUS

Disk Output Device Input Device

Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 5


Main Memory
IIT Bombay

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 dont 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


Parts of a Computer
IIT Bombay

Location 0 Address
Location 1 Register 0

Main Memory
Arithmetic
Location 2 Register 1 and Logical
Register 2
Unit (ALU)
Register 3
Data

Controller
Central Processing Unit (CPU)

BUS

Disk Output Device Input Device

Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 7


Registers
IIT Bombay

Much faster, costlier and smaller than main memory


Wont see much of these in our programs
Works behind the scenes
Advanced programming can refer to registers directly
We wont get to cover this in this course

Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 8


Parts of a Computer
IIT Bombay

Location 0 Address
Location 1 Register 0

Main Memory
Arithmetic
Location 2 Register 1 and Logical
Register 2
Unit (ALU)
Register 3
Data

Controller
Central Processing Unit (CPU)

BUS

Disk Output Device Input Device

Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 9


ALU and Controller
IIT Bombay

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


Parts of a Computer
IIT Bombay

Location 0 Address
Location 1 Register 0

Main Memory
Arithmetic
Location 2 Register 1 and Logical
Register 2
Unit (ALU)
Register 3
Data

Controller
Central Processing Unit (CPU)

BUS

Disk Output Device Input Device

Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 11


Disks and Input/Output Devices
IIT Bombay

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


Parts of a Computer
IIT Bombay

Location 0 Address
Location 1 Register 0

Main Memory
Arithmetic
Location 2 Register 1 and Logical
Register 2
Unit (ALU)
Register 3
Data

Controller
Central Processing Unit (CPU)

BUS

Disk Output Device Input Device

Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 13


Buses
IIT Bombay

Highways for transfering information between different


parts
Address bus, data bus, I/O bus, external device bus
(Universal Serial Bus)
We wont see these in our study
Works behind the scenes

Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 14


How is Information Represented?
IIT Bombay

All information represented as sequences of 0s and 1s


Snapshot: 01101101 Address

Main Memory
01111111 00001111 00011010
10011110 00001011
11101100 00001001 11011100 +
01101111 11110111

11011100
Data
CPU

10011111 BUS

10010111 10011111 10010101

Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 15


Internal Representation of Information
IIT Bombay

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
Summary
IIT Bombay

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