Let’s make a Computer … at least the CPU … Pentium 4 Ultra Sparc 1 Pentium 3 Opteron Itanium 2 McKinley CBP 2004-5 21364 Comp 1017 Digital Technologies 1 Pentium Data Cache Code Cache Instruction Fetch Instruction Decode Execution Unit CBP 2004-5 Comp 1017 Digital Technologies 2 Minimalist Computer What do we need to build a computer ? ALU (Arithmetic Logic Unit) “Execution Unit” (Intel) Memory Input Output A good Name CBP 2004-5 Comp 1017 Digital Technologies 3 Arithmetic Logic Unit ALU Input A Integer Execution Unit Input B 3 add 2 5 3 sub 2 1 Output CBP 2004-5 Comp 1017 Digital Technologies 4 Multimedia MMX ALU Input A Input B ALU Output CBP 2004-5 MMX instructions add bits of images together! Useful for multimedia Comp 1017 Digital Technologies 5 Processing Idea Nr. 1 Move data in and out of data memory 1.Move data from memory 3 2. add 2 5 0 3 1 2 2 3 5 Memory DRAM, Hard Disk .. 4 3. Move data into memory CBP 2004-5 Comp 1017 Digital Technologies 6 Processing Idea Nr.2 Move instructions into CPU from code memory Instruction Memory (Code Memory) mov 3 in from memory 3 mov 2 in from memory IP add the two numbers add 2 5 0 3 1 2 2 3 mov the result to memory 5 4 Program CBP 2004-5 Comp 1017 Digital Technologies 7 Registers Registers are high-speed memory on the CPU chip Parking places for data on the move AX 6 BX 8 AX and BX are used for ALU operations 0 6 1 8 MAR 4 MAR is memory address register, here 4. So result, 6+8=14 will go into memory cell address 4 CBP 2004-5 Comp 1017 Digital Technologies 4 8 Program Memory Let’s consider a spreadsheet cell which adds two numbers x + y. This cell and its instruction is in memory. But it is REPRESENTED in different ways 1. Application mov ax,[x] mov bx,[y] add ax, bx 2. High Level mov [w],ax Language like ‘C’ w=x+y; CBP 2004-5 3. Assembler Instructions Comp 1017 Digital Technologies 9 Our computer so far … 0 1 Instruction Memory Data Memory mar ip CBP 2004-5 4 Comp 1017 Digital Technologies 10 SAM-2 CBP 2004-5 Comp 1017 Digital Technologies 11 Moving data into Registers For example … mov ax , [1] mov bx , [2] Instruction Memory CBP 2004-5 AX 8 BX 7 mar 0 5 1 8 2 7 3 6 4 1 Comp 1017 Digital Technologies mov ax , [1] mov bx , [2] 12 Moving data into Memory For example … mov [3] , ax mov [0] , bx Instruction Memory CBP 2004-5 AX 8 mov [3] , ax mov [0], bx BX 7 mar 0 7 5 1 8 2 7 3 8 6 4 1 Comp 1017 Digital Technologies 13 Adding Numbers For example … Add ax,bx Instruction Memory CBP 2004-5 AX BX 8 7 8 7 15 mar 0 5 1 8 2 7 3 6 4 1 Comp 1017 Digital Technologies add ax , bx … this means ‘ add ax to bx, put the answer in ax’ 14 I’ve never wrestled with such a complex problem before It must take a lot of organization and control ! CBP 2004-5 Comp 1017 Digital Technologies 15 Pentium Organization and control CBP 2004-5 Comp 1017 Digital Technologies 16 Fetch-Execute Cycle (Organization and Control) 1. Fetch instruction from memory 5. Write back results to registers ax <- ALU add ax , bx 4. Do any Memory Access 2. Decode the instruction and read any registers ALU <- ax ALU <- bx CBP 2004-5 (Data cache) None needed 3. Do any ALU operations ax + bx (execute units) Comp 1017 Digital Technologies 17 Fetch-Exec : State 1 Instruction Fetch add ax , bx add ax bx AX BX 3 1 add ax,bx CBP 2004-5 Comp 1017 Digital Technologies 0 3 1 8 2 7 3 1 4 9 18 Fetch-Exec : State 2 Decode, Register Operations add ax , bx add ax bx AX BX 3 1 3 1 add ax,bx CBP 2004-5 Comp 1017 Digital Technologies 0 3 1 8 2 7 3 1 4 9 19 Fetch-Exec : State 3 ALU Operation add ax , bx add ax bx AX BX add ax,bx 1 3 4 CBP 2004-5 Comp 1017 Digital Technologies 0 3 1 8 2 7 3 1 4 9 20 Fetch-Exec : State 4 Memory Access add ax , bx add ax bx AX BX add ax,bx 1 3 4 CBP 2004-5 Comp 1017 Digital Technologies 0 3 1 8 2 7 3 1 4 9 21 Fetch-Exec : State 5 Register Write add ax , bx add ax bx BX add ax,bx 3 1 8 2 7 3 1 4 9 4 1 3 4 CBP 2004-5 0 Comp 1017 Digital Technologies 22 Fetch-Execute Cycle (Organization and Control) 1. Fetch instruction from memory 5. Write back results to registers Data into ax mov ax , [1] 4. Do any Memory Access 2. Decode the instruction and read any registers Read memory at addr ‘1’ Read the ‘1’ 3. Do any ALU operations (execute units) Put ‘1’ into MAR CBP 2004-5 Comp 1017 Digital Technologies 23 Fetch-Exec : State 1 Instruction Fetch mov ax , [1] mov ax , [1] CBP 2004-5 mov ax 1 Comp 1017 Digital Technologies 0 3 1 8 2 7 3 1 4 9 24 Fetch-Exec : State 2 Decode, Register Operations mov ax , [1] mov ax , [1] CBP 2004-5 mov ax 1 Comp 1017 Digital Technologies 0 3 1 8 2 7 3 1 4 9 25 Fetch-Exec : State 3 ALU Operation mov ax , [1] mov ax , [1] mov ax 1 1 CBP 2004-5 Comp 1017 Digital Technologies 0 3 1 8 2 7 3 1 4 9 26 Fetch-Exec : State 4 Memory Access mov ax , [1] mov ax , [1] mov ax 1 8 1 CBP 2004-5 Comp 1017 Digital Technologies 0 3 1 8 2 7 3 1 4 9 27 Fetch-Exec : State 5 Register Write mov ax , [1] mov ax , [1] mov ax 1 8 8 1 CBP 2004-5 Comp 1017 Digital Technologies 0 3 1 8 2 7 3 1 4 9 28 Pentium 1. Fetch 2. Decode 3. ALU 4. Mem Ops 5. Reg Write 1 2 3 4 5 CBP 2004-5 Comp 1017 Digital Technologies 29 The first microprocessor A dedicated design ... Keypad Lots of Electronics LCD Display ... or a reusable design Code Memory LCD Display Keypad Programmable Electronics CBP 2004-5 Comp 1017 Digital Technologies 30 CBP 2004-5 Comp 1017 Digital Technologies 31
© Copyright 2026 Paperzz