It’s a very simple modification to the schematic design. We simply invert the B inputs and leave the A inputs as they are. Instead of adding A and B, this configuration will subtract B from A.
In part 6, we built a 1-bit full adder. In this part we’re going to expand upon that and build a complete 4-bit binary adder. I have made the assumption that you already know about the binary number system but in case you don’t, have a look here and do some searching to learn about it.
Back? Great, let’s get on with it. Grab your CPLD development board, a breadboard and the usual handful of LED, switches and resistors. We will need switches for this guide instead of buttons.
In this guide, we’re going to re-use the hardware setup from part 5 and turn the half-adder into a 1bit full adder. The only thing we’re going to change is the programming of the CPLD itself so I won’t discuss the hardware. If you need to rebuild it, you can re-visit the last part of this guide for a refresher.
In this section of the guide, we’re going to build a simple half adder using the CPLD. If you don’t know what a half adder is, or even a full adder, take a look here. The half adder will introduce two new logic gates, the XOR gate and the AND gate.
Basically, we’re going to add binary bits together.