Question

In: Computer Science

Assume that a mad scientist has created a computer that has 9 bit registers. The most...

Assume that a mad scientist has created a computer that has 9 bit registers. The most significant bit is the sign bit. He wants to execute the following operation using 9 bit register.

-256-2

Use 2's complement method (in binary) to find the result of the above operation in binary system. Show the computations in the answer.

Solutions

Expert Solution

Binary:     011111110
Decimal:    254
overflow happened.
 
Explanation:
-------------
Number: -256
Let's convert this to two's complement binary
-256
This is negative. so, follow these steps to convert this into a 2's complement binary
Step 1:
Divide 256 successively by 2 until the quotient is 0
   > 256/2 = 128, remainder is 0
   > 128/2 = 64, remainder is 0
   > 64/2 = 32, remainder is 0
   > 32/2 = 16, remainder is 0
   > 16/2 = 8, remainder is 0
   > 8/2 = 4, remainder is 0
   > 4/2 = 2, remainder is 0
   > 2/2 = 1, remainder is 0
   > 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 100000000
So, 256 of decimal is 100000000 in binary
So, 256 in normal binary is 100000000
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   100000000 is flipped to 011111111
Step 3:. Add 1 to above result
011111111 + 1 = 100000000
so, -256 in 2's complement binary is 100000000

Number: -2
Let's convert this to two's complement binary
-2
This is negative. so, follow these steps to convert this into a 2's complement binary
Step 1:
Divide 2 successively by 2 until the quotient is 0
   > 2/2 = 1, remainder is 0
   > 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 10
So, 2 of decimal is 10 in binary
So, 2 in normal binary is 000000010
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   000000010 is flipped to 111111101
Step 3:. Add 1 to above result
111111101 + 1 = 111111110
so, -2 in 2's complement binary is 111111110

Adding 100000000 and 111111110 in binary
    100000000
    111111110
--------------
 (1)011111110
--------------
Sum produces a carry of 1. We can ignore that carry.
So, sum of these numbers in binary is 011111110

Verification:
---------------
sum = 011111110
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
Converting 11111110 to decimal
11111110
=> 1x2^7+1x2^6+1x2^5+1x2^4+1x2^3+1x2^2+1x2^1+0x2^0
=> 1x128+1x64+1x32+1x16+1x8+1x4+1x2+0x1
=> 128+64+32+16+8+4+2+0
=> 254
Answer: 254
-256+-2 must be -258
This is not correct since we can verify that -256+-2 not equals 254
So, there was an overflow.



Related Solutions

Example: A 3-address computer has 40 instructions, 16 Registers, and 256KB memory. Assume each instruction has...
Example: A 3-address computer has 40 instructions, 16 Registers, and 256KB memory. Assume each instruction has three operands. Two registers and the third operand is a direct address location of a memory. Find minimum size of PC, MAR, MDR, IR. Solution: OPCODE R1, R2, address OPCODE is 6 bits since 2^6>40 Register field is 4 bits since 2^4 =16 Memory field is 18 bits since 2^18=256K Instruction length =6+4+4+18=32 bits MDR=32 bits IR=32 bits MAR=18 PC=18 Please explain
6. Assume a computer has a physical memory organized into 64-bit words. Using hexadecimal notation, give...
6. Assume a computer has a physical memory organized into 64-bit words. Using hexadecimal notation, give the word address and offset within the word for each of the following byte addresses. Byte address Word address Offset 0x000b 0x03ff 0x07fc
A materials scientist has created an alloy containing aluminum, copper, and zinc, and wants to determine...
A materials scientist has created an alloy containing aluminum, copper, and zinc, and wants to determine the percent composition of the alloy. The scientist takes a 11.470 g sample of the alloy and reacts it with concentrated HCl. The reaction converts all of the aluminum and zinc in the alloy to aluminum chloride and zinc chloride in addition to producing hydrogen gas. The copper does not react with the HCl. Upon completion of the reaction, a total of 9.77 L...
A materials scientist has created an alloy containing aluminum, copper, and zinc, and wants to determine...
A materials scientist has created an alloy containing aluminum, copper, and zinc, and wants to determine the percent composition of the alloy. The scientist takes a 11.470 g sample of the alloy and reacts it with concentrated HCl. The reaction converts all of the aluminum and zinc in the alloy to aluminum chloride and zinc chloride in addition to producing hydrogen gas. The copper does not react with the HCl. Upon completion of the reaction, a total of 9.77 L...
A materials scientist has created an alloy containing aluminum, copper, and zinc, and wants to determine...
A materials scientist has created an alloy containing aluminum, copper, and zinc, and wants to determine the percent composition of the alloy. The scientist takes a 10.652 g sample of the alloy and reacts it with concentrated HCl. The reaction converts all of the aluminum and zinc in the alloy to aluminum chloride and zinc chloride in addition to producing hydrogen gas. The copper does not react with the HCl. Upon completion of the reaction, a total of 8.94 L...
A materials scientist has created an alloy containing aluminum, copper, and zinc, and wants to determine...
A materials scientist has created an alloy containing aluminum, copper, and zinc, and wants to determine the percent composition of the alloy. The scientist takes a 12.232 g sample of the alloy and reacts it with concentrated HCl. The reaction converts all of the aluminum and zinc in the alloy to aluminum chloride and zinc chloride in addition to producing hydrogen gas. The copper does not react with the HCl. Upon completion of the reaction, a total of 10.1 L...
9-28 2 6 Most grocery stores use bar code scanning technologies that interface with cash registers...
9-28 2 6 Most grocery stores use bar code scanning technologies that interface with cash registers used to process customer purchases. Cashiers use the scanners to read bar code labels attached to each product, which the system then uses to obtain unit prices, calculate transaction totals, including sales taxes, and update perpetual inventory databases. Similarly, cashiers scan bar codes on coupons or member discount cards presented by the customer to process discounts. Along with the scanning technologies, groceries use point-of-sale...
Problem 9 Space Shuttle has three computers. Computer A is a primary computer and Computer B...
Problem 9 Space Shuttle has three computers. Computer A is a primary computer and Computer B and Computer C are secondary and third auxiliary computers. There is a constant probability of 3% that each computer might malfunction…What is the probability that during the operation of leaving orbit, all computers would be malfunctioning?
A computer uses direct-mapped cache with four16-bit words, and each word has an associ-ated13-bit tag. Consider...
A computer uses direct-mapped cache with four16-bit words, and each word has an associ-ated13-bit tag. Consider the following loop (three instructions) in a program. Before the loop,the values in registersR0,R1,R2are 0, 054E, and 2 respectively. Consider that instructions arealready in separate cache memory. (See Table1.)The loop starts at location LOOP=02EC.LOOPAdd(R1)+,R0;DCRR2; BR>0LOOPShow the content of cache at the end of each pass of this loop if direct mapping cache is used.Compute hit rate.
The computer center at Rockbottom University has been experiencing computer downtime. Let us assume that the...
The computer center at Rockbottom University has been experiencing computer downtime. Let us assume that the trials of an associated Markov process are defined as one-hour periods and that the probability of the system being in a running state or a down state is based on the state of the system in the previous period. Historical data show the following transition probabilities: To From Running Down Running 0.70 0.30 Down 0.20 0.80 If the system is initially running, what is...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT