in CO and Architecture edited by
1,149 views
0 votes
0 votes
Given 2 machine instructions,

LW R4 #400

LW R1, 0,(R4)

IN second instruction what will be loaded in R1,is it the operand at memory location 400?or some random memory location operand..I want to clarify whether the value stored in register is same as adress that register points.
in CO and Architecture edited by
1.1k views

1 comment

please answer. it would be a great help.
0
0

1 Answer

1 vote
1 vote
It will not be some random value - the second instruction is an example of indexed addressing mode.

It means that the value of R4 with an offset of 0 will be loaded.

However, it varies from ISA to ISA - what the actual syntax of the instruction is.
by

4 Comments

edited by
ok. the complete question is something like..

LW R4#400

L1: LW R1, 0,(R4)

LW R2, 400(R4)
ADDI R3, R1, R2
SW R3, 0(R4)

SUB R4, R4, #4

BNEZ R4, L1

HOW MANY TIMES WILL THE LOOP RUN
0
0
I guess 100?

Inside the loop, we store the value stored at R4 and R4+400 in R1 and R2 respectively.

The third line doesn't make a lot of sense though - we are storing the contents of R3 into R4, but there's no mention of what R3 actually contains.

As I said, what is the instruction set architecture given? What do the instructions mean?

Can you post the entire question as a new question?
0
0
what about 4th instruction? architecture is not given. I think, by default RISC architecture will be considered.
0
0

Related questions