181 views
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 weather value stored in register is same as adress that register points.
0
please answer. it would be a great help.

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.
0
"value of R4 with  0 offset".
you mean  it has nothing to do with #400 of 1st instruction?
0
Actual syntax is a bit long and the question is of pipeline topic.
0
It does - the purpose of this is to load 400 into R1. The () denotes that value of R1 is loaded.
0
ok. if in place of 0 we have got anyother value (! 0)  then we cannot tell what will loaded. right?
0
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
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
what about 4th instruction? architecture is not given. I think, by default RISC architecture will be considered.

## Related questions

1
217 views
For Given machine instructions LW R4 #400 L1:LW R1, 0,(R4) LW R2 400(R4) ADDI R3, R1, R2 SW R3, 0(R4) SUB R4, R4, #4 BNZ R4, L1 on a 5 stage pipeline processor, 1 clock cycle per stage. how mAny clock cycles willtake execution of this segment on the regular architecture?
It was stated that the 2's complement of a binary number can be formed by lowing all the least significant 0's and the first 1 unchanged and complementing all the other higher significant bits, Design a serial 2's complementer using this procedure. The circuit needs a shift register to store ... be used to transfer the unchanged bits($x \oplus 0 = x$) or complement the bits ($x \oplus 1 = x'$).