Homework 12

Instruction Sets

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

  • 15 instructions with two 12-bit addresses and one 4-bit register number
  • 650 instructions with one 12-bit address and one 4-bit register number
  • 80 instructions with no addresses or registers
2. Given the memory values below and a one-address machine with an accumulator, what values do the following instructions load into the accumulator?
  • word 20 contains 40
  • word 30 contains 50
  • word 40 contains 60
  • word 50 contains 70
  1. LOAD IMMEDIATE 20
  2. LOAD DIRECT 20
  3. LOAD INDIRECT 20
  4. LOAD IMMEDIATE 30
  5. LOAD DIRECT 30
  6. LOAD INDIRECT 30
3. 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 1 Address 2 Address 3 Address
PUSH M LOAD M MOV X,Y (X = Y) MOV X,Y (X = Y)
POP M STORE M ADD X,Y (X = X+Y) ADD X,Y,Z (X = Y+Z)
ADD ADD M SUB X,Y (X = X−Y) SUB X,Y,Z (X = Y−Z)
SUB SUB M MUL X,Y (X = X∗Y) MUL X,Y,Z (X = Y∗Z)
MUL MUL M DIV X,Y (X = X/Y) DIV X,Y,Z (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 registers. The 0-address machine uses a stack, the 1-address machine uses an accumulator, 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?

4. Compute the Boolean expression ( A AND B) OR C for

  • A = 1101 0000 1010 0011
  • B = 1111 1111 0000 1111
  • C = 0000 0000 0010 0000
5. Why do I/O devices place the interrupt vector on the bus? Would it be possible to store that information in a table in memory instead?

*

Topic revision: r2 - 2014-11-12 - JimSkon
 
This site is powered by the TWiki collaboration platformCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback