Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The NOT instruction in MIPS is a pseudoinstruction. Normally it is implemented using a NOR instruction. Answer the following questions: 1. Can you implement the

image text in transcribed
The NOT instruction in MIPS is a pseudoinstruction. Normally it is implemented using a NOR instruction. Answer the following questions: 1. Can you implement the operation not St0,St where St0 is set to the bitwise complement of Stl using the nor instruction? (HINT: you can do this in a single instruction use S0) 2. Can you implement not St0, St using the xor instruction? (HINT: This w take several instructions.) You can check 1. using the simulator. Simply write a three-line program that defines_start and uses the not instruction. Let's go on to 2: Let's revisit the truth-table for XOR: XOR Look at the highlighted cells in this truth-table (the four cells in the lower right corner). This is a complement operation! Examining this, we can see that the complement of any bit of Y is Y XOR I ! Thus, we simply need to XOR Stl with a 32-bit value that is all ones! This sounds easy, but we must create this value in a register in order to perform our operation. Here is one way: lui $at, 0xffff sra $at,sat, 16 Then the complement of $t1 is simply ?to, st1, $at xor The NOT instruction in MIPS is a pseudoinstruction. Normally it is implemented using a NOR instruction. Answer the following questions: 1. Can you implement the operation not St0,St where St0 is set to the bitwise complement of Stl using the nor instruction? (HINT: you can do this in a single instruction use S0) 2. Can you implement not St0, St using the xor instruction? (HINT: This w take several instructions.) You can check 1. using the simulator. Simply write a three-line program that defines_start and uses the not instruction. Let's go on to 2: Let's revisit the truth-table for XOR: XOR Look at the highlighted cells in this truth-table (the four cells in the lower right corner). This is a complement operation! Examining this, we can see that the complement of any bit of Y is Y XOR I ! Thus, we simply need to XOR Stl with a 32-bit value that is all ones! This sounds easy, but we must create this value in a register in order to perform our operation. Here is one way: lui $at, 0xffff sra $at,sat, 16 Then the complement of $t1 is simply ?to, st1, $at xor

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

2nd Edition

0471180742, 978-0471180746

More Books

Students also viewed these Databases questions