the micro architecture level mic-1 architecture on tanenbaum’s book dept. of computer science...

46
The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

Upload: shanna-shepherd

Post on 19-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

The Micro Architecture Level

Mic-1 architecture on Tanenbaum’s book

Dept. of Computer ScienceVirginia Commonwealth University

Page 2: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 2 Hongsik Choi

Mic-1 block diagram

Page 3: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 3 Hongsik Choi

1. Why the C bus is represented as a bit map?

while B bus register is encoded in a 4 bit field

Only one register can be loaded onto B bus,

yet more than one register can be

selected to be loaded from C bus

Page 4: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 4 Hongsik Choi

2. Give a circuit diagram for “High bit”.

Simple answer?F =(JAMZ AND Z) OR (JAMN AND N) OR NEXT_ADDRESS[8]

Page 5: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 5 Hongsik Choi

Calculation of Next Address

JAMC

MBR7Addr7

MPC7

MBR0Addr0

MPC0

ZJAMZ

NJAMN

Addr8MPC8

Page 6: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 6 Hongsik Choi

Calculation of Next address

MPC points to the next microinstruction.it is computed from

Next_Address JAM fields

the ALU status N and Z, the MBR

If JMPC MPC[0:7] = Addr[0:7]

Else Addr[0:7] OR MBR[0:7].

MPC[8] = Addr[8] or

(JAMZ and Z) or

(JAMN and Z)

Page 7: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 7 Hongsik Choi

Calculation of Next Address

Page 8: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 8 Hongsik Choi

3. Next address = 0x1FF and use JMPC?

Does it make sense? What if Next address is 0xFF?

111111111 (Next Address)

bbbbbbbb (MBR)

No, Meaningless

Next address is usually, 0x00 or 0x100

Why?

Page 9: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 9 Hongsik Choi

4. What if add k=5 after IF?

K = 5

BIPUSH 5

ISTORE k

Page 10: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 10 Hongsik Choi

5 IJVM translation of i= k + n + 5

ILOAD k

ILOAD n

IADD

BIOUSH 5

IADD

ISTORE i

ILOAD k

ILOAD n

BIOUSH 5

IADD

IADD

ISTORE i

kn

k+n k+n5

k k+n+5

kn

k k+n+5k

5n+5

Page 11: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 11 Hongsik Choi

6. Give the JAVA statement

ILOAD j

ILOAD n

ISUB

BIPUSH 7

ISUB

DUPIADD

ISTORE i

jn

j-n j-nj7

j-n-7 j-n-7j-n-7

2(j-n-7)

i = j-n-7 + j-n-7

Page 12: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 12 Hongsik Choi

7. Is it possible?

If (Z) go to L1; else go to L2 // on page 259

0x75

0x140

0x40

Z : upper half or lower half

Page 13: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 13 Hongsik Choi

8.Why not: if_cmpeq3 Z = TOS-MDR;rd

If_icmpeq1 MAR=Sp=Sp-1; rd

If_icmpeq2 MAR=SP=SP-1

If_icmpeq3 H=MDR; rd

If_icmpeq4 OPC = TOS

If_icmpeq5 TOS = MDR

If_icmpeq6 Z=OPC-H; if (Z) go to T; else go to F

The only possible subtrahend is H

Page 14: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 14 Hongsik Choi

9. How long it will takes?

i = j+ k; w/ 2.tGHz Mic1

ILOAD(6)

ILOAD(6)

IADD(4)

ISTORE(7)

23microinstructions *0.4nsec = 9.2 nsec

2.5GHz means 1 cycle / (1 / 2.5* G)sec = 0.4nanosec

ILOAD j

ILOAD k

IADD

ISTORE

Main PC = PC +1; fetch; go to (MBR)

Iload1 H=LV

Iload2 MAR=MBRU+H; rd

Iload3 MAR=SP=SP+1

Iload4 PC = PC +; fetch; wr

Iload5 TOS = MDR; go to main

Main PC = PC +1; fetch; go to (MBR)

IADD1 MAR=SP = SP-1; rd;

IADD2 H=TOS

IADD3 MDR = TOS+MDR-H;wr; goto main

Main PC = PC +1; fetch; go to (MBR)

ISTORE1 H=LV

ISTORE2 MAR=MBRU+H

ISTORE3 MDR=TOS; wr

ISTORE4 SP=MAR=SP-1; wr

ISTORE5 PC = PC +1; fetch

ISTORE6 TOS = MDRT; goto main

Page 15: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 15 Hongsik Choi

Microinstruction

Page 16: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 16 Hongsik Choi

Microinstruction

Page 17: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 17 Hongsik Choi

Microinstruction: load k

ILOAD K 0x15 0x03

Page 18: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 18 Hongsik Choi

Microinstruction: iadd

IADD 0x60

Page 19: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 19 Hongsik Choi

Microinstruction: istore

ISTORE I 0x36 0x01

Page 20: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 20 Hongsik Choi

Microinstruction: Homework

by Nov 28

Page 21: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 21 Hongsik Choi

10 speed with Mic-2

Mic1 : 2 bus architecture

Mic2 : simplified decoding, 3 bus, IFU

Mic3 : 4 stage pipeline

Mic4 : 7 state pipeline

What is common?

PC is passed through the CPU and incremented

PC is used to fetch next byte

Operands are read from memory

Operand are written to memory

ALU does computation and results are stored back

IFU (Instruction Fetch Unit)

Independently increment PC and fetch next byte

(assemble 8 and 16 bit operands)

Depends on the opcode make available the next 8 or 16 bit whether or not doing so makes sense.

Page 22: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 22 Hongsik Choi

Mic-2

Page 23: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 23 Hongsik Choi

How to design IFU?

Fetch 4 bytes and load into shifter

Feed into MBR1 and MBR2

Whenever PC is changed, IFU must be changed

Page 24: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 24 Hongsik Choi

ILOAD(6)

ILOAD(6)

IADD(4)

ISTORE(7)

23microinstructions *0.4nsec = 9.2 nsec

2.5GHz means 1 cycle / (1 / 2.5* G)sec = 0.4nanosec

ILOAD(3)

ILOAD(3)

IADD(3)

ISTORE(5)

23microinstructions *0.4nsec = 9.2 nsec

2.5GHz means 1 cycle / (1 / 2.5* G)sec = 0.4nanosec

Main PC = PC +1; fetch; go to (MBR)Iload1 H=LVIload2 MAR=MBRU+H; rdIload3 MAR=SP=SP+1Iload4 PC = PC +; fetch; wrIload5 TOS = MDR; go to main

Iload1 MAR = LV + MBR1U;rd

Iload2 MAR=SP=SP+1

Iload3 TOS=MDR;wr;goto(MBR1)

as in Fig. 4-30 pp282-283

14 instn*0.4 = 5.6 nanosec

5.6/9.2 = x/100

x = 60.87sec

Page 25: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 25 Hongsik Choi

11 Write microcode for POPTWO

PopTwo1 SP=SP−1

PopTwo2 MAR=SP=SP−1; rd

PopTwo3

PopTwo4 TOS=MDR; gotoMain1

Pop1 MAR = SP -1; rd

Pop2

Pop3 TOS = MDR; goto Main

Page 26: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 26 Hongsik Choi

12 loading locals 0- through 4

Special 1 byte opcodes for loading locals 0 to 3 onto the stack instead of ILOAD.

How should modify IJVM to make the best use of it.

Local 0 is the link pointer, (rarely used)

Let LV point first local variables as an offset( -1)

Page 27: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 27 Hongsik Choi

13 ISHR (Arithmetic Shit Right)

Use top two values, replacing with one value, Second word is operand to be shifted. It should be shifted between o-31 depending on the value of first

Opcode for ISHR is 122 (0x7A)

a. What is the arithmetic operation equivalent to shit right with a count of 2?

b. Write microcode.

Floor(fisrst)/2second

3

13

00000…1101000000…110

00000000…1

0000000…11

Extra: due Nov. 29th ?

Page 28: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 28 Hongsik Choi

14 ISHL

Fisrst*2second

Page 29: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 29 Hongsik Choi

15 INVOKRVIRTUAL

It needs to know how many parameters. Why?

Compute the base address of the new local variable frame by subtracting off the number of parameters from the stack

pointer and setting LV to point to OBJREF

Page 30: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 30 Hongsik Choi

16 DLOAD in Mic-2

dload1 MAR = LV + MBR1U; rddload2 H = MAR + 1dload3 MAR = SP = SP +1; wrdload4 MAR = H; rddload5 MAR = SP = SP + 1; wrdlaod6 TOS = MDR; goto (MBR)

Page 31: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 31 Hongsik Choi

17 finite state machine

Page 32: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 32 Hongsik Choi

18 equivalents?

Page 33: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 33 Hongsik Choi

19 finite state machine

Page 34: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 34 Hongsik Choi

20 IFU with a 5 byte shifter register

Page 35: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 35 Hongsik Choi

21 larger shifter for IFU

Page 36: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 36 Hongsik Choi

22 Mic 2 : go to

Page 37: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 37 Hongsik Choi

23 speed with Mic-2

Page 38: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 38 Hongsik Choi

24 Mic-4

Page 39: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 39 Hongsik Choi

25 two level cache

Page 40: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 40 Hongsik Choi

26 3 way cache?

Page 41: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 41 Hongsik Choi

27 pipeline

Page 42: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 42 Hongsik Choi

28 prefetch

Page 43: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 43 Hongsik Choi

29 cycle 6

Page 44: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 44 Hongsik Choi

30 dependency in pipeline

Page 45: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 45 Hongsik Choi

31 Rewrite Mic-1 intepreter

Page 46: The Micro Architecture Level Mic-1 architecture on Tanenbaum’s book Dept. of Computer Science Virginia Commonwealth University

CMSC 312 Computer Organization 46 Hongsik Choi

32 write simulator