Computer Programming Dr. Deepak B Phatak Dr. Supratik Chakraborty Department of Computer Science and Engineering Session: Computer Architecture Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, 1
Quick Recap of Relevant Topics 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,
Overview of This Lecture 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,
Main Memory A Simple Real Computer Dumbo s Drawers Dumbo s Cart Dumbo s Cart Location 0 Location 1 Location 2 Dumbo s Cart Address Data Dumbo s Workbench Register 0 Register 1 Register 2 Register 3 Controller Arithmetic and Logical Unit (ALU) Central Processing Unit (CPU) BUS Disk Output Device Input Device Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, 4
Main Memory Parts of a Computer Location 0 Location 1 Location 2 Address Data Register 0 Register 1 Register 2 Register 3 Arithmetic and Logical Unit (ALU) Controller Central Processing Unit (CPU) BUS Disk Output Device Input Device Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, 5
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, 6
Main Memory Parts of a Computer Location 0 Location 1 Location 2 Address Data Register 0 Register 1 Register 2 Register 3 Arithmetic and Logical Unit (ALU) Controller Central Processing Unit (CPU) BUS Disk Output Device Input Device Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, 7
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, 8
Main Memory Parts of a Computer Location 0 Location 1 Location 2 Address Data Register 0 Register 1 Register 2 Register 3 Arithmetic and Logical Unit (ALU) Controller Central Processing Unit (CPU) BUS Disk Output Device Input Device Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, 9
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, 10
Main Memory Parts of a Computer Location 0 Location 1 Location 2 Address Data Register 0 Register 1 Register 2 Register 3 Arithmetic and Logical Unit (ALU) Controller Central Processing Unit (CPU) BUS Disk Output Device Input Device Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, 11
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, 12
Main Memory Parts of a Computer Location 0 Location 1 Location 2 Address Data Register 0 Register 1 Register 2 Register 3 Arithmetic and Logical Unit (ALU) Controller Central Processing Unit (CPU) BUS Disk Output Device Input Device Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, 13
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, 14
Main Memory How is Information Represented? All information represented as sequences of 0 s and 1 s Snapshot: 01101101 01111111 11101100 Address 10011110 00001111 00001011 00001001 01101111 11011100 00011010 + 11110111 11011100 Data CPU 10011111 BUS 10010111 10011111 10010101 Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, 15
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, 16
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, 17