Write microcode for the Mic 1 to implement the IJVM DUPTWO i

Write microcode for the Mic- 1 to implement the IJVM DUPTWO instruction. This instruction copies the current top word on stack and pushes it onto stack two times.

Solution

0 BEGIN: mar:=pc; rd;

1 pc:=pc + 1; rd;

2 L0or1: ir:=mbr; if n then goto L10or11;

3 L00or01: tir:=lshift(ir + ir); if n then goto L010or011;

4 L000or001: tir:=lshift(tir); if n then goto L0010or0011;

5 L0000or0001: alu:=tir; if n then goto STOD;

6 LODD: mar:=ir; rd; #0000 = LODD

7 contLODL: rd;

8 ac:=mbr; goto BEGIN;

9 STOD: mar:=ir; mbr:=ac; wr; #0001 = STOD

10 contWR: wr; goto BEGIN;

11 L0010or0011: alu:=tir; if n then goto SUBD; #ADDD or SUBD?

12 ADDD: mar:=ir; rd; #0010 = ADDD

13 contADDL: rd;

14 ac:=mbr + ac; goto BEGIN;

15 SUBD: mar:=ir; rd; #0011 = SUBD

16 contSUBL: ac:=ac + 1; rd;

17 a:=inv(mbr);

18 ac:=ac + a; goto BEGIN;

19 L010or011: tir:=lshift(tir); if n then goto L0110or0111;

20 L0100or0101: alu:=tir; if n then goto JZER;

21 JPOS: alu:=ac; if n then goto BEGIN; #0100 = JPOS

22 contJUMPS: pc:=band(ir,amask); goto BEGIN;

23 JZER: alu:=ac; if z then goto contJUMPS; #0101 = JZER

24 goto BEGIN;

25 L0110or0111: alu:=tir; if n then goto LOCO;

26 JUMP: pc:=band(ir,amask); goto BEGIN; #0110 = JUMP

27 LOCO: ac:=band(ir,amask); goto BEGIN; #0111 = LOCO

28 L10or11: tir:=lshift(ir + ir); if n then goto L110or111;

29 L100or101: tir:=lshift(tir); if n then goto L1010or1011;

30 L1000or1001: alu:=tir; if n then goto STOL;

31 LODL: a:=ir + sp; #1000 = LODL

32 mar:=a; rd; goto contLODL;

33 STOL: a:=ir + sp; #1001 = STOL

34 mar:=a; mbr:=ac; wr; goto contWR;

35 L1010or1011: alu:=tir; if n then goto SUBL;

36 ADDL: a:=ir + sp; #1010 = ADDL

37 mar:=a; rd; goto contADDL;

38 SUBL: a:=ir + sp; #1011 = SUBL

39 mar:=a; rd; goto contSUBL ;

40 L110or111: tir:=lshift(tir); if n then goto L1110or1111;

41 L1100or1101: alu:=tir; if n then goto JNZE;

42 JNEG: alu:=ac; if n then goto contJUMPS; #1100 = JNEG

43 goto BEGIN;

44 JNZE: alu:=ac; if z then goto BEGIN; #1101 = JNZE

45 pc:=band(ir,amask); goto BEGIN;

46 L1110or1111: tir:=lshift(tir); if n then goto F0orF1;

47 CALL: sp:=sp + (-1); #1110 = CALL

48 mar:=sp; mbr:=pc; wr;

49 pc:=band(ir,amask); wr; goto BEGIN;

50 F0orF1: tir:=lshift(tir); if n then goto F10orF11;

51 F00orF01: tir:=lshift(tir); if n then goto F010orF011;

52 F000orF001: alu:=tir; if n then goto POPI;

53 PSHI: mar:=ac; rd; #1111-0000 = PSHI

54 sp:=sp + (-1); rd;

55 mar:=sp; wr; goto contWR;

56 POPI: mar:=sp; sp:=sp + 1; rd; #1111-0010 = POPI

57 rd;

58 mar:=ac; wr; goto contWR;

59 F010orF011: alu:=tir; if n then goto POP;

60 PUSH: sp:=sp + (-1); #1111-0100 = PUSH

61 mar:=sp; mbr:=ac; wr; goto contWR;

62 POP: mar:=sp; sp:=sp + 1; rd; #1111-0110 = POP 63 rd;

64 ac:=mbr; goto BEGIN;

65 F10orF11: tir:=lshift(tir); if n then goto F110orF111;

66 F100orF101: alu:=tir; if n then goto SWAP;

67 RETN: mar:=sp; sp:=sp + 1; rd; #1111-1000 = RETN

68 rd;

69 pc:=mbr; goto BEGIN;

70 SWAP: a:=ac; #1111-1010 = SWAP

71 ac:=sp;

72 sp:=a; goto BEGIN;

73 F110orF111: tir:=lshift(tir); if n then goto F1110orF1111;

74 INSP: a:=band(ir,smask); #1111-1100 = INSP

75 contDESP: sp:=sp + a; goto BEGIN;

76 F1110orF1111: alu:=tir; if n then goto HALT; #HALT or DESP?

77 DESP: a:=band(ir, smask); #1111-1110 = DESP

78 a:=inv(a);

79 a:=a + 1; goto contDESP;

 Write microcode for the Mic- 1 to implement the IJVM DUPTWO instruction. This instruction copies the current top word on stack and pushes it onto stack two tim
 Write microcode for the Mic- 1 to implement the IJVM DUPTWO instruction. This instruction copies the current top word on stack and pushes it onto stack two tim
 Write microcode for the Mic- 1 to implement the IJVM DUPTWO instruction. This instruction copies the current top word on stack and pushes it onto stack two tim

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site