I am stuck on this problem and need help. I have two registers
$t2 which is 00000000 00000000 00000000 01111001
and
$t3 which is 11111111 11111111 11111111 11100011
the three questions that are being asked are (answers must be in binary)
and $s2,$t2,$t3
or $s2,$t2,$t3
xor $s2,$t2,$t3
I have looked everywhere online and in my textbook but I cannot for the life of me find out what these operators do. I am not asking for the answers but just for some guidance on how I should start working on these problems.
Thanks.
These are bitwise operators. They derive their names form the logic gates/boolean math operators that they implement:
AND => both inputs true (1) generates true
OR => any input true generates true
XOR => true only if one input is true and the other is false
See the wikipedia articles for more info on the operators:
Because these are very basic boolean operators/logic gates, it is often assumed in books/text concerning CPU design and assembly programming that the reader is familiar with them. An assumption that perhaps shouldn't be made since programming is nowdays a more wide discipline encompassing everything from biologists to stock market analyst to engineers.
When it comes to applying the operator on a string of bits such as a word or a byte all the bits in the two inputs are processed in parallel. For example, let's AND two bytes:
input 1 = 11110000
input 2 = 00111100
------------------
output = 00110000
▲▲
││
└┴──────── true because both bits from
input 1 and input 2 are true
(see difinition of AND)
The same works with the other operators.