# K-maps for forming 8bit binary to 8bit BCD digital circuit

I have been trying to convert 8bit binary to 8bit BCD. The circuit I have been working on is below:
I built a 4bit binary to 5bit BCD converter using a similar truth table like the one here:

Do I need a bigger truth table if I am going to design an 8bit binary to 8bit BCD converter? Also, are there any other ways I can create the converter circuit? Your help is much appreciated.

• You have 2 7-segment displays, which can handle decimal 0 to 99. 2^7 = 128. So at best you will have a 7 bit binary to 8 bit BCD. So you will need a bigger truth table. Commented May 29, 2019 at 13:25
• @StainlessSteelRat yeah I did the truth table. Its massive and I don't really know how I can get the K-maps for it. Commented May 29, 2019 at 14:09
• @AugieJavax98 Still looking for some ideas? There are two easy and completely different ones I can imagine.
– jonk
Commented May 31, 2019 at 1:26

I'll suggest the more obvious of the two ideas that came to mind. If you haven't already done so, take a look at the double dabble algorithm for conversion. I'll use it as the basis for the following schematics (there are two.)

This first schematic accepts a binary value and leaves it unchanged if the value is $$\\le 4\$$. Otherwise, it adds $$\3\$$ to the binary input. There are some assumed illegal input values: $$\10-15\$$. But it doesn't really matter what happens there. So adding $$\3\$$ in those cases is fine.

simulate this circuit – Schematic created using CircuitLab

The second schematic uses the above circuit (named PLUS3 below), repeatedly:

simulate this circuit

That's all there is to implementing the algorithm documented on the Wiki page mentioned above.

Please do note that the output is 10-bit (or 12-bit if you don't mind going there.) But not 8-bit. (At least 10 bits are required for full conversion.) If you don't need the hundreds, then throw away those you don't need.

## Note

Also see this more recent post on a related question.

• I'm curious - how did you arrive at the first circuit of the plus three module? I'm writing another answer for alternative implementations.
– qwr
Commented May 28, 2020 at 5:39
• @qwr My recollection is that I looked at the initial brute force logic and felt it "could be helped" a bit, toyed with it just for a few minutes and felt "good enough" with what resulted to post it. I probably should have spent more time on it. Might have been able to shorten the longest path, if I had. But I didn't spend the time. I would probably like to see what you develop. It's likely a lot better. Also, look here where I rehashed this old horse, again.
– jonk
Commented May 28, 2020 at 6:02
• Your design uses impressively few circuits but my concern is the maximum delay path (naively counting 8 gates and a half adder). I think a decoder is simple to implement and has less latency. One could create one easily from the DNF equations. And if we include logic for detecting when input is >=5 and multiplexing, the resulting logic is even simpler.
– qwr
Commented May 28, 2020 at 6:09
• @qwr Agreed. I'd like to see what you write, when you write it. I think you are right about the decoder.
– jonk
Commented May 28, 2020 at 6:16
• this is my result messing around with Digital. electronics.stackexchange.com/a/502347/124362 If you're clever you might be able to reuse gates since DNF lists each bit independently.
– qwr
Commented May 28, 2020 at 6:25

Digital can convert the truth table to disjunctive normal form and draw K-maps for each output bit.

• And this, too, now that I see it. Thanks. I only wish you could have placed some of that side by side. It's a bit "long" in the vertical direction.
– jonk
Commented May 28, 2020 at 6:32

When doing arithmetic, K-maps are less useful than other techniques — basically, they are "too general" when doing something as specific as "sometimes I need to add 6 to a number".

Yes, you'll eventually get a correct answer after a lot of effort — and a lot of opportunities for errors to creep into the process. But if you think in terms of comparators and adders to begin with, you'll find that this is a much more direct approach.

• Using the comparator and adder method, I can do the shift add 3 process and get my result right? Commented May 29, 2019 at 11:18
• I don't understand the question. There are many ways to implement binary-to-BCD conversion. Have you searched the Web for techniques? Commented May 29, 2019 at 11:25
• What I need to do is build a converter circuit that converts 8bit binary to 8bit BCD. I have searched the web, but most of what I've found are techniques for 4bit binary to 5bit BCD. To add on, all of the techniques involved the use of truth tables and K-maps. Commented May 29, 2019 at 11:32