0% found this document useful (0 votes)
17 views3 pages

Lab1 and Lab2

The document outlines two lab assignments for a computer science course. Lab 1 involves loading a value from memory into a variable, while Lab 2 requires writing a program to compute an arithmetic expression using values stored in registers. Both labs provide specific memory addresses and register mappings for the tasks.

Uploaded by

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

Lab1 and Lab2

The document outlines two lab assignments for a computer science course. Lab 1 involves loading a value from memory into a variable, while Lab 2 requires writing a program to compute an arithmetic expression using values stored in registers. Both labs provide specific memory addresses and register mappings for the tasks.

Uploaded by

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

CSI 251 LABS

LAB 1
The assignment is to load the value of variable X from a memory location
and save the value in variable Y. Assume the value of X is stored at
memory address 4000, the value of Y is stored at memory address 4004,
and registers x8 and x9 contain the memory addresses 4000 and 4004:

Addresses Variables

4000 X

4004 Y

Registers Data

x8 4000

x9 4004

1. Enter lw x5, 0(x8) as the first line of instruction in the coding


window as shown below.
LAB 2

LAB: Arithmetic expression - add/sub

Given the mapping of registers to variables below, write a program to


implement the following expression:

Z=A+B+C−D

Registers Variables

x8 A

x9 B

x18 C

x19 D

x20 Z

Ex: If the values of x8, x9, x18, and x19 are initialized in the simulator as:

Registers Data

x8 2

x9 4

x18 6
Registers Data

x19 5

the result is stored in x20:

Registers Data

x8 2

x9 4

x18 6

x19 5

x20 7

You might also like