简体   繁体   中英

One Bus Instructions for Arm Instructions

I am currently trying figure out one instructions given each clock cycle using an ARM processor. I have been introduced to these concepts twice now and have yet to find anyone who teaches it properly. Currently I am trying to figure out the instructions:

1). LSR R0, R1, #2; 2). cmp R5, R6;

and I need to determine the machine code and then schedule the above instructions on the one bus machine.

Any help is appreciated!

Machine Code

The ARM Architecture Reference Manual specifies the machine code for instructions. Page A7-68 describes the format for an LSR instruction with an immediate input.

//I can't post an image because of low reputation
Bit - 15 14 13 12 11 | 10           6 | 5     3 | 2     0
Val -  0  0  0  0  1 |     immed_5    |    Rm   |   Rd

Syntax
LSR <Rd>, <Rm>, #<immed_5>
where:
<Rd> Is the destination register for the operation.
<Rm> Is the register containing the value to be shifted.
<immed_5> Specifies the shift amount, in the range 1 to 32. 
Shifts by 1 to 31 are encoded directly in immed_5.
A shift by 32 is encoded as immed_5 == 0.

With your instruction, immed_5 = 00010, Rm = 001, and Rd = 000

So the binary instruction is: 00001 00010 001 000

or in hex: 0x0111 .


One Bus Scheduling

To goal of scheduling an instruction on a one bus machine is to specify which registers are putting data on the bus, which registers are reading data from the bus, and in what order this should occur. An important thing to remember is that only one value should be put on the bus at a time.

Here is an example scheduling using your first instruction. This uses X as an ALU input register, and Y as an ALU output register. This also assumes ALUsll will left shift the value on the bus by the value stored in X.

LSR R0,R1,#2

Get the instruction into the Instruction Register

  1. PCout, MARin, MEMread
    Access memory location of current instruction
  2. MDRlatch
    Load the value from memory into MDR
  3. MDRout, IRin
    Let the instruction into instruction register

Perform instruction specific operations

  1. IRimmediateout, Xin
    Put the immediate value (#2) from the instruction into X
  2. R1out, ALUsll, Yin
    Put the value from R1 on the bus, tell the ALU to shift, and store the result in Y
  3. Yout, R0in Store the result into R0

Advance the PC for the next instruction

  1. PCout, SetXto2, ALUadd, Yin
  2. Yout, PCin

You can use these same methods to determine the machine code translation and one-bus scheduling of any other ARM instruction.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM