Question

In: Computer Science

What is the effect of applying ^255 to a 16-bit number? ^ is the bitwise XOR...

What is the effect of applying ^255 to a 16-bit number?

^ is the bitwise XOR operation.

It inverts the low byte and leaves the high byte unchanged.

It inverts the high byte and leaves the low byte unchanged.

Suppose x is an 8-bit number and y is a 3-bit number. What is the effect of the following assignment?

x = (x & 248) + y

& is the bitwise AND operator.

If x was originally 248, then x is now y+1, otherwise, it is y.

x is 248 + y after the assignment.

The lower 5 bits of x are unchanged, the number represented by the upper 3 bits is changed to y.

The upper 5 bits of x are unchanged, the number represented by the lower 3 bits is changed to y.

Solutions

Expert Solution

SOL:

1) The correct answer is It inverts the low byte and leaves the high byte unchanged.

Explanation:

Given ^ is the bitwise XOR operation

255 Binary equivalent in 16 bit = 0000000011111111

Now take another 16 bit number =101010101010101010

Now we perform the Bitwise XOR operation of above two numbers

0000000011111111

1010101010101010

_________________

1010101001010101 ---> result

Now we are seeing in the result that First 8 bits which is called low byte gets inverted and high byte(last8 bits) remains unchanged

whatever 16 bit number we take we will get the same result

2) Given X is a 8 bit number and Y is a 3 bit number

X=(X&248)+Y

The correct answer is

The upper 5 bits of x are unchanged, the number represented by the lower 3 bits is changed to y.

Explanation:

Given X is of 8 bits so take X=10101010

Y is of 3 bits so take Y = 111

Now 248 binary equivalent is 11111000

Niw performing (X&248)

X = 10101010

248=11111000

_______________

X&248 = 10101000 ---> result

Now adding Y 111 to the result

10101000

+ 111

__________

10101111 ---> final result

so X= 10101111

Original X= 10101010

see in the final X compared to original X upper 5 bits remaining unchanged and lower 3 bits is changed to Y

whatever the X and Y value we take we will get the same result


Related Solutions

The range of integers that can be represented by this 12-bit construction is -255 to 255...
The range of integers that can be represented by this 12-bit construction is -255 to 255 (a 9-bit signed integer has a range of -256 to 255). What are the floating-point representations for the first eight, odd, positive, decimal integers (i.e., 1, 3, 5, 7, 9, 11, 13, 15) in this 12-bit notation?
Concern the following 16-bit floating point representation: The first bit is the sign of the number...
Concern the following 16-bit floating point representation: The first bit is the sign of the number (0 = +, 1 = -), the next nine bits are the mantissa, the next bit is the sign of the exponent, and the last five bits are the magnitude of the exponent. All numbers are normalized, i.e. the first bit of the mantissa is one, except for zero which is all zeros. 1. What's the smallest difference between two consecutive or adjacent numbers?...
1. Find the number of unique addresses accessed by a 16-bit microprocessor. If the width of...
1. Find the number of unique addresses accessed by a 16-bit microprocessor. If the width of the data bus is also 8 bits, determine the word size in bytes. 2. What is the difference between DRAM and SRAM in terms of their applications? Why do synchronous DRAMs make use of a register, called a mode register?
Suppose a microprocessor has a 16-bit address bus and a 16-bit data bus, and the addressable...
Suppose a microprocessor has a 16-bit address bus and a 16-bit data bus, and the addressable unit is a byte. A. If the memory of this microprocessor is 16-bit memory (memory that can input and output data at a time of 16 bits), what is the maximum amount of memory space that the processor can directly access? B. If the memory of this microprocessor is 8-bit memory (memory that can input and output data 8 bits at a time), what...
write the code for 16-bit ALU using vivado. Approach : A hierarchical design approach for 16-bit...
write the code for 16-bit ALU using vivado. Approach : A hierarchical design approach for 16-bit ALU using a Full Adders (16-bit), Multiplier (16-bit), Full Subtractor (16-bit), and shift left A register. include test bench. S0 S1 Alu-operation 0 0 addition 0 1 subtraction 1 0 multiplication 1 1 shift right
Number Systems What is a bit? What is a byte? What is the relationship between these...
Number Systems What is a bit? What is a byte? What is the relationship between these two terms? How would you abbreviate the phrase "Megabits per second?" How about Megabytes per second?" Most humans are very familiar with the decimal number system. Computers do all operations in binary. What is the decimal equivalent of binary 11001101? What process can you use to perform this conversion without using a calculator? Demonstrate to the class. What is the binary equivalent of decimal...
Multiply the following 16 bit signed binary number together Provide a 32bit signed binary answer 0000...
Multiply the following 16 bit signed binary number together Provide a 32bit signed binary answer 0000 0001 0001 0001 1111 1111 1000 0000
These questions concern the following 16-bit floating point representation: The first bit is the sign of...
These questions concern the following 16-bit floating point representation: The first bit is the sign of the number (0 = +, 1 = -), the next nine bits are the mantissa, the next bit is the sign of the exponent, and the last five bits are the magnitude of the exponent. All numbers are normalized, i.e. the first bit of the mantissa is one, except for zero which is all zeros. a) What is the largest number? (in both 16-bit...
A 200 g insulated aluminum cup at 16 ∘C is filled with 255 g of water...
A 200 g insulated aluminum cup at 16 ∘C is filled with 255 g of water at 100 ∘C a) Determine the final temperature of the mixture. b)  Determine the total change in entropy as a result of the mixing process (use ΔS=∫dQ/T).
Write a Verilog code to implement 16 bit LFSR
Write a Verilog code to implement 16 bit LFSR
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT