sections in this module | City
College of San Francisco - CS270 Computer Architecture Module: MIPS-I |
module list |
Basic
MIPS Problems
The NOT instruction in MIPS is a pseudoinstruction. Normally it is implemented using a NOR instruction. Answer the following questions:
Let's revisit the truth-table for XOR:
X | Y | X XOR Y |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
0 |
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 1 ! Thus, we simply need to XOR $t1 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:
Then the complement of $t1 is simply xor $t0, $t1, $at
Prev | This page was made entirely
with free software on linux: the Mozilla Project and Openoffice.org |
Next |