Question: 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

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. 3. (35 points) Download and complete hw2_03.s. Note that each instruction you use for this program must be a logical, shift, or rotate instruction. # Question 3 for HW 2 # # 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, simply move each comment to the right of the instruction) ### EACH INSTRUCTION YOU USE MUST BE A BITWISE, SHIFT, OR ROTATE INSTRUCTION # # # # # # SOME OF THE "INSTRUCTIONS" LISTED BELOW ACTUALLY REQUIRE MULTIPLE INSTRUCTIONS # THESE LINES HAVE BEEN MARKED, AND YOU ARE ALLOWED TO USE >1 INSTRUCTION FOR EACH ONE OF THE MARKED LINES (THE LINES THAT CHANGE $t0, $t1, AND $t6) This program gives you some practice working with bitwise, shift, and rotate operators # .global main v1: V2: .data .word .word 12 OxFEEDABEE .text . Set .ent noreorder main ** # main: lw $51, vi ## $s1 = v1 lw $52, v2 ## $s2 = V2 *REQUIRES >i INSTRUCTION***: $to = v2 with lowest 12 bits cleared (set to ), other bits staying the same **REQUIRES >1 INSTRUCTION***: $t1 = v2 with 8 highest bits set to o, other bits staying the same ## $t2 = v1 multiplied by 8 *without using a multiply instruction ## ***REQUIRES >1 INSTRUCTION***: $t3 = v2 multiplied by 12 *without* using a multiply instruction ## $t4 = v1 divided by 2 *without* using a divide instruction ## $t5 = v2 with the lowest 16 bits flipped (inverted) and the upper 16 bits staying the same ## ***REQUIRES >1 INSTRUCTION***:## $t6 = OxFD000010 without using the li pseudo-instruction # This code simply loops infinitely spin: j nop spin .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. 3. (35 points) Download and complete hw2_03.s. Note that each instruction you use for this program must be a logical, shift, or rotate instruction. # Question 3 for HW 2 # # 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, simply move each comment to the right of the instruction) ### EACH INSTRUCTION YOU USE MUST BE A BITWISE, SHIFT, OR ROTATE INSTRUCTION # # # # # # SOME OF THE "INSTRUCTIONS" LISTED BELOW ACTUALLY REQUIRE MULTIPLE INSTRUCTIONS # THESE LINES HAVE BEEN MARKED, AND YOU ARE ALLOWED TO USE >1 INSTRUCTION FOR EACH ONE OF THE MARKED LINES (THE LINES THAT CHANGE $t0, $t1, AND $t6) This program gives you some practice working with bitwise, shift, and rotate operators # .global main v1: V2: .data .word .word 12 OxFEEDABEE .text . Set .ent noreorder main ** # main: lw $51, vi ## $s1 = v1 lw $52, v2 ## $s2 = V2 *REQUIRES >i INSTRUCTION***: $to = v2 with lowest 12 bits cleared (set to ), other bits staying the same **REQUIRES >1 INSTRUCTION***: $t1 = v2 with 8 highest bits set to o, other bits staying the same ## $t2 = v1 multiplied by 8 *without using a multiply instruction ## ***REQUIRES >1 INSTRUCTION***: $t3 = v2 multiplied by 12 *without* using a multiply instruction ## $t4 = v1 divided by 2 *without* using a divide instruction ## $t5 = v2 with the lowest 16 bits flipped (inverted) and the upper 16 bits staying the same ## ***REQUIRES >1 INSTRUCTION***:## $t6 = OxFD000010 without using the li pseudo-instruction # This code simply loops infinitely spin: j nop spin .end main

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!