0

I'm working in a project, which will show an arithmetic result as a 7-segment,

I know how to do a one digit 7- segment on logisim,

but this makes the result limited from 0 to 9, and my project highest number can be 999,

so, what is the way to create the three 7-segments and connecting them together to make them like

"hundreds tens ones"

any idea, hints?

Greital
  • 11
  • 1
  • 4
  • If you do your arithmetic in BCD, you can simply use three copies of the circuit you already have. – Dave Tweed May 15 '20 at 23:59
  • If your arithmetic result is 10-bit unsigned binary, then you will need a "ladder" of sorts. I can show you how to approach designing the ladder. But you'll need to provide a better description of your "arithmetic result" than you have. – jonk May 16 '20 at 00:38
  • David, yes it is in BCD, I will give it a try – Greital May 16 '20 at 00:53
  • Jonk, the result in 7 bit, but the question didn't say if it is signed or unsigned, so I assume it will be unsigned, "ladder"?! didn't take that in lab, but if you can explain it I will be grateful :) – Greital May 16 '20 at 00:56
  • If the result is only 7 bits, you can only have from 0 to 127, decimal. You cannot reach 999. Are you sure about that need? – jonk May 16 '20 at 01:00
  • Jonk, yes it's 7 bits, but I said it can be 999 because I need all the possibilities to solve such a problem, but mine highest will be only 105 – Greital May 16 '20 at 01:25
  • So the values go from, in binary, 0000000 to 1101001? – jonk May 16 '20 at 02:09
  • yes, you are right – Greital May 16 '20 at 02:12
  • Easy. What are you supposed to do, though? Are you supposed to use simple gates? What skills are you supposed to apply? – jonk May 16 '20 at 02:14
  • For example, there is a very simple technique that divides up a BCD value into two parts: 0-4 and 5-9. Like [this](https://i.stack.imgur.com/2sH43.png). Once you work out the logic gates required to achieve this 4-in, 4-out block, you only need 5 of those blocks and you are done. It's pretty easy. – jonk May 16 '20 at 02:20
  • actually, they didn't suggest anything to us, but I prefer to use something I already study it (such as adder, flip flop, basic gates) or at least something simple so I can understand it and do it myself, because I want to learn more than the grade itself :). – Greital May 16 '20 at 02:23
  • this technique "dividing a BCD value into two parts: 0-4 and 5-9." looks interesting :) more explanation :) please – Greital May 16 '20 at 02:26
  • I'd need to write up an answer. It does require some explanation. But you may be right on the tip of understanding. – jonk May 16 '20 at 02:55
  • Would you mind to give us some example, like the binary pattern you get, and the value it means? I mean, first you say "it is in BCD", and then you say "it's 7 bit [binary]". Please [edit] your question, don't post it as a comment. Please take the [tour] and read "[ask]". – the busybee May 16 '20 at 05:31
  • Welcome to the site. Please note that it's not a free design house, homework-answering service or on-line technical encyclopedia, copied out to you on demand. People will help you take the next step if your question shows you've done as much as you possibly could on your own - which yours doesn't, I'm afraid. Please edit your question and greatly improve it. Show your work and findings so far in considerable detail with a schematic. The schematic tool here is easy to use. The better the quality of question, the better the quality of the answers you will attract. Again, a very warm welcome. – TonyM Jun 04 '20 at 08:16

1 Answers1

3

Modulo 5 Magic

Suppose you had some magic logic block which did the following:

enter image description here

Above, if \$x=A_3\dots A_0\$, then \$S_3=\lfloor\frac{x}{5}\rfloor\$ and \$S_2\dots S_0=x-5\cdot S_3 = x \mod 5\$.

Now look at what happens when we apply this magic logic block:

schematic

simulate this circuit – Schematic created using CircuitLab

The 4-bit value, \$y=B_3\dots B_0\$ where \$0\le y\le 15\$, is converted to one BCD digit, plus a "carry" into the next higher BCD digit. This happens because the magic logic block as applied only to the upper 3 bits (which cannot exceed 7), \$y^{'}=\lfloor\frac{y}{2}\rfloor\$, and performs the following mathematics: \$S_3=\lfloor \frac{y^{'}}{5}\rfloor\$ and \$S_2\dots S_0=y^{'}-5\cdot S_3\$ which is the same thing as having performed \$S_3=\lfloor \frac{y}{10}\rfloor\$ and \$S_2\dots S_0=y-10\cdot S_3\$. In short, we've performed a divide-by-10 operation and a modulo-10 operation. Which is just the kind of thing we need to do in order to convert binary into BCD.

Generalizing

Note that in the above diagram, I set \$A_3=0\$. This ensured at the \$A_3\dots A_0\$ input doesn't exceed a maximum BCD value of 9. With only three bits, we can be certain of that. But if we now expanded the diagram to something like this:

schematic

simulate this circuit

We run into a problem because it is possible for \$B_4\dots B_1\ge 10\$ and this would violate the requirement that the 4-bit input into the magic block is already in BCD format.

This can be fixed:

schematic

simulate this circuit

Note that I've just once-again assured that the left-most modulo-5 (it's not magic, anymore) block is guaranteed to have a BCD input (since we set its upper-most input bit to zero.) This left-most modulo-5 unit's lower \$S_2\dots S_0\$ output cannot be more than 4. So even now combined \$B_1\$, you can see that the right-most modulo-5 unit's input will still be in BCD format. So no violation there.

Note also that the input, in binary, can be from 0 to 31. And that we now have two bits for the upper BCD digit. Just enough to cover the need!! Nice.

Continuing the Generalization

This whole idea just continues on. Or, at least, it might seem so. Let's extend this idea to handle your 7-bit input:

schematic

simulate this circuit

Will this work? No. It won't. One obvious reason is that we don't have a HUNDREDS BCD digit and we know that you need one. So there's something wrong, already.

But the somewhat more subtle reason is that we've brought out each of the carry-outs from each modulo-5 block and formed a TENS BCD digit. But there might be a carry-out from all of the blocks (or some combination that doesn't make a BCD digit.) In fact, we should expect a carry-out from the TENS so that we do get a bit provided into the HUNDREDS BCD digit.

There's a way to fix this, though:

schematic

simulate this circuit

And that, in fact, will work fine.

Summary

I've not disclosed the logic required for the modulo-5 block. But as I have provided you with the table, this should not be a difficult puzzle for you. It will need a few logic gates to map \$A_3\dots A_0\$ to \$S_3\dots S_0\$.

If you have trouble with that block, feel free to ask a different question about it. But I suspect you can work it out.

Note

See BCD K-Maps for an earlier post of mine on a related question. Also see this by qwr on another still earlier question on the double-dabble algorithm.

Appendix

I've decided, a week later, to expand on the above and make this a broader answer that may help others.

The above example can be expanded to 8 bits in the following way:

schematic

simulate this circuit

I think this should provide sufficient information to allow expansion to any number of bits and decimal digits.

jonk
  • 77,059
  • 6
  • 73
  • 185
  • 1
    Thanks alot, appreciate the help you provide :) – Greital May 16 '20 at 07:54
  • I've done it :) and it's worked perfectly, Thanks alot Jonk, really appreciate your help. god bless you. – Greital May 17 '20 at 06:44
  • @Greital Cool!! Thanks also for letting me know it helped. I really enjoy knowing. :) – jonk May 17 '20 at 06:45
  • @Greital You are also able to +1 (click on the up-arrow on the left side) an answer. Don't do that for me. It's not necessary. But I just wanted you to be aware of the fact you can do it. – jonk May 17 '20 at 06:47
  • Jonk, you deserve +1. and I tried from yesterday to do it, but they giving me this msg "Thanks for the feedback! Votes cast by those with less than 15 reputation are recorded, but do not change the publicly displayed post score." :( – Greital May 17 '20 at 06:56
  • @Greital Hehe. Sorry about that. I've helped a little by +1 your question. At least that gives you a start in the right direction. Sorry about not remembering that fact. ;) – jonk May 17 '20 at 06:58
  • This is a component view of double dabble, but I find the original algorithmic description approach easier to grasp – qwr Jun 27 '21 at 03:03
  • @qwr Some people prefer iterative algorithms as a description. Some prefer seeing the patterns laid out by parallel descriptions. Some like both. Some like neither. It's a matter of what sings in your mind. At least I referred to the page where the algorithm is nicely laid out for view. :) – jonk Jun 27 '21 at 04:27