A brilliant demystification of the elegant hardware logic that bridges the gap between raw binary and human-readable decimal displays. It turns the complex Double Dabble algorithm into a clear, fascinating lesson in fundamental digital design.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
How Computers Actually Display Numbers
Added:When we add something like 55 + 67, it would give us the answer that we want, which is 122.
In binary form, it'd be a little bit tedious just to do all the math inside our head. So, what if there was a way to display the number in decimal form?
What I have here is a seven segment display. Each lever in the back would allow me to turn on separate segments of the display. Activating a certain combination of switches would allow me to display certain numbers like 1 2 3 4 5 6 7 8 9 and lastly zero. Flipping through switches is obviously tedious.
So what if there's a way to have our binary numbers make the decimal numbers appear on the spot? Now what we could do is just make a basic ANDgate decoder and plug it straight into the seven segment display. But as the vid width expands, it would require way more endgates, making it even more complex or difficult to wire. So there should be an easier way to decode, right? Well, yes, there is. But let's go and do some basic review first. In the base 10 numeral system, we know that there's about 10 digits used. 0 1 2 3 4 5 6 7 8 and 9.
After 9, it would shift over to the left. And every single time it shifts over to the left, it would be multiplied by 10. And then we just have to add up whatever values got shifted. And in binary or base 2, it would represent numbers using ones and zeros. And every single time it shifts over to the left would be multiplied by two. So what does this have to do with making binary represent decimal numbers? Well, there's something called binary coded decimal or BCD and it would utilize a 4-bit binary sequence. Just like in decimal, the max value would be 9 or 10 01. Anything higher than 9 would be considered invalid. These invalid numbers would just be considered binary. But there is a way to convert binary into BCD. All you have to do is just add six. So let's say 1 0 1 1 or 11. When we add six, it would shift over to a new 4bit binary sequence. So [music] let's go and add six. And this makes up 11.
Let's do another example that would probably make more sense. Let's say 13 in binary or 11 1.
And this would give us 13 in binary coded decimal.
If you still didn't get it, the binary coded decimal makes up the nine digits just like in normal decimal. The left is the hundredth's place, the middle is the 10th's place, and [music] the right is the ones place. So, what does all this numerical stuff have to do with displaying a number? Well, let's go and take a look back at our seven segment display.
So, we [music] know that different combinations make up different numbers, but we don't really know what to do with them. So, let's go and write them down first. [music] You can start off with one. I'll write down the combination here. Then, we can write down two, and [music] then I'll do the rest of the numbers in just a time lapse. So, we have our list of numbers, but what can we even do with them? You may be thinking, we can just throw them on the screen, right? Well, yeah, we can just use a lookup table and have them send them to the screen, but let's say that we don't know what those terms are. So, let's go and do something more simple.
Let's start by writing down all of these values. Since we know that we're dealing with base 10 in binary coded decimal, we can write down nine values. We can also imagine that these bits are written down as a, b, c, and d. Now, let's also drag in the combinations that make up the numbers 0 through 9. So, how are these combinations going to help us [music] display a number? Well, let's start off by looking at one singular segment, segment A. We can see that segment A would only be off if a one and four is on. We could actually rewrite these numbers as equations. Row one would be a + b + c not d and four would be a not b + c + d. Now if we look closely [music] there would be actually two like terms a and c. This means you can factor it down. Now if we look at these two values we could also foil these two down. So let's go and do it.
Now we could also rewrite these two [music] terms as x nor bringing us a fully factored equation a or c or b x or d. Now that we have our equation let's go and test this inside build for treasure. On the top I have my inputs A, B, C, and D. And in the equation, we know that there was an exclusive nor and an OR operator. Let's plug in B and D into the exclusive norate. And then plug in the rest of the inputs into the orgate.
Let's plug this into input A and test.
So if the BCD number is one, then output A should turn off. And for all the other numbers, it should stay on except for four.
So it looks like our recursion works. So let's go and do all our other inputs.
And now with decoder compacted and finished, we're able to write our binary coded decimal and have it appear as numbers. But we can't really do anything with just this. I mean, how would we convert binary into BCD as a circuit?
Let's take a look back at the basics.
Over here, I hooked up our seven segment display into two separate 4-bit segments [music] of this 8bit counter. In BCD, we know that any value under 9 is valid and any value above 9 is considered invalid, giving us no value. Let's say we have a value of 13. To convert [music] this invalid binary number into BCD, what we have to do is just add six, and this would give us 13 in binary coded decimal. Now, it would be tiring just to add by hand. So, what if there was a way to make a circuit [music] that would do this for us? Let's first try to understand what's happening. On the right, I have 181 in binary form.
[music] On the left, we have our BCD outputs.
Let's go down and shift over to the left. If the [music] cell is greater or equal to 5, then we'd have to add three.
But wait, why do you think we have to do this in the [music] first place? Well, remember in binary when you shift the bits to the left, you would effectively multiply the bits by two. And because in BCD, the digit should reset to zero after 9. So this means any digit at five or higher will mathematically overflow past 9 when doubled. So adding the would act as a offset. Now that we entirely understand what we're doing, let's get back into it. So let's go and shift left. Shift left one more time. And we can see in the first cell that it's greater than five here. So we must add three. Let's go and shift again. And now we can see on the second cell it is 9 which is greater than five. So we add three on [music] the second cell.
Now let's go and shift again. And this gives us our desired value 18 and 1 in BCD. I also do recommend pausing to see what happened. Now, plugging in the output directly into [music] a display would give us 181, which is the binary value we started with. This algorithm that we just did was called double dabble. So, how are we supposed to make this algorithm into a circuit? Well, let's find out.
So there's only two steps in double double that we know of which is shift over to the left and if it's greater than five then we add three. I'll start by making my outputs [music] in this. I made it so that if the value is five then it would turn off this switch up here disabling all normal outputs. Then I can have this toggle the value of what 5 + 3 [music] would be which would be 8. Now let's go and do this for the rest of the values. So now any value under five should output normally but once it turns five [music] it should become a eight. Six should become a 9. Seven should become a 10. 8 should become 11. And 9 should become a 12. Great. So it works. Now that we have our cell, let's go and start making our circuit. Let's go look back at our diagram. In the diagram that we showed, it would start taking in a value after the third bit. So let's bring in our dabble circuit. And then I'll wire the last values as if it's just shifted in three bits up. Then we shift over to the left and then read the next bit. [music] Then we're going to duplicate and shift over and read the next bit again. Now, if you look over at our diagram, we can see that after it passes three, it would also need its own dabble. So, let's [music] go and shift this down and then duplicate this to our side for 10th's place and then connect all our bits.
Now, we can duplicate and shift over to the left once more.
Now, since the first bit can't get affected at all, we're just going to drag this straight down. And we're also going to make an output for the second bit on the hundreds place. Let's also rearrange this into something more readable for the hundreds place, the 10's place, and the ones place. Now let's try something like 128. Now it gives us a 1 2 and 8 BCD which is 128.
Now using our seven segment display with the 4bit decoders would allow us to visualize the binary coded decimal numbers like 128 32 and 6.
So now if you come back to our calculator with the newly made displays [music] when we calculate 55 + 67 now would show us an easier to read value 122. We have learned about the seven segment display binary coded decimal and also how computers display numbers.
If you like this video please [music] consider subscribing or something. I don't know. I did this video before the division circuit because I wanted to be able to visualize your numbers without having to struggle at all. Uh I honestly don't have anything else to say. Uh so see you all and bye.
Related Videos

TOP 15 Data compression Interview Questions and Answers 2019 Part-2 | Data compression | Wisdom jobs
wisdomjobs
281 views•2019-06-28

CTS 158: 802.11w Management Frame Protection
ClearToSend
4K views•2019-02-04

NDSS 2019 Send Hardest Problems My Way: Probabilistic Path Prioritization for Hybrid Fuzzing
NDSSSymposium
496 views•2019-04-02

How realistic is Cities: Skylines?
CityBeautiful
159K views•2019-02-14

GUIs & TUIs: Choosing a User Interface for Your Python Project | Real Python Podcast
realpython
2K views•2025-04-04

The OSI Model - Explained by Example
hnasr
225K views•2019-05-12

Cloud Computing - Introduction
elithecomputerguy
98K views•2019-10-07

From Traveler's Dilemma to Dynamic Routing | Demystifying Networking
IITBombayJuly
5K views•2019-08-04
Trending

Gremlin Arrives… While Dorothy May Takes Another Step Forward
The-moons
10K views•2026-07-23

Playstation NO DISC/NO BUY Fight Is Over...
DavidJaffeGames
4K views•2026-07-23

Americans Confused in Australia for 17 Minutes Straight
IWrocker
17K views•2026-07-23

FURIOUS Raskin CORNERS DOJ over Trump DARK PAST!!!!
MeidasTouch
237K views•2026-07-23