Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

nios ii psedo-instruction and equivalent instruction

Hello,everyone.

I'm am learning nios ii instruction set.

Can anybody explain psedo-instruction and equivalent instruction,

for example( from Altera Nios ii processor reference handbook):

psedo-instruction equivalent instruction

bgt rA, rB, label blt rB, rA, label

bgt (psedo-instruction)

Operation: if ((signed) rA > (signed) rB)

then PC ←label

else PC ←PC + 4

Assembler Syntax: bgt rA, rB, label

blt (equivalent instruction)

Operation: if ((signed) rA < (signed) rB)

then PC &#8592;PC + 4 + &#963; (IMM16)

else PC &#8592;PC + 4

Assembler Syntax: blt rA, rB, label

bgt(psedo-instruction) and blt(equivalent instruction) are equivalent ?

When they are else statements, they are equivalent.

But, i think if conditons are met, they are not equivalent :

bgt : PC &#8592;label, however ,blt: PC &#8592;PC + 4 + &#963; (IMM16)

Can someone explain it ?

Best regards

hanshaohua

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    bgt (psedo-instruction)

    Operation: if ((signed) rA > (signed) rB)

    then PC &#8592;label

    else PC &#8592;PC + 4

    Assembler Syntax: bgt rA, rB, label

    blt (equivalent instruction)

    Operation: if ((signed) rA < (signed) rB)

    then PC &#8592;PC + 4 + &#963; (IMM16)

    else PC &#8592;PC + 4

    Assembler Syntax: blt rA, rB, label

    --- Quote End ---

    This is wrong whether in the original form or by transcription in this post. They are not equivalent, but this is not correct since it should be:

    rA > rB and rB < rA

    I see reference elsewhere to:

    bgt rA, rB, label

    is the same as

    blt rB, rA, label

    which is of course correct.

    Bill
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,bill.

    Can you explain it more clear ? I can't catch what you mean.

    :)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The pseudo-opcode

    bgt rA, rB, label

    is the same as

    blt rB, rA, label

    because rA < rB is the same as rB > rA

    You mention conditions where they are not equal which is true for what was in your original post, however your original post isn't correct.

    Bill
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    The pseudo-opcode

    bgt rA, rB, label

    is the same as

    blt rB, rA, label

    because rA < rB is the same as rB > rA

    You mention conditions where they are not equal which is true for what was in your original post, however your original post isn't correct.

    Bill

    --- Quote End ---

    Yes, thank you!