Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Architecture And Organization UNIT-II Structured Organization.

Similar presentations


Presentation on theme: "Computer Architecture And Organization UNIT-II Structured Organization."— Presentation transcript:

1 Computer Architecture And Organization UNIT-II Structured Organization

2 It is a way of structuring computers as a series of abstractions, each abstraction building on the one below it. It is a way of structuring computers as a series of abstractions, each abstraction building on the one below it. Let’s call L0 the machine language of a computer machine which we refer at as M0 Let’s call L0 the machine language of a computer machine which we refer at as M0 The actual computer M0, which executes Programs written in L0 Level 0 Defining another language L1 which is more convenient for people to use and L1 cannot be executed on the actual computer M0 (as M0 only understands L0) Though we can transform a L1 program in L0 so that it can be executed on M0 There two ways for transforming a L1 programs into L0 programs

3 Translation vs Interpretation Translation: the original L1 program is translated in an equivalent L0 one, then executed on M0 Translation: the original L1 program is translated in an equivalent L0 one, then executed on M0 L1 program translator L0 program The actual computer M0, which executes Programs written in L0 Level 0

4 Interpretation: to write a program (interpreter) in L0 (hence running on M0) which takes L1 programs as input and for each instruction in L1 executes the equivalent sequence of L0 instruction Interpretation: to write a program (interpreter) in L0 (hence running on M0) which takes L1 programs as input and for each instruction in L1 executes the equivalent sequence of L0 instruction Translation vs Interpretation L1 program interpreter Level 0

5 Translation and interpretation are similar: they are both way to carry out L1 programs through a machine which understand L0 language only. They are also different: Translation and interpretation are similar: they are both way to carry out L1 programs through a machine which understand L0 language only. They are also different: In translation the entire L1 program is first translated, then its thrown away and the resulting L0 program is executed (hence the translated program controls the computer) In translation the entire L1 program is first translated, then its thrown away and the resulting L0 program is executed (hence the translated program controls the computer) With Interpretation the interpreter is in control of the computer all the time. Each single instruction of L1 is considered and executed immediately Rather than thinking in terms of translation/interpretation we can think in terms of virtual machines. With Interpretation the interpreter is in control of the computer all the time. Each single instruction of L1 is considered and executed immediately Rather than thinking in terms of translation/interpretation we can think in terms of virtual machines. Translation vs Interpretation

6 We can imagine a number of levels each one with its own language Ln and virtual machine Mn We can imagine a number of levels each one with its own language Ln and virtual machine Mn A user of level n has only to know language Ln and can forget about all below layers: to his eyes the computer is the virtual machine Mn A user of level n has only to know language Ln and can forget about all below layers: to his eyes the computer is the virtual machine Mn Through interpratation/translation the final result is that a program written in Ln will be executed on M0 (the actual computer) Through interpratation/translation the final result is that a program written in Ln will be executed on M0 (the actual computer) It involves:- It involves:- CPU CPU Cache Cache Main Memory Main Memory Secondary Memory Secondary Memory I/O Units I/O Units Structured Organization

7 Structured Organization- CPU Data Bus memory input/ output control unit arithmetic- logic unit Central Processing Unit (CPU) registers program counter PC instruction register IR computation register R condition flags: GT, EQ, LT registers are like the cells of memory, but are much faster and used for special purposes. For now, let’s focus on the computation register and the condition flags.

8 ALU and the data-path the internal part of the CPU is also called data-path it consists of registers and the ALU The ALU performs simple arithmetical/logic operations (ADD, AND,OR) It takes its operands from the registers and store the result back in them The process of reading operand and storing result back is called data-path cycle The faster the data-path cycle is the faster the computer runs AB ALU A+B A B input register registers output register

9 CPU-Instruction Execution Steps CPU executes each instruction in the following steps:- (FETCH-DECODE-EXECUTE) 1) Fetch next instruction from memory into instruction register. 2) Change program counter to point to next instruction. 3) Determine the type of instruction just fetched. 4) If instruction uses a word in memory, determine where Fetch word, if needed, into CPU register 5) Execute the instruction. 6) Go to step 1 to begin executing following instruction.

10 Example of fetch-execute cycle the memory cells actually contain binary numbers... more on this later instruction pointer PC instruction register IR computation register R condition flags Arithmetic-Logic Unit Control Unit CPU Memory 10 Load X 11 Add Y 12 Store Z 13 Jump Nxt 14 Subtract X 15 Clear X........... 20 7 21 4 22 0 23 0 instructions data Data Bus address contents (X) (Y) (Z) (CN1) (Nxt)

11 instruction pointer PC instruction register IR computation register R condition flags Arithmetic-Logic Unit Control Unit CPU Memory 10 Load X 11 Add Y 12 Store Z 13 Jump Nxt 14 Subtract X 15 Clear X........... 20 7 21 4 22 0 23 0 instructions data Data Bus address contents (X) (Y) (Z) (CN1) (Nxt) step 0: to execute the program, initialize PC to 10 step 1: fetch instruction & increment PC 10 Load X 11

12 instruction pointer PC instruction register IR computation register R condition flags Arithmetic-Logic Unit Control Unit CPU Memory 10 Load X 11 Add Y 12 Store Z 13 Jump Nxt 14 Subtract X 15 Clear X........... 20 7 21 4 22 0 23 0 instructions data Data Bus address contents (X) (Y) (Z) (CN1) (Nxt) Load X 11 Step 2: (Decode and) Execute 7 Step 3: Go To Step 1

13 instruction pointer PC instruction register IR computation register R condition flags Arithmetic-Logic Unit Control Unit CPU Memory 10 Load X 11 Add Y 12 Store Z 13 Jump Nxt 14 Subtract X 15 Clear X........... 20 7 21 4 22 0 23 0 instructions data Data Bus address contents (X) (Y) (Z) (CN1) (Nxt) step 1: fetch instruction & increment PC 11 Add Y 12

14 Step 2: (Decode and) Execute instruction pointer PC instruction register IR computation register R condition flags Arithmetic-Logic Unit Control Unit CPU Memory 10 Load X 11 Add Y 12 Store Z 13 Jump Nxt 14 Subtract X 15 Clear X........... 20 7 21 4 22 0 23 0 instructions data Data Bus address contents (X) (Y) (Z) (CN1) (Nxt) Add Y 12 7 Step 3: Go To Step 1 11 and so on, and so on...

15 The Storage Hierarchy registers cacheMain memory Secondary storage (disk) floppy Zip disk Tape faster smaller costlier less flexible slower bigger cheaper more flexible

16

17 Cache Memory Cache is a small, fast memory which holds copies of recently accessed instruction and data Cache is a small, fast memory which holds copies of recently accessed instruction and data Key to the performance of modern Microprocessors Key to the performance of modern Microprocessors There could be up to two levels of cache, the picture to the right is Intel Pentium M, the large block to the left showing 2 MB of L2 cache There could be up to two levels of cache, the picture to the right is Intel Pentium M, the large block to the left showing 2 MB of L2 cache Taking advantage of the Principle of Locality, cache loads itself with contents of data which was recently accessed Taking advantage of the Principle of Locality, cache loads itself with contents of data which was recently accessed But this only addresses temporal locality! But this only addresses temporal locality! Therefore to take advantage of spatial locality as well, cache subsystems are designed to read anywhere between 16-128 bytes of data at a time. Therefore to take advantage of spatial locality as well, cache subsystems are designed to read anywhere between 16-128 bytes of data at a time.

18 Cache Memory Cache is simply defined as a temporary storage area for data which is frequently accessed Cache is simply defined as a temporary storage area for data which is frequently accessed A cache hit occurs when the CPU is looking for data which is already contained within the cache A cache hit occurs when the CPU is looking for data which is already contained within the cache A cache miss is the alternate scenario, when a cache line needs to be read from main memory A cache miss is the alternate scenario, when a cache line needs to be read from main memory The percentages of accesses which result in cache hits are known as the cache hit rate or hit ratio of the cache The percentages of accesses which result in cache hits are known as the cache hit rate or hit ratio of the cache If the cache is full, it needs to evict a cache line before it can bring in a new cache line. This is done through a heuristic process and is known as the cache replacement policy If the cache is full, it needs to evict a cache line before it can bring in a new cache line. This is done through a heuristic process and is known as the cache replacement policy

19 Cache Organization Cache is organized not in bytes, but as blocks of cache lines, with each line containing some number of bytes (16-64) Cache is organized not in bytes, but as blocks of cache lines, with each line containing some number of bytes (16-64) Unlike normal memory, cache lines do not have fixed addresses, which enables the cache system to populate each cache line with a unique (non-contiguous) address Unlike normal memory, cache lines do not have fixed addresses, which enables the cache system to populate each cache line with a unique (non-contiguous) address There are three methods for filling a cache line There are three methods for filling a cache line  Fully Associative – The most flexible  Direct Mapped – The most basic  Set Associative – A combination of the two

20 Main Memory Stores Instructions and Data Stores Instructions and Data Stored Program Stored Program Random Access Memory (RAM) Random Access Memory (RAM) Fetch (not destructive) Fetch (not destructive) Store (destructive) Store (destructive) Read-Only Memory (ROM) Read-Only Memory (ROM) Fetch Only Fetch Only

21 Dynamic RAM Store binary information in the form of electric charges that are applied to capacitors. Store binary information in the form of electric charges that are applied to capacitors. Pros: Pros: Simple construction Simple construction Small memory cell (per bit) Small memory cell (per bit) Less expensive Less expensive Cons: Cons: Charges leak, need refreshing even when powered Charges leak, need refreshing even when powered Need refresh circuits Need refresh circuits Slower Slower Main memory Main memory

22 Static RAM Consists of internal flip flops that store binary information. Consists of internal flip flops that store binary information. Pros: Pros: No charges to leak No charges to leak No refreshing needed when powered No refreshing needed when powered Does not need refresh circuits Does not need refresh circuits Faster Faster Cons: Cons: More complex construction More complex construction Larger per bit Larger per bit More expensive More expensive Cache Cache

23 SRAM v DRAM Both volatile Both volatile Power needed to preserve data Power needed to preserve data Dynamic cell Dynamic cell Simpler to build, smaller Simpler to build, smaller More dense More dense Less expensive Less expensive Needs refresh Needs refresh Larger memory units Larger memory units Static Static Faster Faster Cache Cache

24 Secondary memory Secondary memory (or secondary storage) is the slowest and cheapest form of memory. It cannot be processed directly by the CPU. It must first be copied into primary storage (also known as RAM ). Secondary memory (or secondary storage) is the slowest and cheapest form of memory. It cannot be processed directly by the CPU. It must first be copied into primary storage (also known as RAM ). Secondary memory devices include magnetic disks like hard drives and floppy disks ; optical disks such as CDs and CDROMs ; and magnetic tapes, which were the first forms of secondary memory. Secondary memory devices include magnetic disks like hard drives and floppy disks ; optical disks such as CDs and CDROMs ; and magnetic tapes, which were the first forms of secondary memory.

25 I/O: Input and Output There is both a human-machine interface and a machine-machine interface to I/O. There is both a human-machine interface and a machine-machine interface to I/O. Examples of the human-machine interface include a keyboard, screen or printer. Examples of the human-machine interface include a keyboard, screen or printer. Examples of the machine-machine interface include things like mass storage and secondary storage devices. Examples of the machine-machine interface include things like mass storage and secondary storage devices.


Download ppt "Computer Architecture And Organization UNIT-II Structured Organization."

Similar presentations


Ads by Google