Lab#2 Completed
Lab#2 Completed
Architecture
Fall 2021
Section: D
Lab Teacher:
THEORY
The Language Instructions
The eleven operations of the VVM Language are described below. The Machine Language
codes are shown in parentheses, while the Assembly Language version is in square brackets.
o Load Accumulator (5nn) [LDA nn]The content of RAM address nn is copied to the
Accumulator Register, replacing the current content of the register. The content of RAM
address nn remains unchanged. The Program Counter Register is incremented by one.
o Store Accumulator (3nn) [STO nn] (or [STA nn]) The content of the Accumulator
Register is copied to RAM address nn, replacing the current content of the address. The
content of the Accumulator Register remains unchanged. The Program Counter Register
is incremented by one.
o Add (1nn) [ADD nn] The content of RAM address nn is added to the content of the
Accumulator Register, replacing the current content of the register. The content of RAM
address nn remains unchanged. The Program Counter Register is incremented by one.
o Subtract (2nn) [SUB nn] The content of RAM address nn is subtracted from the content
of the Accumulator Register, replacing the current content of the register. The content of
RAM address nn remains unchanged. The Program
Counter Register is incremented by one.
o No Operation (4nn) [NOP] (or [NUL]) This instruction does nothing other than
increment the Program Counter Register by one. The operand value nn is ignored in this
instruction and can be omitted in the Assembly Language format. (This instruction is
unique to the VVM and is not part of the original Little Man Model.)
Data values used by a program can be loaded into memory along with the program. In
Machine or Assembly Language form simply use the format "snnn" where s is an
optional sign, and nnn is the three-digit data value. In Assembly Language, you can
specify "DAT snnn" for clarity.
The VVM Load Directive
By default, VVM programs are loaded into sequential memory addresses starting with
address 00. VVM programs can include an additional load directive which overrides this
default, indicating the location in which certain instructions and data should be loaded in
memory. The syntax of the Load Directive is "*nn" where nn represents an address in
memory. When this directive is encountered in a program, subsequent program elements
are loaded in sequential addresses beginning with address nn.
A simple VVM Assembly Language program which adds an input value to the constant value -1
is shown below (note that lines starting with "//" and characters to the right of program
statements are considered comments, and are ignored by the VVM machine).
This same program could be written in VVM Machine Language format as follows:
INPUT:
OUTPUT:
Hardware view:
Trace view:
Hardware view:
Trace view:
3. Solve given equation.
55 + 25 – 15 – 20
INPUT:
OUTPUT:
Hardware View:
Trace View: