Understanding ARM MOV Register to Register Instruction

时间:2018-03-25 19:10:54

标签: assembly arm risc

I'm working on this question:

Given the [below] diagram of a generic RISC processor, describe the data flow for each instruction (assume ARM architecture):

mov r3, r1

Diagram:

RISC / Arm Diagram

My question is:

  • In ARM, do direct register to register MOVs copy the information directly from r1 to r3?

OR

  • Does the data from r1 have to go from the register through the multiplexer / ALU / Accumulator, etc. before being sent to r3? If so, what are the operands and operators involved?

I've spent a few hours researching this, including: - Documents DEN0013D, DDI0406C, and IHI0042F from ARM's website. - Stack overflow searches - Notes and slides from my course

Based on the lack of information I've been able to find, I've settled on an unsatisfying and unjustified answer that the data does go through the ALU (because it has to) and the operands are just the data from r1 and 0x0, and that they are added together.

I've heard about the register shifting that ARM can do, but I haven't been able to determine if that's applicable to my question.

Appologies if my searching was insufficient. I'd love to learn where I can improve!

Thanks!

2 个答案:

答案 0 :(得分:1)

It really depends on the processor, not all ARM CPUs will use the same mechanism. I don't think that you can find public information giving the details. Shift (by 0) and Add (with 0) are two possible solutions, but multiple more solutions are possible (ORR/XOR #0, AND 0xffffffff, ...)

Given the diagram you attached, it looks like the correct solution is an invariant ALU operation (ADD #0 and SHIFT #0 could be a solution) and a 0 accumulator.

Anyway it looks like there is no specific path from register bank to register bank for MOV operations.

答案 1 :(得分:0)

It depends on the precise architecture involved, but for the 'generic' architecture shown in your diagram, you are (mostly) correct -- the mov instruction will take the value from the source register through the multiplexers and alu to write it back to the destination register.

Generally it won't do an add in alu -- it will instead have a dedicated 'move' instruction in the alu that just copies the left operand to the alu output, ignoring the right operand, as that uses (slighly) less power than running an add instruction to add 0.