Join-calculus: Difference between revisions
en>Dougher m →Languages based on the join-calculus: remove unneeded words |
en>Addbot m Bot: Migrating 1 interwiki links, now provided by Wikidata on d:q3183028 |
||
Line 1: | Line 1: | ||
{{other uses|comparator (disambiguation)}} | |||
A '''digital comparator''' or '''magnitude comparator''' is a [[Computer hardware|hardware]] electronic device that takes two numbers as input in [[Binary numeral system|binary]] form and determines whether one number is greater than, less than or equal to the other number. Comparators are used in [[central processing unit]] s (CPUs) and [[microcontroller]]s (MCUs). Examples of digital comparator include the CMOS 4063 and 4585 and the TTL 7485 and 74682-'89. | |||
Note: X NOR gate is a basic comparator, because its output is "1" only if its two input bits are equal. | |||
The [[analog signal|analog]] equivalent of digital comparator is the [[comparator|voltage comparator]]. Many [[microcontroller]]s have analog comparators on some of their inputs that can be read or trigger an [[interrupt]]. | |||
==Implementation== | |||
Consider two 4-bit binary numbers A and B so | |||
<math>A=A_3A_2A_1A_0</math> | |||
<math>B=B_3B_2B_1B_0</math> | |||
Here each subscript represents one of the digits in the numbers. | |||
;Equality | |||
The binary numbers A and B will be equal if all the pairs of significant digits of both numbers are equal, i.e., | |||
<math>A_3=B_3</math>, <math>A_2=B_2</math>, <math>A_1=B_1</math> and <math>A_0=B_0</math> | |||
Since the numbers are binary, the digits are either 0 or 1 and the boolean function for equality of any two digits <math>A_i</math> and <math>B_i</math> can be expressed as | |||
<math>x_i= A_i \cdot B_i + \overline{A}_i \cdot \overline{B}_i</math>. | |||
<math>x_i</math> is 1 ''only if'' <math>A_i</math> and <math>B_i</math> are equal. | |||
For the equality of A and B, all <math>x_i</math> variables (for i=0,1,2,3) must be 1. | |||
So the quality condition of A and B can be implemented using the [[AND gate|AND]] operation as | |||
<math>(A=B) = x_3x_2x_1x_0</math> | |||
The binary variable (A=B) is 1 only if all pairs of digits of the two numbers are equal. | |||
;Inequality | |||
In order to manually determine the greater of two binary numbers, we inspect the relative magnitudes of pairs of significant digits, starting from the [[most significant bit]], gradually proceeding towards lower significant bits until an inequality is found. When an inequality is found, if the corresponding bit of A is 1 and that of B is 0 then we conclude that A>B. | |||
This sequential comparison can be expressed logically as: | |||
<math>(A>B)=A_3 \cdot \overline{B}_3+x_3 A_2 \overline{B}_2+x_3 x_2 A_1 \overline{B}_1+x_3x_2x_1 A_0 \overline{B}_0</math> | |||
<math>(A<B)=\overline{A}_3 \cdot B_3+x_3 \overline{A}_2 B_2+x_3 x_2 \overline{A}_1 B_1+x_3x_2x_1 \overline{A}_0 B_0</math> | |||
(A>B) and (A < B) are output binary variables, which are equal to 1 when A>B or A<B respectively. | |||
== See also == | |||
*[[4000 series]] | |||
*[[7400 series]] | |||
* [[Sorting network]] | |||
== External links == | |||
*[http://focus.ti.com/general/docs/hirel/hirellanding.tsp?familyId=719&rootFamilyId=698 Digital Comparators by Texas Instruments] | |||
[[Category:Digital circuits]] |
Revision as of 10:56, 15 March 2013
I'm Fernando (21) from Seltjarnarnes, Iceland.
I'm learning Norwegian literature at a local college and I'm just about to graduate.
I have a part time job in a the office.
my site; wellness [continue reading this..]
A digital comparator or magnitude comparator is a hardware electronic device that takes two numbers as input in binary form and determines whether one number is greater than, less than or equal to the other number. Comparators are used in central processing unit s (CPUs) and microcontrollers (MCUs). Examples of digital comparator include the CMOS 4063 and 4585 and the TTL 7485 and 74682-'89.
Note: X NOR gate is a basic comparator, because its output is "1" only if its two input bits are equal.
The analog equivalent of digital comparator is the voltage comparator. Many microcontrollers have analog comparators on some of their inputs that can be read or trigger an interrupt.
Implementation
Consider two 4-bit binary numbers A and B so
Here each subscript represents one of the digits in the numbers.
- Equality
The binary numbers A and B will be equal if all the pairs of significant digits of both numbers are equal, i.e.,
Since the numbers are binary, the digits are either 0 or 1 and the boolean function for equality of any two digits and can be expressed as
For the equality of A and B, all variables (for i=0,1,2,3) must be 1.
So the quality condition of A and B can be implemented using the AND operation as
The binary variable (A=B) is 1 only if all pairs of digits of the two numbers are equal.
- Inequality
In order to manually determine the greater of two binary numbers, we inspect the relative magnitudes of pairs of significant digits, starting from the most significant bit, gradually proceeding towards lower significant bits until an inequality is found. When an inequality is found, if the corresponding bit of A is 1 and that of B is 0 then we conclude that A>B.
This sequential comparison can be expressed logically as:
(A>B) and (A < B) are output binary variables, which are equal to 1 when A>B or A<B respectively.