Part 1 - Comparison In this problem, you will write a Simple Machine program that compares two numbers and determines whether they are equal. Start by copying the starter file to your current directory: cp /pub/cs/jpotter/cs270/sim/comparison Take a look at the starter file. Note that it has each address from 0x0 to Ox22 filled in. Your job is to replace as many lines at the beginning as you need to solve the problem. You should not add any lines, except possibly at the very end. Your program should implement the following algorithm, given in a high-level language: if (val! == val2) equal = 1; else equal = e Note that in the data section of the starter file, val1 is at address Ox20 (decimal 32), val2 is at address 0x21 (decimal 33), and equal is at address Ox22 (decimal 34). The autograder will assume that these variables are at these locations. Your program must examine val1 and val2 and store the correct value at the address where equal lives

The starter file is below:

####################################

# Name:

#

#####################################

#

# This is the starter code for

# the comparison problem in

# assignment 4. Note that

# the first 32 lines contain the

# halt instruction. Your job is to

# replace instructions starting at

# the beginning with your own

# instructions to solve part 1. You

# should need fewer than 31

# instructions, so you shouldn’t

# have to worry about running out

# of space.

#

# The data for this program starts

# at address 0x20 (or 32 in

# decimal). DO NOT ALTER THE

# LOCATION OF THE DATA GIVEN. The

# autograder will rely on val1 being

# at address 0x20, val2 being at

# address 0x21, and equal being at

# address 0x22. You are, however,

# welcome to add more data after

# address 0x22.

#

#####################################

#

# Original C Code

# —————–

# if (val1 == val2)

# {

# equal = 1;

# }

# else

# {

# equal = 0;

# }

#

#####################################

#

# Your program starts here.

0x0 # (ADDR=0x0)

0x0 # (ADDR=0x1)

0x0 # …

0x0

0x0

0x0

0x0

0x0

0x0

0x0

0x0 # (ADDR=0xA)

0x0

0x0

0x0

0x0

0x0

0x0 # (ADDR=0x10)

0x0

0x0

0x0

0x0

0x0

0x0

0x0

0x0

0x0

0x0

0x0

0x0

0x0

0x0

0x0 # (ADDR=0x1f)

# Data starts here.

0x5 # (ADDR=0x20) val1

0x6 # (ADDR=0x21) val2

0xffff # (ADDR=0x22) equal

# Feel free to add more data below…

Part 1 – Comparison In this problem, you will write a Simple Machine program that compares two numbers and determines whether they are equal. Start by copying the starter file to your current directory: cp /pub/cs/jpotter/cs270/sim/comparison Take a look at the starter file. Note that it has each address from 0x0 to Ox22 filled in. Your job is to replace as many lines at the beginning as you need to solve the problem. You should not add any lines, except possibly at the very end. Your program should implement the following algorithm, given in a high-level language: if (val! == val2) equal = 1; else equal = e Note that in the data section of the starter file, val1 is at address Ox20 (decimal 32), val2 is at address 0x21 (decimal 33), and equal is at address Ox22 (decimal 34). The autograder will assume that these variables are at these locations. Your program must examine val1 and val2 and store the correct value at the address where equal lives Show transcribed image text