Operating Systems Computer Organization Lecture 02 Operations with


















- Slides: 18

Operating Systems Computer Organization Lecture: 02

Operations with Memory • Two operations can be performed with memory – Read – Write • To perform these operations, 3 type of information is required: – Data – Control (Read/Write) – Address

Data • The Direction of data flow depends on the control signal generated by the CPU. • Read = 1 and Write = 0 – The Data will move from RAM to CPU • Read = 0 and Write = 1 – The Data will move from CPU to RAM

Read = 1 and Write = 0 • The Data from the selected row will be copied to the Memory Buffer Register • From the MBR, it’ll be copied to the CPU via the “Data Bus”

Read = 1 and Write = 0 Address Bus 3 Memory Address Register 3 R W RAM . . . . 1. 1 1 0 0. . 1. 1. 1. 0. Memory Buffer Register 3 CPU 0 1 1 Data Bus 0. . . . 0 1 C O N T R O L B U S

Read = 0 and Write = 1 • The Data from the CPU will be copied to the Memory Buffer Register • From the MBR, it’ll be copied to the selected row of the RAM

Read = 0 and Write = 13 Address Bus 3 Memory Address Register 3 RAM . . . . 1. 1 1 0 0. . 1. 0. 1. 1. 1 Memory Buffer Register 0 0 Data Bus 0. . . 1 CPU R W 1 C O N T R O L B U S

Read = 0 and Write = 13 Address Bus 3 Memory Address Register 3 RAM . . . . 1. 0 1 1 1. 0. 1. 1. 1 Memory Buffer Register 0 0 Data Bus 0. . . 1 CPU R W 1 C O N T R O L B U S

The CPU • The CPU is the brain of the computer. • It is the part that actually executes the instructions. • Let’s take a look inside.

The CPU (cont. ) Memory Registers Register 0 Register 1 Register 2 Register 3 Temporary Memory, Variables Fetched from memory are stored here

The CPU (cont. ) Memory Registers Register 0 Register 1 Arithmetic / Logic Unit Register 2 Register 3 For doing basic Arithmetic / Logic Operations on Values stored in the Registers

The CPU (cont. ) Memory Registers Register 0 Register 1 Arithmetic / Logic Unit Register 2 Register 3 Instruction Register To hold the current instruction

The CPU (cont. ) Memory Registers Register 0 Register 1 Arithmetic / Logic Unit Register 2 Register 3 Instruction Register Instr. Pointer (IP) To hold the address of the current instruction in RAM

The CPU (cont. ) Memory Registers Register 0 Register 1 Arithmetic / Logic Unit Register 2 Register 3 Instruction Register Instr. Pointer (IP) Control Unit (State Machine)

What does the CPU do? ? ? All that a CPU does, as long as the power is on, is: Decode Fetch Execute

The Control Unit • Control Unit State Machine has very simple structure: 1) Fetch: Ask the RAM for the instruction whose address is stored in IP. And Add 1 to the address stored in IP 2) Decode: Decode the bit pattern in the instruction register. 3) Execute: Perform the action requested by the instruction in the instruction register.

Instruction Register • Fetched instruction is placed in the instruction register • Types of instructions – Processor-memory • transfer data between processor and memory • Read Register 2, Ox. AA 2 – Processor-I/O • data transferred to or from a peripheral device • cin, cout – Data processing • arithmetic or logic operation on data • Add Register 2, Register 3, Register 1 – Control • alter sequence of execution • Jump 0 x. FF 3

Example of Program Execution