Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12748 Discussions

nios ii psedo-instruction and equivalent instruction

Altera_Forum
Honored Contributor II
1,535 Views

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
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
593 Views

 

--- 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
0 Kudos
Altera_Forum
Honored Contributor II
593 Views

Hi,bill. 

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

 

:)
0 Kudos
Altera_Forum
Honored Contributor II
593 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
593 Views

 

--- 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!
0 Kudos
Reply