You are on page 1of 3

Slow learners – Assignment 3 Submit in cabin on 16.2.23(before 5.

00pm)

1. Write an Assembly language programming for the following expressions using IAS computer
Instruction set and interpret to the flow of IAS computer

1. A=(B-C)*D

2. A=B*(C+D)

3. A=(B-C)/D

4. A=B/(C+D)

5. A=-(B+C-D)

6. A=(B*2)/2

Make necessary assumptions.

2. A two-word instruction is stored in memory at an address designated by the symbol W. The


address field of the instruction (stored at W + 1) is designated by the symbol Y. The operand used
during the execution of the instruction is stored at an address symbolized by Z. An index register
contains the value X. State how Z is calculated from the other addresses if the addressing mode of
the instruction is

 Direct

 Indirect

 Relative

 Indexed

3. A relative mode branch type of instruction is stored in memory at an address equivalent to


decimal 750. The branch is made to an address equivalent to decimal 500. What should be the value
of the relative address field of the instruction (in decimal)?

4. An instruction is stored at location 300 with its address field at location 301. The address field has
the value 400. A processor register R1 contains the number 200. Evaluate the effective address if the
addressing mode of the instruction is (a) direct; (b) immediate (c) relative (d) register indirect; (e)
index with R1 as the index register.

5. Assume that in a certain byte-addressed machine all instructions are 32 bits long. Assume the
following state of affairs for the machine: Fill in the following table:
6. Consider two different machines with two different instruction set both which have a clock
rate of 200MHZ. The following measurements are recorded on the two machines running a
given set of bench mark programs.
Instruction Instruction Cycles per
Type count Instruction
Machine A
ALU 8 1
Load &
4 3
Store
Branch 2 4
Others 4 3
Machine B
ALU 10 1
Load &
8 2
Store
Branch 2 4
Others 4 3

a. Determine the effective CPI, MIPS rate and execution time for each machine.
b. Comment on result.
7. Write a IAS machine structure for the following:
main () {
int a=15, b=5, c;
if (a >= b)
c = a – b;
else
c = a + b;
}

8. Consider two different machines, with two different instruction sets, both of which have a clock
rate of 40 MHz processor.

Instruction Type Instruction Count Cycles per Instruction


Machine A
Integer arithmetic 45000 1
Data transfer 32000 2
Floating point 15000 2
Control transfer 8000 2
Machine B
Integer arithmetic 48000 1
Data transfer 45000 2
Floating point 15000 4
Control transfer 8000 3

(a) Determine the effective CPI, MIPS rate, and execution time for this program.
(b) Comment on the results.

9. Write a program to evaluate the arithmetic statement:


X =( A+ B)∗(T + Q)
a. Using a general register computer with three address instructions.
b. Using a general register computer with two address instructions.
c. Using an accumulator type computer with one address instructions.
d. Using a stack organized computer with Zero-address operation instructions.

10. The two-word instruction at address 300 and 301 is load to Accumulator with address field equal
to 400. Program Counter has the value 300 for fetching the instruction. The content of processor
register is 500 and the content of index register is 202. The memory content at each of these
addresses as shown in Table.

Address Memory Address Memory

300 Load to AC 500 700


301 400 600 250
302 Next Instruction 601 390
400 600 602 900
499 450 700 825

Compute the effective address and operand for the following addressing modes:

Direct address, Indirect address, Index address, Relative address, Autoincrement and

Autodecrement.

You might also like