310 likes | 414 Views
Let’s make a Computer. … at least the CPU …. Pentium 4. Ultra Sparc 1. Pentium 3. Opteron. 21364. Itanium 2 McKinley. Pentium. Data Cache Code Cache Instruction Fetch Instruction Decode Execution Unit. Minimalist Computer. What do we need to build a computer ?.
E N D
Let’s make a Computer … at least the CPU … Pentium 4 Ultra Sparc 1 Pentium 3 Opteron 21364 Itanium 2 McKinley Comp 1017 Digital Technologies
Pentium Data Cache Code Cache Instruction Fetch Instruction Decode Execution Unit Comp 1017 Digital Technologies
Minimalist Computer What do we need to build a computer ? ALU (Arithmetic Logic Unit) “Execution Unit” (Intel) Memory Input Output A good Name Comp 1017 Digital Technologies
Input A Input B 3 3 2 2 add sub 5 1 Output Arithmetic Logic Unit ALU Integer Execution Unit Comp 1017 Digital Technologies
Input A Input B ALU Output Multimedia MMX ALU MMX instructions add bits of images together! Useful for multimedia Comp 1017 Digital Technologies
0 1 2 3 3 2 3 2 4 add 5 5 Processing Idea Nr. 1 Move data in and out of data memory 1. Move data from memory Memory DRAM, Hard Disk .. 2. 3. Move data into memory Comp 1017 Digital Technologies
IP 0 1 2 3 3 2 3 2 4 add 5 5 Processing Idea Nr.2 Move instructions into CPU from code memory Instruction Memory (Code Memory) Program Comp 1017 Digital Technologies
0 6 6 8 1 8 4 4 Registers Registers are high-speed memory on the CPU chip Parking places for data on the move AX BX AX and BX are used for ALU operations MAR MAR is memory address register, here 4. So result, 6+8=14 will go into memory cell address 4 Comp 1017 Digital Technologies
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 mov [w],ax 2. High Level Language like ‘C’ 3. Assembler Instructions w = x + y ; Comp 1017 Digital Technologies
0 1 Instruction Memory Data Memory mar 4 Our computer so far … ip Comp 1017 Digital Technologies
SAM-2 Comp 1017 Digital Technologies
0 1 2 mar 3 Instruction Memory 4 Moving data into Registers For example … mov ax , [1] AX BX mov bx , [2] mov ax , [1] 5 mov bx , [2] 7 8 8 7 6 1 Comp 1017 Digital Technologies
0 1 2 mar 3 Instruction Memory 4 Moving data into Memory For example … mov [3] , ax mov [0], bx AX BX mov [3] , ax 5 7 mov [0] , bx 7 8 8 7 6 8 1 Comp 1017 Digital Technologies
0 1 2 mar 3 Instruction Memory 4 Adding Numbers For example … add ax , bx … this means ‘ add ax to bx, put the answer in ax’ AX BX Add ax,bx 5 7 8 8 7 8 7 15 6 1 Comp 1017 Digital Technologies
I’ve never wrestled with such a complex problem before It must take a lot of organization and control ! Comp 1017 Digital Technologies
Pentium Organization and control Comp 1017 Digital Technologies
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 (Data cache) None needed ALU <- ax ALU <- bx 3. Do any ALU operations (execute units) ax + bx Comp 1017 Digital Technologies
0 1 2 3 4 Fetch-Exec : State 1 Instruction Fetch add ax , bx ax bx add AX BX 3 add ax,bx 3 1 8 7 1 9 Comp 1017 Digital Technologies
0 1 2 3 4 Fetch-Exec : State 2 Decode, Register Operations add ax , bx ax bx add AX BX 3 add ax,bx 3 1 8 7 1 3 1 9 Comp 1017 Digital Technologies
0 1 2 3 4 Fetch-Exec : State 3 ALU Operation add ax , bx ax bx add AX BX 3 add ax,bx 8 7 1 3 1 4 9 Comp 1017 Digital Technologies
0 1 2 3 4 Fetch-Exec : State 4 Memory Access add ax , bx ax bx add AX BX 3 add ax,bx 8 7 1 3 1 4 9 Comp 1017 Digital Technologies
0 1 2 3 4 Fetch-Exec : State 5 Register Write add ax , bx ax bx add BX 3 add ax,bx 4 8 7 1 3 1 4 9 Comp 1017 Digital Technologies
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 Comp 1017 Digital Technologies
0 1 2 3 4 Fetch-Exec : State 1 Instruction Fetch mov ax , [1] mov ax 1 mov ax , [1] 3 8 7 1 9 Comp 1017 Digital Technologies
0 1 2 3 4 Fetch-Exec : State 2 Decode, Register Operations mov ax , [1] mov ax 1 mov ax , [1] 3 8 7 1 9 Comp 1017 Digital Technologies
0 1 2 3 4 Fetch-Exec : State 3 ALU Operation mov ax , [1] mov ax 1 mov ax , [1] 3 8 7 1 1 9 Comp 1017 Digital Technologies
0 1 2 3 4 Fetch-Exec : State 4 Memory Access mov ax , [1] mov ax 1 mov ax , [1] 3 8 8 7 1 1 9 Comp 1017 Digital Technologies
0 1 2 3 4 Fetch-Exec : State 5 Register Write mov ax , [1] mov ax 1 mov ax , [1] 3 8 8 8 7 1 1 9 Comp 1017 Digital Technologies
1 Pentium 2 • Fetch • Decode • ALU • Mem Ops • Reg Write 3 4 5 Comp 1017 Digital Technologies
Code Memory Programmable Electronics The first microprocessor A dedicated design ... Lots of Electronics Keypad LCD Display ... or a re- usable design Keypad LCD Display Comp 1017 Digital Technologies