71.9k views
1 vote
A and B are given two numbers expressed in two's complement with two bits. Find Boolean functions F(A,B)=(A>B) and simplify using Boolean theorems?​

User Nraynaud
by
7.2k points

1 Answer

2 votes

In two's complement, the most significant bit (MSB) is used as the sign bit, where a 0 represents a positive number, and a 1 represents a negative number. To compare two numbers in two's complement, we can simply compare their binary values as unsigned integers.

Let's assume that A and B are two two-bit numbers expressed in two's complement. We can represent them as follows:

A = a1 a0 (where a1 is the MSB and a0 is the LSB)

B = b1 b0 (where b1 is the MSB and b0 is the LSB)

To determine whether A is greater than B, we can compare the unsigned values of A and B. If A is greater than B, then A - B will be positive, and the MSB of A - B will be 0. If A is less than or equal to B, then A - B will be negative, and the MSB of A - B will be 1.

Therefore, we can define the Boolean function F(A,B) as follows:

F(A,B) = NOT(a1 XOR b1) AND (a1 XOR b0)

Let's simplify this expression using Boolean theorems:

F(A,B) = NOT(a1 XOR b1) AND (a1 XOR b0)

= (NOT a1 OR NOT b1) AND (a1 XOR b0) (De Morgan's law)

= (NOT a1 AND a1 XOR b0) OR (NOT b1 AND a1 XOR b0) (Distributive law)

= (0 XOR b0) OR (1 AND a1 XOR b0) (Complement law and identity law)

= a1 XOR b0

Therefore, the simplified Boolean function for A>B in two's complement with two bits is F(A,B) = a1 XOR b0.

User Ehsaneha
by
7.2k points