Digital Lab E66
Digital Lab E66
____________________________________________
Name:
Reem Mohammed Ahmed (212216020)
Sara Adnan Ramadan Rajab (212216025)
Supervisor:
Eng. Ali Sager
Fall 2023
Introduction:
A 4-bit comparator is a digital circuit that compares two 4-bit binary
numbers and determines their relationship in terms of magnitude
(whether one number is greater than, less than, or equal to the other). In
other words, it examines each pair of corresponding bits from the two
numbers and determines whether they are equal or if one is greater or less
than the other.
The comparator typically has two 4-bit inputs, labeled as A and B,
representing the two binary numbers to be compared. It also has outputs
indicating the result of the comparison, often labeled as greater than
(A>B), less than (A<B), and equal (A=B).
The circuit works by comparing the bits of the two numbers starting from
the most significant bit_(MSB)_ and moving toward the least significant
bit_(LSB). At each bit position, the two corresponding bits of the numbers
are compared. If the bit in the first number is greater than the
corresponding bit in the second number, the A>B output is set to 1, and
the circuit immediately determines that the first number is greater than
the second. Similarly, if the bit in the second number is greater than the
corresponding bit in the first number, the A<B output is set to 1, and the
circuit immediately determines that the first number is less than the
second.
If the two corresponding bits are equal, the circuit moves to the next bit
position and compares the next pair of bits. This process continues until
all the bits have been compared. If at any point in the comparison, the
circuit determines that the first number is greater or less than the second
number, the comparison is terminated, and the appropriate output is
generated.
If all the bits are equal, the circuit generates
an A=B output, indicating that the two
numbers are equal.
Procedure:
To start the experiment, the digital logic fundamentals 1 board has been
inserted into the base unit and locked on it.
There the base unit has been turned on, and the steps of the experiment
were as following:
Figure 2
INPUTS
A B OUTPUTS
0 0 0 0 0 0 0 0 off on off
1 1 1 1 1 1 1 1 off on off
0 0 0 1 0 0 0 0 on off off
7. On your 4-BIT COMPARATOR circuit block , measure A (A0) and
QA(B0),(word A=0001. Word B =0000) . Based on your observations ,
can the comparator determine the relationship between two words if
only one bit pair is not equal ? yes , the comparator recognizes any
bit pair difference.(figure 3)
االا
B0
A0
الرل
8. Use the parallel load function of your counter to set word B of your
comparator to $A (1010) .
(place INPUT SIGNALS circuit block toggle switches D through A at
high , and low , high , and low , respectively .then momentarily activate
the counter LOAD input ).
Because words A and B are equal , the A=B output LED of the
comparator should be on .
(NOTE: the D through A toggle switches are hardwired to the
SYNCHRONOUS COUNTER and 4-BIT COMPARATOR circuit
block ).
9. Generate one clock pulse for your synchronous counter .based on the
output LEDs of your comparator , what are the bit patterns for words A
and B ? word A is less than B (the A<B LEDs on ).(figure 4)
Figure 4: A<B LEDs on
10. Each comparison of your circuit has generated a specific high output
(LED on). For example, when A was less than B, the AB LED was on.
For equal word inputs, which comparator inputs determine the active
state (high or low) of the comparator outputs? the 3 A/B
programming inputs.
11. Make Words A and B of the comparator equal, Any equal values will
do.
12. Use two - post Connectors on the comparator control inputs to set the
input states indicated by the table, and note the comparator outputs for
each row of the table. Based on your results. the A = B output level
matches the level of the A = B programming input.
13. Remove all two - post Connectors from the control inputs of your
Comparator Circuit.
14. Set both word B and word A to 1000 to initiate an A = B output.
Use the word A controls to generate words of 1100, 1010, and 1001.
Observe the Comparator Output for each word pattern.
15. Based on your observations, does the comparator ignore all equal bit
patterns and make a decision based only on unequal bits? Yes.
16. If you repeat the comparing operation but alter Word B instead of
word A, Could you expect the same output? (NOTE: Word A is fixed
at 1010, and word B varies) . No.
17. Set both word B and word A to 1000 to initiate an A = B output. Use
the Word B counter to generate Words of 1100, 1010, and 1001.
Observe the comparator output for each word pattern. Based on your
A <B indication, Comparisons are with respect to word . A.
11. Use the INPUT SIGNALS circuit toggle switches to set word A of your
comparator to 0111.
NOTE: Ensure that the MOD (SYNCHRONOUS COUNTER circuit block)
and MOD/A=B (4-BIT COMPARATOR circuit block) two-post connectors
are in place.
12. What is the output range of your counter?
NOTE: You can turn CM 5 off by pressing the CM or Toggle button
provided to use oscilloscope channel 2 to observe the other waveforms.
Toggle CM 5 on to observe circuit operation based on circuit LEDs.
Maximum decimal count =6.
13. Based on your circuit waveforms (CM 5 off) and circuit LEDS (CM 5 on),
what counter output value follows the circuit reset value of 0000?
Decimal count = 0001.
14. Based on your circuit observations, can a modulus feedback set the
maximum count output of a counter? Yes .
15. Based on your circuit operation, this synchronous MOD 7 counter Cycles
from 0000 to 1111 and back .
16. Which level is required at the A-B (MOD) output to prevent the counter
from resetting as observed in step 13? A=B output must be low .
- Toggle switches D through A on the INPUT SIGNALS circuit block control inputs
D through A on the 4 - BIT COMPARATOR circuit block, The QD through QA
inputs of the 4 - BIT COMPARATOR circuit block are hardwired to the
SYNCHRONOUS COUNTER circuit block; Therefore, these inputs require the
operation of the Counter.
- Your 4 - bit comparator makes decisions about two 4 - bit Words. The result of the
comparison is available at 3 Outputs: A> B, A = B, and A <B.
- Your comparator has two basic operating modes: words A and B equal and Words
A and B not equal.
- The setting of the 3 input control lines (A> B, A = B, and A <B) determines the
Output code pattern generated for each mode.
- Operating states and control codes for unequal inputs are governed by truth table
(table 2).
- When Words A and B are not equal, the cascade inputs do not affect comparator
operation. The output Codes are identical, and the comparison is biased toward the
most significant bit side of words.
Table 2: truth table for unequal inputs
A3,B3 A2,B2 A1,B1 A0,B0 A>B A=B A<B A>B A=B A<B
A3>B3 X X X X X X H L L
A3<B3 X X X X X X L L H
A3=B3 A2>B2 X X X X X H L L
A3=B3 A2<B2 X X X X X L L H
- now we have a good knowledge about able to set the modulus of a counter with a
comparator. and verify the result by using a comparator to drive the CLEAR input
of a synchronous counter with using 4-bit comparator .
Conclusion:
Part A: Binary Comparisons:
- A 4 - bit comparator can make a decision about two 4 - bit words.
- A Comparator can generate A <B, A = B, and A> B indications about two 4 - bit
words.
- The active output indication (high or low) of a comparator is controlled by the A
<B, A = B, and A> B inputs of the device.
- A comparator makes a decision between two words based on bit pairs that are not
equal.
- The Comparator you used in this exercise makes a decision with respect to the word
A input A<B,A=B, A>B.
- you can predict the output results of a comparison by performing a manual bit - by -
bit Comparison of the two words.
3 _________________________________________ Objective:
3 ________________________________________ Procedure:
3 ____________________________________________________ Part A: Binary Comparisons:
7 _____________________________________________________ Part B : Modulus Control :
9 _______________________ Result and Discussion :
9 ____________________________________________________ Part A: Binary Comparisons:
01 ____________________________________________________ Part B : Modulus Control :
01 ______________________________________ Conclusion:
01 ___________________________________________________ Part A: Binary Comparisons:
00 _____________________________________________________Part B: Modulus Control :