rsubli - 2024.2 English

MicroBlaze Processor Reference Guide (UG984)

Document ID
UG984
Release Date
2024-11-27
Version
2024.2 English
Figure 1. rsubli

Description

The contents of register rAL or rDL are subtracted from the value of IMM, sign extended with the immediate value from the preceding imml instructions, and the result is placed into register rDL. Bit 3 or 13 of the instruction (labeled as K in the figure) is set to one for the mnemonic rsublik. Bit 4 or 14 of the instruction (labeled as C in the figure) is set to one for the mnemonic rsublic. Both bits are set to one for the mnemonic rsublikc.

When an rsubli instruction has bit 3 or 13 set (rsublik, rsublikc), the carry flag will Keep its previous value regardless of the outcome of the execution of the instruction. If bit 3 or 13 is cleared (rsubli, rsublic), then the carry flag will be affected by the execution of the instruction.

When bit 4 or 14 of the instruction is set to one (rsublic, rsublikc), the content of the carry flag (MSR[C]) affects the execution of the instruction. When bit 4 or 14 is cleared (rsubli, rsublik), the content of the carry flag does not affect the execution of the instruction (providing a normal subtraction).

Pseudocode

if C = 0 then
   (rDL) ← sext(IMM) + (rAL|rDL) + 1
else
   (rDL) ← sext(IMM) + (rAL|rDL) + MSR[C]
if K = 0 then
   MSR[C] ← CarryOut64

Registers Altered

  • rDL
  • MSR[C]

Latency

  • 1 cycle

Notes

  • In subtractions, Carry = (Borrow). When the Carry is set by a subtraction, it means that there is no Borrow, and when the Carry is cleared, it means that there is a Borrow.
  • Type B arithmetic long instructions with three operands must be preceded by an imml instruction. See the instruction imml for details on using long immediate values.