Answered step by step
Verified Expert Solution
Question
1 Approved Answer
complete short programs written in MPLAB and run in the simulator. You should run your code to verify its correctness. Instructions for setting up an
complete short programs written in MPLAB and run in the simulator. You should run your code to verify its correctness. Instructions for setting up an MPLAB project and descriptions of how to run and debug your code can be found in the slides for Lecture 4 Each program contains a few instructions, but the majority of the program is unwritten, with some of instructions described by a comment that starts with ##. Replace each comment with instructions that performs the specified operation. 2. (35 points) Download and complete hw2_q2.s. # Question 2 for HW 2 # (adapted from: http://www.cs.unca.edu/brock/classes/Spring2017/csci255/labs/mips 32asmintro/index.html) # # The program below contains several comments (all of which start with ##) describing an operation to be performed on one or more of the variables declared at the start of the program. Replace each ## comment with *one* appropriate instruction to complete the program (or, as I've done below, # # # # When complete, the program implements the operation: z = a*x*x + b + cx global main 2 8 # Remember, an int is a signed word (32 bits) b: .data .int . int .int .int .int 17 X: Z: 10 -1 .text .set .ent noreorder main main: $to, a ## $t0 = a ### lw $t1 = b $t2 = C $t3 = x mul $t4,$t0,$t3 ## St4 = a*x ## $t4 = $t4% ## $t5 = cx # finish rest of the program # This code simply loops infinitely--we'll cover jump (j) instructions soon spin: j spin nop .end main complete short programs written in MPLAB and run in the simulator. You should run your code to verify its correctness. Instructions for setting up an MPLAB project and descriptions of how to run and debug your code can be found in the slides for Lecture 4 Each program contains a few instructions, but the majority of the program is unwritten, with some of instructions described by a comment that starts with ##. Replace each comment with instructions that performs the specified operation. 2. (35 points) Download and complete hw2_q2.s. # Question 2 for HW 2 # (adapted from: http://www.cs.unca.edu/brock/classes/Spring2017/csci255/labs/mips 32asmintro/index.html) # # The program below contains several comments (all of which start with ##) describing an operation to be performed on one or more of the variables declared at the start of the program. Replace each ## comment with *one* appropriate instruction to complete the program (or, as I've done below, # # # # When complete, the program implements the operation: z = a*x*x + b + cx global main 2 8 # Remember, an int is a signed word (32 bits) b: .data .int . int .int .int .int 17 X: Z: 10 -1 .text .set .ent noreorder main main: $to, a ## $t0 = a ### lw $t1 = b $t2 = C $t3 = x mul $t4,$t0,$t3 ## St4 = a*x ## $t4 = $t4% ## $t5 = cx # finish rest of the program # This code simply loops infinitely--we'll cover jump (j) instructions soon spin: j spin nop .end main
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started