computer organization von neumann computer
play

Computer Organization von Neumann Computer Arithmetic-Logical Unit - PowerPoint PPT Presentation

Computer Organization von Neumann Computer Arithmetic-Logical Unit Control Unit (ALU) Data Address Primary Memory Device (Executable Memory) Device Device The ALU Right Operand Left Operand R1 R2 . . . Rn Functional Unit Status


  1. Computer Organization

  2. von Neumann Computer Arithmetic-Logical Unit Control Unit (ALU) Data Address Primary Memory Device (Executable Memory) Device Device

  3. The ALU Right Operand Left Operand R1 R2 . . . Rn Functional Unit Status Registers Result To/from Primary Memory

  4. Memory Unit 0 1234 MAR 1 2 98765 MDR Command write 1234 98765 n-1

  5. Program Specification Source int a, b, c, d; . . . Assembly Language a = b + c; ; Code for a = b + c d = a - 100; load R3,b load R4,c add R3,R4 store R3,a ; Code for d = a - 100 load R4,=100 subtract R3,R4 store R3,d

  6. Machine Language Assembly Language ; Code for a = b + c load R3,b load R4,c Machine Language add R3,R4 10111001001100É1 store R3,a 10111001010000É0 10100111001100É0 ; Code for d = a - 100 10111010001100É1 load R4,=100 10111001010000É0 subtract R3,R4 10100110001100É0 store R3,d 10111001101100É1

  7. Control Unit load R3,b load R4,c add R3,R4 store R3,a Fetch Unit 10111001001100É1 3046 3050 PC 3050 10111001010000É0 Decode Unit 10100111001100É0 3054 IR load R4,c 3058 10111010001100É1 Execute Unit Primary Memory Control Unit

  8. Control Unit Operation ¥ Fetch phase : Instruction retrieved from memory ¥ Execute phase : ALU op, memory data reference, I/O, etc. PC = <machine start address>; IR = memory[PC]; haltFlag = CLEAR; while(haltFlag not SET) { execute(IR); PC = PC + sizeof(INSTRUCT); IR = memory[PC]; };

  9. Bootstrapping Bootstrap loader (Òboot sectorÓ) 1 Primary Memory

  10. Bootstrapping Bootstrap loader (Òboot sectorÓ) 1 2 Loader Primary Memory

  11. Bootstrapping Bootstrap loader (Òboot sectorÓ) 1 2 Loader 3 OS Primary Memory 4. Initialize hardware 5. Create user environment 6. É

  12. Bootstrapping Bootstrap loader (Òboot sectorÓ) 1 2 Loader 3 OS Primary Memory 4. Initialize hardware 5. Create user environment 6. É

  13. Device Organization Application Program ¥ Device manager Abstract I/O ¥Program to manage device controller Machine ¥Supervisor mode software Device Controller Device

  14. Device Controller Interface busy done . . . busy done Error code . . . 0 0 idle 0 1 finished 1 0 working 1 1 (undefined) Command Status Data 0 Data 1 Logic Data n-1

  15. Performing a Write Operation while(deviceNo.busy || deviceNo.done) <waiting>; deviceNo.data[0] = <value to write> deviceNo.command = WRITE; while(deviceNo.busy) <waiting>; deviceNo.done = TRUE; ¥ CPU waits while device operates ¥ Devices much slower than CPU ¥ Would like to multiplex CPU to a different process while I/O is taking place

  16. Control Unit with Interrupt PC = <machine start address>; IR = memory[PC]; haltFlag = CLEAR; while(haltFlag not SET) { execute(IR); PC = PC + sizeof(INSTRUCT); IR = memory[PC]; if(InterruptRequest) { memory[0] = PC; PC = memory[1] };

  17. Interrupt Handler interruptHandler() { saveProcessorState(); for(i=0; i<NumberOfDevices; i++) if(device[i].done) goto deviceHandler(i); /* something wrong if we get to here É */ deviceHandler(int i) { finishOperation(); returnToProcess(); }

  18. A Race Condition saveProcessorState() { for(i=0; i<NumberOfRegisters; i++) memory[K+i] = R[i]; for(i=0; i<NumberOfStatusRegisters; i++) memory[K+ NumberOfRegisters+i] = StatusRegister[i]; } PC = <machine start address>; IR = memory[PC]; haltFlag = CLEAR; while(haltFlag not SET) { execute(IR); PC = PC + sizeof(INSTRUCT); IR = memory[PC]; if(InterruptRequest && InterruptEnabled) { disableInterupts(); memory[0] = PC; PC = memory[1] };

  19. Ensuring that trap is Safe executeTrap(argument) { setMode(supervisor); switch(argument) { case 1: PC = memory[1001]; // Trap handler 1 case 2: PC = memory[1002]; // Trap handler 2 . . . case n: PC = memory[1000+n];// Trap handler n }; ¥ The trap instruction dispatches routine atomically ¥ A trap handler performs desired processing ¥ ÒA trap is a software interruptÓ

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend