The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 407 Weeks Ago, 6 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
7.    Compare 0-, 1-, 2-, and 3-address machines by writing programs to compute X = (A + B ´ C) / (D − E ´ F)
for each of the four machines. The instructions available for use are as follows:
|
0 Address PUSH M |
1 Address LOAD M |
2 Address MOVÂ Â Â (X = Y) |
3 Address MOVÂ Â Â Â (X = Y) |
|
POP M |
STORE M |
ADDÂ Â Â (X = X+Y) |
ADDÂ Â Â Â (X = Y+Z) |
|
ADD SUB MUL |
ADD M SUB M MUL M |
SUBÂ Â Â Â (X = X-Y) MULÂ Â Â (X = X*Y) DIVÂ Â Â Â Â (X = X/Y) |
SUBÂ Â Â Â Â (X = Y-Z) MULÂ Â Â Â (X = Y*Z) DIVÂ Â Â Â Â Â (X = Y/Z) |
|
DIV |
DIV M |
 |
 |
Â
M is a 16-bit memory address, and X , Y , and Z are either 16-bit addresses or 4-bit reg- isters. The 0-address machine uses a stack, the 1-address machine uses an accumula- tor, and the other two have 16 registers and instructions operating on all combinations of memory locations and registers. SUB X,Y subtracts Y from X and SUB X,Y,Z subtracts Z from Y and puts the result in X . With 8-bit opcodes and instruction lengths that are multiples of 4 bits, how many bits does each machine need to compute X ?
Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â----------- Th-----------ank----------- Yo-----------u f-----------or -----------usi-----------ng -----------our----------- we-----------bsi-----------te -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill-----------