02-3 数值比较器

数值比较器

一、一位数值比较器
  • A=1,B=0时有A>B:

    • Y(A>B)=ABY_{(A>B)}=AB'
  • A=0,B=1时有A<B:

    • Y(A>B)=ABY_{(A>B)}=AB'
  • A=B=0或A=B=1时 即AB=1A\bigodot B=1时有A=B:

    • Y(A=B)=ABY_{(A=B)}=A\bigodot B

如下图所示为其中一种实现方法:

二、多位数值比较器

Y(A>B)=A3B3+(A3B3)A2B2+(A3B3)(A2B2)A1B1+(A3B3)(A2B2)(A1B1)A0B0+(A3B3)(A2B2)(A1B1)(A0B0)I(A>B)Y_{(A>B)}=A_3B'_3+(A_3\bigodot B_3)A_2B'_2+(A_3\bigodot B_3)(A_2\bigodot B_2)A_1B'_1\\+(A_3\bigodot B_3)(A_2\bigodot B_2)(A_1\bigodot B_1)A_0B'_0+(A_3\bigodot B_3)(A_2\bigodot B_2)(A_1\bigodot B_1)(A_0\bigodot B_0)I_{(A>B)}

  • 简单的中国话理解:A>B只能是最高位A3>B3A_3>B_3;或者最高位相等,第二位A2>B2A_2>B_2;或者最高位和第二位都相等,第三位A1>B1A_1>B_1;或者前面三位都相等,最后一位A0>B0A_0>B_0;或者这些位全部相等,来自低位的进位信号为I(A>B)I_{(A>B)}

同理可以得到Y(A<B)Y_{(A<B)}

当然,也可以使用代入定理,因为上述已经有Y(A>B)Y_{(A>B)},而且显然Y(A=B)Y_{(A=B)}相对好算

Y(A=B)=(A3B3)(A2B2)(A1B1)(A0B0)I(A=B)Y_{(A=B)}=(A_3\bigodot B_3)(A_2\bigodot B_2)(A_1\bigodot B_1)(A_0\bigodot B_0)I_{(A=B)}

那么也就很好得出Y(A<B)=(Y(A=B)+Y(A>B))Y_{(A<B)}=(Y_{(A=B)}+Y_{(A>B)})'

以上实现:4位数值比较器74HC85