02-19-2015, 02:09 AM
(This post was last modified: 02-19-2015, 02:18 AM by GISED_Link.)
I think I have found a stupid way to do that ...
-- The MSB of a 8 bits number is bit 7 ('cause the LSB is bit 0) --
1. What will we do :
2. In binary (using the 2's complement)
3. We transform -4 in 4 ( (NOT -4) +1)
4. We make the result negative ( (NOT Result) +1)
And we found the correct answer. So I will add 3 full-adders and 3 XORs to my multiplier, one per input and one for the output. The first input of each XOR are the data bit, the second is the inversion bit. So the inversion bit of the input XORs are the bit 7 of each number. For the output, it's (A(7) XOR B(7)).
If someone has a better way to do that without those full adder, it would be cool.
This link has maybe the answer ...
https://books.google.ch/books?id=3kQoAwA...s.&f=false
-- The MSB of a 8 bits number is bit 7 ('cause the LSB is bit 0) --
1. What will we do :
Code:
. 3 //the . (Dot) is only there for the formating
x -4
----
=-12
2. In binary (using the 2's complement)
Code:
. 00000011
x 11111100
-----------
= 11110100
3. We transform -4 in 4 ( (NOT -4) +1)
Code:
. 00000011
x 00000100
-----------
= 00001100
4. We make the result negative ( (NOT Result) +1)
Code:
. 00000011
x 00000100
-----------
= 11110100
And we found the correct answer. So I will add 3 full-adders and 3 XORs to my multiplier, one per input and one for the output. The first input of each XOR are the data bit, the second is the inversion bit. So the inversion bit of the input XORs are the bit 7 of each number. For the output, it's (A(7) XOR B(7)).
If someone has a better way to do that without those full adder, it would be cool.
This link has maybe the answer ...
https://books.google.ch/books?id=3kQoAwA...s.&f=false