You are on page 1of 2

ID: bc190201210

Name: Haris Siddiqui


Assignment No.1: CS501 Advanced Computer Architecture
Marks: 20
Question No.1:
Write the instructions for both 0-address and 3-address machines to evaluate the
following expression.

y = a3 – b3 – 3ab
Note: a, b, and c represent memory locations.

Solution No.1:

3-Adress Machines 0-Adress Machine


MUL c,a,a PUSH a
MUL d,c,a PUSH a
PUSH a
MUL e,b,b MUL
PUSH b
MUL f,e,b PUSH b
PUSH b
SUB g,d,f MUL
SUB
MUL h,3,a PUSH 3
MUL i,h,b PUSH a
PUSH b
SUB j,g,i MUL
SUB
POP Y .: Y=a3-b3-3ab
Question No.2:
Identify the following SRC machine language instructions and specify the values
in the fields

Instruction Type ra rb rc c1 c2 c3
sub R6, R3, R2
str R8, 34
ld R2, 64
stop
shc R3, R4, 3
not R2, R5

Solution No.2:

Instructio Typ ra rb rc c1 c2 c3
n e
sub R6, R3, D R6 R3 R2
- - -
R2
str R8, 34 C R8 34
- - - -
ld R2, 64 C R2 64
- - - -
stop A
- - - - - -
shc R3, R4, 3 D R3 R4 3
- - -
not R2, R5 D R2 R5
- - - -

We know that: By Question number (2) we know about all the


instruction of Subtraction, Addition and more other operations who ask
in above question. Using these operations we can easily find the (SRC
machine language instructions such as instructions
(type,ra,rb,rc,c1,c2,c3).

You might also like