Question

In: Computer Science

Assuming integers are represented as 16-bit words and negative numbers are represented using the 2's complementary...

Assuming integers are represented as 16-bit words and negative numbers are represented using the 2's complementary method, convert the following hexadecimal numbers to decimal numbers a. 0xCAFE, b. 0x4DAD, c. 0xFACE

Solutions

Expert Solution

Hexadecimal     Binary
    0           0000
    1           0001
    2           0010
    3           0011
    4           0100
    5           0101
    6           0110
    7           0111
    8           1000
    9           1001
    A           1010
    B           1011
    C           1100
    D           1101
    E           1110
    F           1111
using this table for converting hexadecimal to binary

a)
0xCAFE
in binary it is 1100 1010 1111 1110
since left most bit is 1, this number is negative number.
so, follow these steps below to convert this into a decimal value.
I. first flip all the bits
   1100101011111110 is flipped to 0011010100000001
II. Add 1 to above result
0011010100000001 + 1 = 0011010100000010
III. Now convert this result to decimal value
=> 0011010100000010
=> 0x2^15+0x2^14+1x2^13+1x2^12+0x2^11+1x2^10+0x2^9+1x2^8+0x2^7+0x2^6+0x2^5+0x2^4+0x2^3+0x2^2+1x2^1+0x2^0
=> 0x32768+0x16384+1x8192+1x4096+0x2048+1x1024+0x512+1x256+0x128+0x64+0x32+0x16+0x8+0x4+1x2+0x1
=> 0+0+8192+4096+0+1024+0+256+0+0+0+0+0+0+2+0
=> 13570

Answer: -13570

b)
0x4DAD
in binary it is 0100 1101 1010 1101
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
=> 0100110110101101
=> 0x2^15+1x2^14+0x2^13+0x2^12+1x2^11+1x2^10+0x2^9+1x2^8+1x2^7+0x2^6+1x2^5+0x2^4+1x2^3+1x2^2+0x2^1+1x2^0
=> 0x32768+1x16384+0x8192+0x4096+1x2048+1x1024+0x512+1x256+1x128+0x64+1x32+0x16+1x8+1x4+0x2+1x1
=> 0+16384+0+0+2048+1024+0+256+128+0+32+0+8+4+0+1
=> 19885

Answer: 19885

c)
0xFACE
in binary it is 1111 1010 1100 1110
since left most bit is 1, this number is negative number.
so, follow these steps below to convert this into a decimal value.
I. first flip all the bits
   1111101011001110 is flipped to 0000010100110001
II. Add 1 to above result
0000010100110001 + 1 = 0000010100110010
III. Now convert this result to decimal value
=> 0000010100110010
=> 0x2^15+0x2^14+0x2^13+0x2^12+0x2^11+1x2^10+0x2^9+1x2^8+0x2^7+0x2^6+1x2^5+1x2^4+0x2^3+0x2^2+1x2^1+0x2^0
=> 0x32768+0x16384+0x8192+0x4096+0x2048+1x1024+0x512+1x256+0x128+0x64+1x32+1x16+0x8+0x4+1x2+0x1
=> 0+0+0+0+0+1024+0+256+0+0+32+16+0+0+2+0
=> 1330

Answer: -1330

Related Solutions

Assuming integers are represented as 32-bit words and negative numbers are represented using the 2's complimentary...
Assuming integers are represented as 32-bit words and negative numbers are represented using the 2's complimentary method convert the following decimal numbers to hexadecimal numbers (show your work). a. -1314, b. 2020
add the following numbers using 16-bit 2's complement. show all the steps and calculations. Please also...
add the following numbers using 16-bit 2's complement. show all the steps and calculations. Please also show steps to verify that the answer is correct. -7493 and -6372
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?
Convert the following decimal numbers to 16-bit 2’s complement binary. Display your result in hexadecimal. a.3030...
Convert the following decimal numbers to 16-bit 2’s complement binary. Display your result in hexadecimal. a.3030 b.404 c.5050 d.-5050 e.-20000 Show work with steps
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
7 – For the following operations: • write the operands as 4-bit 2's complement binary numbers,...
7 – For the following operations: • write the operands as 4-bit 2's complement binary numbers, • perform the operation shown, • show all work in binary operating on 4-bit numbers, and • identify overflow if necessary. a) 4 + 2 b) 4 – 2 c) 2 – 4 d) 4 + 4
The standard method of representing negative numbers in the binary system is with 2's complement notation....
The standard method of representing negative numbers in the binary system is with 2's complement notation. What are the advantages and disadvantages of using this method to represent negative numbers?
Let S be the set of all natural numbers that are describable in English words using...
Let S be the set of all natural numbers that are describable in English words using no more than 50 characters (so, 240 is in S since we can describe it as “two hundred forty”, which requires fewer than 50 characters). Assuming that we are allowed to use only the 27 standard characters (the 26 letters of the alphabet and the space character), show that there are only finitely many numbers contained in S. (In fact, perhaps you can show...
4. Use generate statement to write VHDL code for a 16 bit adder assuming the only...
4. Use generate statement to write VHDL code for a 16 bit adder assuming the only available building block is a full adder. Thank
Complete the following table. All binary numbers are 8-bit signed integers. (Don't forget to show the...
Complete the following table. All binary numbers are 8-bit signed integers. (Don't forget to show the steps of your solution!) Decimal value Sign-magnitude representation Ones' complement representation Two's complement representation -98 10001011 01110101 10100100 Compute the results of the indicated operations in columns 2 and 3, assuming that the binary numbers represent integers in the formats given by column 1. Identify which of the operations, if any, results in an overflow. (Don't forget to show the steps of your solution!)...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT