ADD Instruction Property
The Add (ADD) instruction contains the following information:
- source one (src1) - Memory cell number of the first operand.
- source two (src2) - Memory cell number of the second operand
- destination (dst) - Memory cell number where the sum will be stored.
if the following are true:
- instruction #i is
add dst=d src1=s1 src2=s2
- the PC at time t = i
then value of cell d at time (t + 1) = (value of cell s1 at time t) + (value of cell s2 at time t)
Instructions
Memory Cells |
---|
Program Counter | Time |
---|---|
0 | 0 |
LW Computer Simulator
PC is 0, so the simulator is going to execute instruction #0. The src1 is 1 and src2 is 2. Thus, the operation is
value at memory cell #1 + memory cell #2
= 2 + 6
= 8
dst is 3, which means the result will be stored in memory cell #2.
This behavior can be expressed as follows:
if the following are true:
- instruction #0 is
add dst=3 src1=1 src2=2
- the PC at time 0 = 0
then value of cell 3 at time (0 + 1) = (value of cell 1 at time 0) + (value of cell 2 at time 0)
Comments
Please log in to add comments