Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

mic 1 , assembly, C program. I need help implementing a NAND instruction on my microcode. My C file had a switch case for NAND,

mic1, assembly, C program.
I need help implementing a NAND instruction on my microcode. My C file had a switch case for NAND, and my assembly file has instructions for NAND, but my microcode file doesnt, and I dont know how to implement it.Here is my microcode.mc file:
0: mar := pc; rd;
1: pc :=1+ pc; rd;
2: ir := mbr; if n then goto 28;
3: tir := lshift(ir + ir); if n then goto 19;
4: tir := lshift(tir); if n then goto 11;
5: alu := tir; if n then goto 9;
6: mar := ir; rd;
7: rd;
8: ac := mbr; goto 0;
9: mar := ir; mbr := ac; wr;
10: wr; goto 0;
11: alu := tir; if n then goto 15;
12: mar := ir; rd;
13: rd;
14: ac := ac + mbr; goto 0;
15: mar := ir; rd;
16: ac :=1+ ac; rd;
17: a := inv(mbr);
18: ac := a + ac; goto 0;
19: tir := lshift(tir); if n then goto 25;
20: alu := tir; if n then goto 23;
21: alu := ac; if n then goto 0;
22: pc := band(ir, amask); goto 0;
23: alu := ac; if z then goto 22;
24: goto 0;
25: alu := tir; if n then goto 27;
26: pc := band(ir, amask); goto 0;
27: ac := band(ir, amask); goto 0;
28: tir := lshift(ir + ir); if n then goto 40;
29: tir := lshift(tir); if n then goto 35;
30: alu := tir; if n then goto 33;
31: a := sp + ir;
32: mar := a; rd; goto 7;
33: a := sp + ir;
34: mar := a; mbr := ac; wr; goto 10;
35: alu := tir; if n then goto 38;
36: a := sp + ir;
37: mar := a; rd; goto 13;
38: a := sp + ir;
39: mar := a; rd; goto 16;
40: tir := lshift(tir); if n then goto 46;
41: alu := tir; if n then goto 44;
42: alu := ac; if n then goto 22;
43: goto 0;
44: alu := ac; if z then goto 0;
45: pc := band(ir, amask); goto 0;
46: tir := lshift(tir); if n then goto 50;
47: sp := sp +(-1);
48: mar := sp; mbr := pc; wr;
49: pc := band(ir, amask); wr; goto 0;
50: tir := lshift(tir); if n then goto 65;
51: tir := lshift(tir); if n then goto 59;
52: alu := tir; if n then goto 56;
53: mar := ac; rd;
54: sp := sp +(-1); rd;
55: mar := sp; wr; goto 10;
56: mar := sp; sp := sp +1; rd;
57: rd;
57: rd;
58: mar := ac; wr; goto 10;
59: alu := tir; if n then goto 62;
60: sp := sp +(-1);
61: mar := sp; mbr := ac; wr; goto 10;
62: mar := sp; sp := sp +1; rd;
63: rd;
64: ac := mbr; goto 0;
65: tir := lshift(tir); if n then goto 73;
66: alu := tir; if n then goto 70;
67: mar := sp; sp := sp +1; rd;
68: rd;
69: pc := mbr; goto 0;
70: a := ac;
71: ac := sp;
72: sp := a; goto 0;
73: alu := tir; if n then goto 76;
74: a := band(ir, smask);
75: sp := sp + a; goto 0;
76: tir := tir + tir; if n then goto 80;
77: a := band(ir, smask);
78: a := inv(a);
79: a := a +1; goto 75;
80: tir := tir + tir; if n then goto 111;
81: alu := tir + tir; if n then goto 103;
82: a := lshift(1);
83: a := lshift(a +1);
84: a := lshift(a +1);
85: a := lshift(a +1);
86: a := lshift(a +1);
87: a := a +1;
88: b := band(ir, a);
89: mar := sp; rd;
90: rd;
91: a := mbr;
92: c :=(-1);
93: d :=0;
94: alu := a; if n then goto 97;
95: c := c +1; goto 97;
96: alu := c; if z then goto 100;
97: b := b +(-1); if n then goto 101;
98: d := d + a; if n then goto 96;
99: alu := c; if z then goto 97;
100: ac :=(-1); goto 0;
101: mar := sp; ac :=0;
102: mbr := d; wr; goto 10;
103: a := lshift(1);
104: a := lshift(a +1);
105: a := lshift(a +1);
106: a := a +1;
107: b := band(ir, a);
108: b := b +(-1); if n then goto 110;
109: ac := rshift(ac); goto 108;
110: goto 0;
111: tir := tir + tir; if n then goto 155;
112: d :=1
113: mar := sp;
114: rd;
115: a := mbr;
116: b := sp +1;
117: mar := b; rd;
118: rd;
119: b := mbr; if z then goto 147;
120: alu := a; if n then goto 123;
121: alu := b; if n then goto 125;
122: goto 129;
123: a := inv(a);
124: a := a +1; goto 127;
125: b := inv(b);
126: b := b +1;
127: d := inv(d);
128: d := d +1; goto 120;
129: c :=0
130: b := inv(b);
131: b := b +1;
132: e := a;
133: a := a + b; if n then goto 135;
134: c := c +1; goto 132;
135: f := sp +(-1);
136: mar := f;
137: mbr := e; wr;
138: wr;
139: alu := d; if n then goto 144;
140: f := f +(-1);
141: mar := f;
142: mbr :
143: wr; goto 146;
144: c := inv(c);
145: c := c +1; goto 140;
146: ac :=0; goto 0;
147: f := sp +(-1);
148: mar := f;
149: mbr :=(-1); wr;
150: wr;
151: f := f +(-1);
152: mar := f; ac :=(-1);
153: mbr :=

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions