-2
\$\begingroup\$

Design circuit which compares two 4-bit unsigned numbers A and B. The circuit should have one output X such that

X = 1 whenever A>B

X = 0 whenever A≤B

You may use any MSI modules as well as any other gates

I am totally stuck with this question, and I really need help right now

This is not an assignment, but a sample question for the exam

Thank you

\$\endgroup\$
1
  • 1
    \$\begingroup\$ What have you done so far? Where are you stuck at? Regardless if this was an exam or an assignment question, we cannot spoon feed you the answer - it defeats the purpose of learning. \$\endgroup\$
    – shimofuri
    Commented Feb 22, 2015 at 8:47

5 Answers 5

2
\$\begingroup\$

OP says: You may use any MSI modules as well as any other gates

Therefore you want to save yourself a lot of work and use a 4-bit MSI (medium scale integration) IC comparator such as the CD4585,or the CD4063. The pinout below is for the latter.

enter image description here

The inputs connect to A0-A3 and B0-B3. Ignore the three lines (xxx)IN, they are used for cascading. The output X is the line (A>B)OUT.

\$\endgroup\$
0
\$\begingroup\$

Option 1:

Design a unit to compare two 1-bit numbers. Then add a cascade from a previous stage to the unit. Then cascade multiple units to compare two 4-bit numbers.

Option 2:

Use a Karnaugh map, boolean reduction, or similar methods to come up with an equation that performs the operation, then implement it.

\$\endgroup\$
0
\$\begingroup\$

you can use below circuit :

enter image description here

\$\endgroup\$
0
\$\begingroup\$

If you have a 4-bit subtractor or four full subtractors, then connect A and B as inputs such as to produce the difference B-A . Then the borrow-out pin of the subtractor will give you the answer.

\$\endgroup\$
0
0
\$\begingroup\$

The logic for this can be easily designed into a 256 bit memory lookup table. Back in the day there were plenty of small programmable PROM type memory chips that made this easy to implement. These days it could be implemented into a portion of a larger memory element. If logic is going into an FPGA then this could go into an initialized block RAM element. Since many projects are now actually implemented within microcontrollers this could become a very small table in the FLASH program memory of the MCU. Within the MCU a lookup table look may be a more suitable method to use over computational comparison when the algorithm for the input comparisons is more complex than the current very simple A>B comparison.

A spreadsheet is a convenient way to compute the data for a lookup table.

enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.