Addressing Mode - Intro to Computer Architecture - Homework, Exercises of Computer Architecture and Organization

In the course of intro to computer architecture, the main points are:Addressing Mode, 16-Bit Number, 24-Bit Instruction, Auto-Increment Register-Indirect Addressing Mode, Speed Efficiency, Appropriate Register, Multiplication Technique, Division Technique, Non-Restoring Division

Typology: Exercises

2012/2013

Uploaded on 05/06/2013

anurati
anurati 🇮🇳

4.2

(24)

121 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
1. [add ext blankblank blank ]
Semantics: r1r0
r1r0
r3r2where r1r0means the 16-bit number formed by concatenating r1s data
to r0’s data with the latter being the LS-byte and the
former
the MS-byte. (r2r3is similarly defined).
add ext opcode = 001111
2. (a) Design the format of a 24-bit instruction to perform a load word lw+ using the auto-increment
register-indirect addressing mode with the semantics ri
Mem
rj
;rj
rj
X. Note the initial (non-
incremented) value of rjis to be used for the address of the data word to be obtained from memory.
Clearly explain the format and what it means. Next, design the CU states for executing the lw+
instruction.
lw+ opcode = 010000
Hint: Just like in the sw instruction from Project 1, the 1st or least significant 2 bytes will have the
opcode and other information that the CU needs immediately to start processing the first part of the
instruction (ri
Mem
rj
). The last (most significant) 8 bits of the instruction can be fetched after
the initial part is done and loaded into an appropriate register (mdr, ir0, ir1, etc.) so that it enables the
2nd part of the instruction (rj
rj
X) to be completed.
(b) Comment on the speed efficiency of using the 24-bit lw+ instruction above versus using two 16-bit
instructions load ind and add imm (you did these in Project 1) to accomplish the same effect as the lw+
instruction.
3. [mul slow rirjrk] type 1
Semantics: ri
rj
rkusing the slow multiplication technique given below (repeated addition with
no shifting). Note that either of rj,rkcould be negative.
mul slow opcode = 010001
Docsity.com
pf3

Partial preview of the text

Download Addressing Mode - Intro to Computer Architecture - Homework and more Exercises Computer Architecture and Organization in PDF only on Docsity!

  1. [add ext blank blank blank ]

Semantics: r 1 r 0 r 1 r 0  r 3 r 2 where r 1 r 0 means the 16-bit number formed by concatenating r 1 ’s data

to r 0 ’s data with the latter being the LS-byte and the

former the MS-byte. ( r 2 r 3 is similarly defined). add ext opcode = 001111

  1. (a) Design the format of a 24-bit instruction to perform a load word lw+ using the auto-increment

register-indirect addressing mode with the semantics ri  Mem  r j ; r j  r j  X. Note the initial (non-

incremented) value of r (^) j is to be used for the address of the data word to be obtained from memory. Clearly explain the format and what it means. Next, design the CU states for executing the lw+ instruction. lw+ opcode = 010000 Hint : Just like in the sw instruction from Project 1, the 1st or least significant 2 bytes will have the opcode and other information that the CU needs immediately to start processing the first part of the

instruction ( ri  Mem  r j ). The last (most significant) 8 bits of the instruction can be fetched after

the initial part is done and loaded into an appropriate register (mdr, ir0, ir1, etc.) so that it enables the

2nd part of the instruction ( r j  r j  X ) to be completed.

(b) Comment on the speed efficiency of using the 24-bit lw+ instruction above versus using two 16-bit instructions load ind and add imm (you did these in Project 1) to accomplish the same effect as the lw+ instruction.

  1. [mul slow ri r (^) j rk ] – type 1

Semantics: ri  r j  rk using the slow multiplication technique given below (repeated addition with

no shifting). Note that either of r (^) j , rk could be negative. mul slow opcode = 010001

  1. [div slow ri r (^) j rk ] – type 1

Semantics: ri  r j  rk using the slow division technique given below (repeated subtraction with no

shifting). Note that either of r (^) j , rk could be negative. div slow opcode = 010010

  1. [div fast ri r (^) j rk ] – type 1

Semantics: ri   r j  rk using the fast non-restoring division technique (see lecture notes on “Iterative

Division”). div fast opcode = 010011 For division, also assume that the D and V specified in r (^) j , rk are unsigned integers represented in 7 bits (MSB–bit 7– is 0, while the numbers are represented in bits 6 to 0). This is needed in order to get the negative V (for subtraction) in 2’s complement that is representable in 8 bits (this is automatically

done by choosing alu sel SUB so you don’t have to worry about it).

For the (slow) multiplication instruction use the following method for performing c a  b :

1. c 0; sign 0

2. If b 0 then b ^ b /* convert b to a +ve # */

sign = not(sign) 

  1. if (b == 0) then goto step 5 /* final result is in c */

else c c  a

4. b b 1; goto step 3.

5. if (sign=1) then c ^ c /* restore correct sign to the result */

For the slow division instruction use the following method for performing c  a  b (we assume b  0):

1. c 0; sign 0

2. If b 0 then b ^ b /* convert b to a +ve # */

sign = not(sign) 

3. If a 0 then a ^ b /* convert a to a +ve # */

sign = not(sign) 

4. a a b

If ( a 0) then goto step 6 /* quotient is in c */

else c c  1; goto step 4