第14章 用逻辑门实现加法
Addition is the most basic arithmetic operation. This chapter demonstrates how logic gates can add binary numbers. In all these circuits, you select the digits to be added using the square buttons. You can toggle these buttons with mouse clicks or finger taps. The output is shown in the circles.
All the gates in these animations have their propagation times set to 100 milliseconds (1/10th second). When you toggle one of the switches, you can see the bits propagating from left to right.
One-Bit Sum (pages 174)
The journey of a complex adder begins with a single bit sum:
One-Bit Half Adder (page 176)
That sum must be supplemented with a Carry bit. Although the sum part of this circuit is shown in the book as an Exclusive-OR (XOR) gate, the individual gates are shown here:
One-Bit Full Adder (pages 177)
Two adders are required to accomodate a Carry In bit. In the book, this is shown with a pair of half-adders encapsulated in a box, but here all the separate gates are shown.
Eight-Bit Adder (pages 180)
Finally, entire bytes can be added by cascading eight one-bit adders. The diagram in the book shows the encapsulated full adders but this animation shows all the individual logic gates.
Select the two binary values to be added by clicking or tapping the square buttons at the top. The values in hexadecimal and decimal are shown at the far right. The binary result is shown in the circles at the bottom, and the hexadecimal and decimal equivalents are shown at the far right.
This circuit implements a ripple carry. The Carry Out from each bit must be calculated for the Carry In of the next most significant digit. To see the full propagation delay, try setting the entire row of top buttons to 1, and then use the buttons in the second row to add 1 to that.