REGISTER R = <uninitalized> the register cannot be written into directly, the register…
Private research annotation
Sign in to add a private research label or note.
- User
REGISTER R =
the register cannot be written into directly, the register only supports the following operations:
R.reset() => sets the register to R=0. R.add(x) => sets the register to R=R+x R.sub(x) => sets the register to R=R-x R.mul(x) => sets the register to R=R*x a = R.read() => sets the value a to the register content R
Execute the program:
c = 100 b = 123
R.reset() R.add(c) R.sub(b) b = R.read()
Assistant
Initialization and Execution of the Program
Initial Values
cis initialized with a value of100.bis initialized with a value of123.- The register
Ris uninitialized.
Operations on the Register
The following operations are performed on the register
R:-
R.reset(): Resets the registerRto0.code
R = 0
code2. `R.add(c)`: Adds the value of `c` to the current value of the register `R`.R = R + c R = 0 + 100 R = 100
code3. `R.sub(b)`: Subtracts the value of `b` from the current value of the register `R`.R = R - b R = 100 - 123 R = -23
code4. `b = R.read()`: Assigns the current value of the register `R` to `b`.b = R b = -23
code