Chapter 5 Questions

2.       Design an expanding opcode to allow all the following to be encoded in a 36-bit instruction:

7 instructions with two 15-bit addresses and one 3-bit register number

500 instructions with one 15-bit address and one 3-bit register number

50 instructions with no addresses or registers

 

 

 

3.      Is it possible to design an expanding opcode to allow the following to be encoded in a 12-bit instruction?  A register is 3 bits.

4 instructions with 3 registers

255 instructions with one register

16 instructions with zero registers

 

 

 

4.  A certain machine has 16-bit instructions and 6-bit addresses.  Some instructions have one address and others have two.  If there are n two-address instructions, what is the maximum number of one-address instructions?

It would have a max of 15 one-address instructions.

 

9.  Convert the following formulas from infix to reverse Polish notation.

a.  A+B+C+D+E                =  ABCDE++++

b.  (A+B)X(C+D)+E            =  AB+CD+*E+

c.  (A*B)+(C*D)+E            =  AB+CD+*E+

d.  (A-B)x(((C-D*E)/F)/G)*H  =  AB-CDE*-F/G/*H*

 

10.  Convert the following reverse Polish notation formulas to infix.3

a.  AB+C+D*          = (A+B+C)*D

b.  AB/CD/+          = (A/B)+(C/D)

c.  ABCDE+**/        = ((((D+E)*C)*B)/A)

d.  ABCDE*F/+G-H/*+  = ((((C+((D*E)/F))-G)/H)*B)*A

 

16. How many registers does the machine whose instruction formats are given in Fig.5-24 have?

25 = 32 registers

23.  For the 16-bit binary number 1001 0101 1100 0011, show the effect of:

  1. A right shift of 4 bits with zero fill.
  2. A right shift of 4 bits with sign extension.
  3. A left shift of 4 bits.
  4. A left rotate of 4 bits.
  5. A right rotate of 4 bits
  1. 0000 1001 0101 1100
  2. 1111 1001 0101 1100
  3. 0101 1100 0011 0000
  4. 0101 1100 0011 1001
  5. 0011 1001 0101 1100

24.  How can you clear a memory word on a machine with no CLR instruction?

Subtract it from itself and store it, or shift it with a zero fill