Function Is Add-Immediate Instruction

The Add-Immediate Instruction function represents an add-immediate (ADDI) instruction with source src, immediate imm, and destination dst

Format:

an ADDI instruction with src: src imm: imm and dst: dst

Input:

number dst - destination memory cell
number src - source memory cell (left operand)
number imm - constant value (right operand)

Output:

any - None

Details:

The ADDI instruction tells the computer to add a number stored in memory with a constant value. Using the Is Add-Immediate Instruction function, we can make claims about the computer's state. Consider the following simulator:
Instructions
Memory Cells
Program Counter Time
0 0
LW Computer Simulator

We can make the following claim:

instruction #2 is an ADDI instruction with src: 1 imm: 5 and dst: 2

Conditional properties that reference this function:

  • if the following are true:
    • the instruction at computer c and index i = an ADDI instruction with src: src imm: imm and dst: dst
    • the PC at computer c and time t = i

    then byte at ID: c, cell #dst at time (t + 1) = (byte at ID: c, cell #src at time t) + imm

    (link)
  • if the following are true:
    • the instruction at computer c and index i = an ADDI instruction with src: src imm: imm and dst: dst
    • the PC at computer c and time t = i
    • not (other = dst)

    then byte at ID: c, cell #other at time (t + 1) = byte at ID: c, cell #other at time t

    (link)
  • if the following are true:
    • the instruction at computer c and index x = an ADDI instruction with src: d imm: imm and dst: s
    • the PC at computer c and time t = x

    then the PC at computer c and time (t + 1) = x + 1

    (link)


Comments

Please log in to add comments