0% found this document useful (0 votes)
23 views9 pages

Lab#2 Completed

Uploaded by

Haris Sardar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views9 pages

Lab#2 Completed

Uploaded by

Haris Sardar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

SWE 212L Computer Organization and

Architecture
Fall 2021

Name: Muhammad Owais Raza

Roll No.: 2020F-BSE-151

Section: D

Lab Teacher:

Software Engineering Department


Sir Syed University of Engineering & Technology
Main University Road , Karachi 75300 http://www.ssuet.edu.pk
Lab Objective Signature Remarks
No.
1 To Understand and explore Visible Virtual Machine
(VVM).
2 To learn VVM Programming and simulate VVM
program using Basic I/O instructions.
3 To Perform basic Arithmetic Operations (Add and Sub)
using Visible Virtual Machine) VVM
4 To understand Branching and simulate VVM Programs
using ”BRP” , “BRZ” & “BR” instructions.
5 To introduce MIPS Assembly Language Programming
using MARS Software (MIPS simulator).

6 To get familiar with addressing modes of MIPS


architecture.
7 To Study and implement basic MIPs Arithmetic
Instructions (add,Sub,Mul and Div) using MARS
Simulator.
8 To Implement MIPS conditional instructions using
MARS Simulator
9 To Study and simulate MIPS bit manipulation
instructions OR & AND .
10 To Learn to use MIPS bit manipulation instructions
XOR.
11 To Study how to implement translation of“if then else”
control structures in MIPS assembly language.
12 To Study how to implement translation of“for
loop”control structures in MIPS assembly language.
13 To introduce how to implement array as an abstract
data structure in MIPS assembly language.
14 To Study how to implement translation of a “switch”
control structure in MIPS assembly language.
LAB # 2
OBJECTIVE
To Perform basic Arithmetic Operations (Add and Sub) using Visible Virtual Machine) VVM

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.)

Embedding Data in Programs

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.

VVM Program Example 2

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).

// A sample VVM Assembly program // to add a


number to the value -1.
IN Input number to be added
ADD 99 Add value stored at address 99 to input
OUT Output result
HLT Halt (program ends here)
*99 Next value loaded at address 99
DAT -001 Data value

This same program could be written in VVM Machine Language format as follows:

// The Machine Language version


901 Input number to be added
199 Add value stored at address 99 to
input 902 Output result
000 Halt (program ends here)
*99 Next value loaded at address 99
-001 Data value
LAB TASK

1. Take 3 digits of your roll no. and add them.

INPUT:

OUTPUT:

Hardware view:
Trace view:

2. Take two numbers from users and subtract them.


INPUT:
OUTPUT:

Hardware view:

Trace view:
3. Solve given equation.

55 + 25 – 15 – 20

INPUT:

OUTPUT:

Hardware View:
Trace View:

You might also like