# Signed binary numbers multiplication

#### power13

Joined Oct 23, 2018
8
Hello to everyone,

I have to draw a logic circuit with the above data:

Input: 2 two-bit signed binary numbers in two's complement format. (eg A(a1a0) and B(b1b0))
Output: a number Z (in two's complement, also). Z= AxB (multiplication) if at least an input number is negative. In any other case Z = A + B (addition)

So, I 'm a bit confused.

I try to create the truth table: How can I handle the numbers 110,100, 1001? I want the output to be binary number as two's complement.
Is this right that my output should have minimum 4 bits?

#### WBahn

Joined Mar 31, 2012
26,398
Whether or not your multiplier has a wider output than the input depends on the specifications that you have to meet.

But one thing you have to keep in mind is that two's complement, like all signed representations, is a fixed-width format. This is important because the msb acts as a sign bit and unless you have a fixed width, you don't know which bit is the msb. So your output is either 2-bit two's comp or it is 4-bit two's comp. Make a decision and then live with it. If you don't, then you have an undefined format. For instance, is 100 a positive number or a negative number?

Go through your table and do the math. For instance, if a = 11 and b=11 and this is a 2-bit two's comp representation, then aren't 'a' and 'b' both equal to -1? Isn't (-1)·(-1) equal to (+1)? How are you getting that the two's complement representation is somehow 1001?

#### power13

Joined Oct 23, 2018
8

Now I'm trying to find what is the minimum amount of bits for the output.

With the data:
Input: 2 two-bit signed binary numbers in two's complement format. (eg A(a1a0) and B(b1b0))
Output: a number Z (in two's complement, also). Z= AxB (multiplication) if at least an input number is negative. In any other case Z = A + B (addition)

is true to say that the output will be a 2-bit two's comp or 4-bit two's comp?

#### WBahn

Joined Mar 31, 2012
26,398

Now I'm trying to find what is the minimum amount of bits for the output.

With the data:
Input: 2 two-bit signed binary numbers in two's complement format. (eg A(a1a0) and B(b1b0))
Output: a number Z (in two's complement, also). Z= AxB (multiplication) if at least an input number is negative. In any other case Z = A + B (addition)

is true to say that the output will be a 2-bit two's comp or 4-bit two's comp?
YOU decide (if it wasn't provided in the specification) what the width of the output is.

What is the range of values that you need to represent? What is the minimum value? What is the maximum value? How many bits are required to represent that range using two's comp?

#### power13

Joined Oct 23, 2018
8
YOU decide (if it wasn't provided in the specification) what the width of the output is.

What is the range of values that you need to represent? What is the minimum value? What is the maximum value? How many bits are required to represent that range using two's comp?
There is no other info...

Just this for input and output:
Input: 2 two-bit signed binary numbers in two's complement format. (eg A(a1a0) and B(b1b0))
Output: a number Z (in two's complement, also). Z= AxB (multiplication) if at least an input number is negative. In any other case Z = A + B (addition)
and one question is how many bits is the minimum amount for the output.
So, I assume that the min output is a 2-bit two's comp number.

#### WBahn

Joined Mar 31, 2012
26,398
There is no other info...

Just this for input and output:

and one question is how many bits is the minimum amount for the output.
So, I assume that the min output is a 2-bit two's comp number.
Do...the...math!

What are the possible values for the two inputs?

What are the possible values for the output?

What is the minimum possible value for the output?

What is the maximum possible value for the output?

How many bits are needed to represent all possible output values using two's complement?

• power13