Two's Complement
Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.
2's Complement Binary Representation
2's complement arithmetic
Bitwise Shifts
For many operations (OR, AND, NOT, XOR, Left shift), 2's complement behaves the same as unsigned binary. However, the key difference is how 2's complement handles right shifting. For this set of questions, we will focus on comparing an arithmetic versus logical right shift of 2's complement numbers. Note that for left shifts there is no difference between arithmetic and logical shifts.
Assume that your result is of equal width as your input.
Logical 2's Complement Operators: Comparison (==, !=, <, <=, > >=)
Logical operators take two numbers and produce a 0 (to indicate false) or 1 (to indicate true) output.
What is the result of the following logical comparisons assuming the values are in 2's complement notation?