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

Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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

Page 2: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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

Page 3: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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

Page 4: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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

Page 5: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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

Page 6: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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

Page 7: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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

Page 8: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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

Page 9: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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

Page 10: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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

Page 11: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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

Page 12: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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

Page 13: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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

Page 14: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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

Page 15: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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

Page 16: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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

Page 17: Computer Programmingcs101/2014.2/lecture-slides/... · 2014. 7. 30. · IIT Bombay •What is it that we will actually be programming •From Dumbo to a real computer (almost a Dumbo!)

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