Difference between revisions of "Digital Tutorial Lesson 5: Building a Reusable Digital Device: Binary Full Adder"
Kazem Sabet (Talk | contribs) (Created page with "{{projectinfo|Tutorial| Building Your Own Reusable Binary Adder Digital Device |TUT9-10.png|In this project, the basic concepts of RF.Spice A/D are demonstrated, and a simple...") |
Kazem Sabet (Talk | contribs) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | {{projectinfo|Tutorial| Building Your Own Reusable Binary Adder Digital Device |TUT9- | + | {{projectinfo|Tutorial| Building Your Own Reusable Binary Adder Digital Device |TUT9-4.png|In this project, the basic concepts of RF.Spice A/D are demonstrated, and a simple voltage divider is modeled and examined.| |
*[[CubeCAD]] | *[[CubeCAD]] | ||
Line 39: | Line 39: | ||
Connect the parts as shown in the figure. Run a live [[Digital Simulation|digital simulation]]. When simulating digital circuit, instead of "Run", you use the "Step" feature. At every time step, that state of all the digital outputs are updated based on the latest states of the digital inputs. Click the "'''Step'''" [[File:b2Step_Tool.png]] button of the '''[[Toolbars#Main_Toolbar |Main Toolbar]]''' or simply use the keyboard shortcut "'''Ctrl+H'''". To generate the truth table of the half adder, set the values of the inputs A and B using their up and down arrow buttons to (0,0), (1,0), (0,1) and (1,1) at each time step, consecutively. Note that when you change the input values, the output does not change instantaneously until your increment the time step. The truth table of the binary half adder and two simulation scenarios are shown in the figures below. In a live [[Digital Simulation|digital simulation]], B2.Spice's Circuit [[Animation]] feature is always enabled by default. You can see the binary of all the wire. Also note how all the wires of the circuit are color-coded in red and blue for 1 (High) and 0 (Low) states, respectively. | Connect the parts as shown in the figure. Run a live [[Digital Simulation|digital simulation]]. When simulating digital circuit, instead of "Run", you use the "Step" feature. At every time step, that state of all the digital outputs are updated based on the latest states of the digital inputs. Click the "'''Step'''" [[File:b2Step_Tool.png]] button of the '''[[Toolbars#Main_Toolbar |Main Toolbar]]''' or simply use the keyboard shortcut "'''Ctrl+H'''". To generate the truth table of the half adder, set the values of the inputs A and B using their up and down arrow buttons to (0,0), (1,0), (0,1) and (1,1) at each time step, consecutively. Note that when you change the input values, the output does not change instantaneously until your increment the time step. The truth table of the binary half adder and two simulation scenarios are shown in the figures below. In a live [[Digital Simulation|digital simulation]], B2.Spice's Circuit [[Animation]] feature is always enabled by default. You can see the binary of all the wire. Also note how all the wires of the circuit are color-coded in red and blue for 1 (High) and 0 (Low) states, respectively. | ||
− | |||
{| class="wikitable" style="text-align:center" | {| class="wikitable" style="text-align:center" | ||
Line 56: | Line 55: | ||
|- | |- | ||
|} | |} | ||
− | |||
<table> | <table> | ||
Line 68: | Line 66: | ||
</tr> | </tr> | ||
</table> | </table> | ||
− | |||
=== Creating a Digital Device from Your Adder Circuit === | === Creating a Digital Device from Your Adder Circuit === | ||
Line 74: | Line 71: | ||
[[File:TUT9-9.png|thumb|450px|The property dialogs of Digital Input and Digital Output parts.]] | [[File:TUT9-9.png|thumb|450px|The property dialogs of Digital Input and Digital Output parts.]] | ||
Before you proceed to the next part of this tutorial, you will create a reusable digital part out of your binary half added circuit. This procedure is very similar but much simpler than the case of analog circuits you carried out in Tutorial Lesson 6. If you open the property dialog of your digital inputs or outputs, you will notice that a checkbox labeled "Use As Subcircuit Port" has been already been checked by default. This means that [[B2.Spice A/D]] takes your digital circuit with all the designated input and output ports and packages it as a digital device "As Is". | Before you proceed to the next part of this tutorial, you will create a reusable digital part out of your binary half added circuit. This procedure is very similar but much simpler than the case of analog circuits you carried out in Tutorial Lesson 6. If you open the property dialog of your digital inputs or outputs, you will notice that a checkbox labeled "Use As Subcircuit Port" has been already been checked by default. This means that [[B2.Spice A/D]] takes your digital circuit with all the designated input and output ports and packages it as a digital device "As Is". | ||
− | |||
Go the File Menu and select "Create Part from Circuit..." or simply use the keyboard shortcut "Ctrl+M". A dialog pops up asking you to enter a name for your new device. Enter "MyHA" (My Half Adder) for the name. Then, the program asks you if you want it to create a symbol for your new device. Answer yes and proceed. The device will be generated and added to your Parts Database. Keep in mind that you can create your own symbols or modify the program-generated symbol using B2.SPice's Symbol Editor. | Go the File Menu and select "Create Part from Circuit..." or simply use the keyboard shortcut "Ctrl+M". A dialog pops up asking you to enter a name for your new device. Enter "MyHA" (My Half Adder) for the name. Then, the program asks you if you want it to create a symbol for your new device. Answer yes and proceed. The device will be generated and added to your Parts Database. Keep in mind that you can create your own symbols or modify the program-generated symbol using B2.SPice's Symbol Editor. | ||
− | |||
=== Building a Binary Full Adder === | === Building a Binary Full Adder === | ||
Line 103: | Line 98: | ||
---- | ---- | ||
− | |||
A binary full adder is a digital circuit that adds two single binary bits A and B and accounts for values carried in as well as out. It adds three bits: A, B, and Cin, a bit carried in from the previous less significant stage. The circuit produces a two-bit output, sum (S) and output carry (C). The equivalent decimal value of the binary sum is 2Cout + S. | A binary full adder is a digital circuit that adds two single binary bits A and B and accounts for values carried in as well as out. It adds three bits: A, B, and Cin, a bit carried in from the previous less significant stage. The circuit produces a two-bit output, sum (S) and output carry (C). The equivalent decimal value of the binary sum is 2Cout + S. | ||
Line 110: | Line 104: | ||
Connect the parts as shown in the opposite figure. Run a live [[Digital Simulation|digital simulation]] of your circuit using manual stepping. Generate the truth table of the full adder circuit in a similar manner as in the previous case. However, in this case, first you set Cin = 0, change the values of A and B, and then you set Cin = 1, and repeat the procedure. The truth table of the binary full adder and four different simulation scenarios are shown in the figures below. As you can see from the figures, B2.Spice's color coding of the digital wires comes in very handy. | Connect the parts as shown in the opposite figure. Run a live [[Digital Simulation|digital simulation]] of your circuit using manual stepping. Generate the truth table of the full adder circuit in a similar manner as in the previous case. However, in this case, first you set Cin = 0, change the values of A and B, and then you set Cin = 1, and repeat the procedure. The truth table of the binary full adder and four different simulation scenarios are shown in the figures below. As you can see from the figures, B2.Spice's color coding of the digital wires comes in very handy. | ||
− | |||
{| class="wikitable" style="text-align:center" | {| class="wikitable" style="text-align:center" | ||
Line 134: | Line 127: | ||
| 1 || 1 || 1 || 1 || 1 | | 1 || 1 || 1 || 1 || 1 | ||
|} | |} | ||
− | |||
<table> | <table> | ||
Line 154: | Line 146: | ||
</tr> | </tr> | ||
</table> | </table> | ||
− | |||
Before you proceed to the next of this tutorial lesson, create a new part from your binary full adder circuit. Follow the same procedure as in the previous case and choose the name "MyFA" (My Full Adder) for your new device. | Before you proceed to the next of this tutorial lesson, create a new part from your binary full adder circuit. Follow the same procedure as in the previous case and choose the name "MyFA" (My Full Adder) for your new device. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<p> </p> | <p> </p> | ||
− | [[Image:Back_icon.png|40px]] '''[[RF.Spice_A/D | Back to RF.Spice A/D | + | [[Image:Back_icon.png|40px]] '''[[RF.Spice_A/D#RF.Spice_A.2FD_Tutorial | Back to RF.Spice A/D Tutorial Gateway]]''' |
Latest revision as of 16:56, 21 September 2015
Building Your Own Reusable Binary Adder Digital Device
Contents
Objective
In this tutorial lesson, you will first build and analyze binary half adder and full adder circuits made up of logic gates. Then you will create a new database part out of the full adder circuit. Finally, you will use the new full adder part to build a four-bit ripple-carry adder digital circuit.
Building a Binary Half Adder
The following is a list of parts needed for this part of the tutorial lesson:
Digital Input: A (keyboard shortcut: N)
Digital Input: B (keyboard shortcut: N)
XOR Gate (keyboard shortcut: X)
AND Gate (keyboard shortcut: A)
Digital Output: S (keyboard shortcut: O)
Digital Output: C (keyboard shortcut: O)
The binary half adder is a digital circuit that adds two single binary bits A and B. It has two outputs, sum (S) and carry (C). The carry signal represents an overflow into the next significant bit of a multi-bit addition. The equivalent decimal value of the binary sum is 2C + S. The half adder can be built using an XOR gate and an AND gate as shown in the opposite figure.
Connect the parts as shown in the figure. Run a live digital simulation. When simulating digital circuit, instead of "Run", you use the "Step" feature. At every time step, that state of all the digital outputs are updated based on the latest states of the digital inputs. Click the "Step" button of the Main Toolbar or simply use the keyboard shortcut "Ctrl+H". To generate the truth table of the half adder, set the values of the inputs A and B using their up and down arrow buttons to (0,0), (1,0), (0,1) and (1,1) at each time step, consecutively. Note that when you change the input values, the output does not change instantaneously until your increment the time step. The truth table of the binary half adder and two simulation scenarios are shown in the figures below. In a live digital simulation, B2.Spice's Circuit Animation feature is always enabled by default. You can see the binary of all the wire. Also note how all the wires of the circuit are color-coded in red and blue for 1 (High) and 0 (Low) states, respectively.
Inputs | Outputs | ||
---|---|---|---|
A | B | C | S |
0 | 0 | 0 | 0 |
1 | 0 | 0 | 1 |
0 | 1 | 0 | 1 |
1 | 1 | 1 | 0 |
Creating a Digital Device from Your Adder Circuit
Before you proceed to the next part of this tutorial, you will create a reusable digital part out of your binary half added circuit. This procedure is very similar but much simpler than the case of analog circuits you carried out in Tutorial Lesson 6. If you open the property dialog of your digital inputs or outputs, you will notice that a checkbox labeled "Use As Subcircuit Port" has been already been checked by default. This means that B2.Spice A/D takes your digital circuit with all the designated input and output ports and packages it as a digital device "As Is".
Go the File Menu and select "Create Part from Circuit..." or simply use the keyboard shortcut "Ctrl+M". A dialog pops up asking you to enter a name for your new device. Enter "MyHA" (My Half Adder) for the name. Then, the program asks you if you want it to create a symbol for your new device. Answer yes and proceed. The device will be generated and added to your Parts Database. Keep in mind that you can create your own symbols or modify the program-generated symbol using B2.SPice's Symbol Editor.
Building a Binary Full Adder
The following is a list of parts needed for this part of the tutorial lesson:
Digital Input: A (keyboard shortcut: N)
Digital Input: B (keyboard shortcut: N)
Digital Input: Cin (keyboard shortcut: N)
Two XOR Gates (keyboard shortcut: X)
Two AND Gates (keyboard shortcut: A)
OR Gate (keyboard shortcut: U)
Digital Output: S (keyboard shortcut: O)
Digital Output: Cout (keyboard shortcut: O)
A binary full adder is a digital circuit that adds two single binary bits A and B and accounts for values carried in as well as out. It adds three bits: A, B, and Cin, a bit carried in from the previous less significant stage. The circuit produces a two-bit output, sum (S) and output carry (C). The equivalent decimal value of the binary sum is 2Cout + S.
A full adder can be constructed from two half adders by feeding the inputs A and B to the first half adder, connecting the sum from the first half adder to an input to the second half adder, connecting Cin to the other input of the second half adder and passing the two carry outputs of the two half adders through an OR gate.
Connect the parts as shown in the opposite figure. Run a live digital simulation of your circuit using manual stepping. Generate the truth table of the full adder circuit in a similar manner as in the previous case. However, in this case, first you set Cin = 0, change the values of A and B, and then you set Cin = 1, and repeat the procedure. The truth table of the binary full adder and four different simulation scenarios are shown in the figures below. As you can see from the figures, B2.Spice's color coding of the digital wires comes in very handy.
Inputs | Outputs | |||
---|---|---|---|---|
A | B | Cin | Cout | S |
0 | 0 | 0 | 0 | 0 |
1 | 0 | 0 | 0 | 1 |
0 | 1 | 0 | 0 | 1 |
1 | 1 | 0 | 1 | 0 |
0 | 0 | 1 | 0 | 1 |
1 | 0 | 1 | 1 | 0 |
0 | 1 | 1 | 1 | 0 |
1 | 1 | 1 | 1 | 1 |
Before you proceed to the next of this tutorial lesson, create a new part from your binary full adder circuit. Follow the same procedure as in the previous case and choose the name "MyFA" (My Full Adder) for your new device.