Objective
In this laboratory exercise, the student will design a parity generator, both odd and even, as well as a controlled number inverter using LogicWorks simulation software. This is the student’s first exposure to LogicWorks and thus learning how to use LogicWorks is a major part of the experiment.
Methods/Materials/Formulas/Part Information
Simulation is the method to be used and LogicWorks software is the only “materials” needed.
One IC (the 74_86) and individual XOR gates are used in the simulation. A simple input switch is available in the parts Library and is called a Binary Switch in LogicWorks. Output can be easily observed by attaching a LogicWorks Binary Probe from the parts Library.
A simple 2-input XOR truth table is shown below:
Procedures
The first project will be a Parity Generator. This is a circuit that analyzes a number of input bits and determines if the number of “1s” coming in is an even number or an odd number and then generates an output bit that, when counted along with the inputs, makes the total number of 1’s an even number (for an even generator) or odd number (for an odd generator). For example, if the value 1001 were entered into a 4-bit even parity generator the circuit would see that there are 2 ones, an even number, so the generator’s output would be a “0” since no more 1’s are needed for the even condition.
- Locate the software LogicWorks on the Lab PC and activate the program. At the Welcome screen click CREATE. The center of the screen has the “breadboard” area and to the right is a Library of parts. At the bottom is a Timing display which you will not need. If you want a larger breadboard you can close the Timing display window: Look for the tool button and click on it to deactivate the Timing window.
- Design, construct, and test a circuit that generates an even parity bit from four message bits (a, b, c, d). It uses only XOR gates. A 3-input circuit has been covered in the textbook in Figure 3.34a. This can be used and expanded to create a 4-input generator. The resulting 4-input even parity generator is shown on the next page.
- Create a truth table with a, b, c, d as inputs and both Peven and Podd as outputs. Now complete the table with the correct (expected) results for an Even Parity Generator and an Odd Parity Generator.
- Build a circuit for the even parity generator using the 7486 IC in LogicWorks. It can be found as 74_86 in the Library parts list (type 74_86 into the filter, click once on the 74_86 and a preview will appear). Brief instructions follow.
HOW TO USE LOGICWORKS:
- To obtain a part from the parts library and place it on the breadboard: Type the name/number into the Filter or scroll down the list until you locate the part. Double click on the part name to select it and move your mouse pointer to the spot you want to drop the part then click again. You can continue to drop the same part again until you push the Space Bar or the ESC key.
- There are several libraries of parts in LogicWorks and new libraries can be created. If a single library is selected then only the parts in that library will be displayed in the parts menu. This decreases the number of parts in the list and helps to locate parts.
- To wire connections together: place the mouse pointer on the tip of the part contact, click and drag to the next contact point, then release. The wire should connect. If you want to control the direction of the wire (such as turn a corner) you can release during the drag and immediately click down and continue dragging in the new direction. Alternatively, the wiring tool may be used which automatically routes the wire for one corner. Left click the mouse button to enable a second corner.
- To remove a wire: You can click on the ZAP tool button, move it to each wire or item you want to remove and click to remove that wire. . Again the space bar or ESC key will turn off the tool or just click on the Pointer button. Or if removing all wires from a contact point just right-click on the wire and select Delete.
- To add text: Use the A tool button to activate the text box and move the pointer to the location the text is to be added and click. Type the text in the box that appears. Multiple text boxes can be made. To stop making text boxes, clicking back on the Pointer button.
- To run a simulation: Click on the simulator button. Simulation speed can be changed with the slider , and the
STOP button will stop simulation.
- To build a circuit use the Library part called “Binary Switch” to provide 4 inputs, a, b, c, and d. Use the library part “74_86” which is a quad 2-input XOR, and use a “Binary Probe” from the parts list to show the output (1 or 0) of your parity generator. Also be aware that in LogicWorks when an IC is placed in the circuit the simulator applies power and ground to the IC automatically. Connect all the wiring, add a Text Label for each switch (a,b,c,d), and label the Binary Probe output “P-even”.
- Run the simulation. Each Binary Switch can be changed between “0” and “1” by clicking on the switch. You need to run through all 16 input combinations and record the P-Even parity output bit value. Verify the circuit output matches the table created in step 3.
- The Even Parity Generator needs to be modified into an Odd Parity Generator. The simplest way to do that is to invert the output of the even generator. However, there is one extra XOR available in the IC, use it as an inverter instead of introducing another IC with inverters. Observe the truth table for a two-input XOR gate. How can the XOR gate be used as an inverter? Hint: Below right the table has been divided into a top-half and bottom-half, which half causes y to become inverted at the output?
Additional logic information that may be useful:
- Anytime you need a “permanent high input” (logic 1), connect that pin to a +5V symbol that you can obtain from the Library list.
- Anytime you need a “permanent low input” (logic 0), connect that pin to a “Ground” symbol that you can obtain from the Library list.
- Now wire in the added gate (do not change the existing circuit). Add another Binary Probe to view the new output. Place a Text Label over this Probe entitled “P-odd”.
- Run the simulator and record your P-odd output for each combination of a,b,c,d. Record your results in the table. Determine if your new circuit truly is an Odd Parity Generator. (To activate a Binary Switch, move the pointer to it and click.)
The second project will be a Controlled Number Inverter. Now that you know how to make a 1-bit inverter using an XOR gate, you will design a circuit that takes 4 input bits and has 4 output bits which can be inverted or not-inverted based on a control switch. The goal of this project is to have a 4-bit number (represented by 4 switches) be presented in an “output” in either its normal form or its inverted form. The selection of normal vs. inverted is to be controlled by a binary control switch.
- From the File menu create a New – Circuit and place four 2-input XOR gates. This time instead of using an IC, use individual logic gates in the Parts Library. To do this, place the letters XOR in the Library Filter. Locate the xor_2 part and transfer four of them to your breadboard.
- Obtain four Binary Switches from the Library and organize them on the left side of the breadboard as shown. Place labels b3, b2, b1, b0 over the switches.
Input Switch Illustration
- Obtain four Binary Probes from the Library and organize them on the right side of your breadboard as shown below also with text labels.
Output Probe Illustration
- Wire b0 to one input of the 1st XOR gate, wire b1 to one input of the 2nd XOR gate, wire b2 to one input of the 3rd XOR gate, and wire b3 to one input of the 4th XOR gate.
- Wire the output probes to the outputs of the four XOR gates, the out0 indicator needs to go to the XOR gate that has the b0 input switch, and out1 indicator needs to go to the XOR gate that has the b1 input switch, etc.
- This leaves one input of each XOR gate unconnected. Connect all four of these individual inputs to a single Binary Switch. Label this Binary Switch “CONTROL: 0=NonInvert, 1=Invert.” Add a text box title “4-Bit Controlled Inverter” at the top of this circuit.
- Testing the operation. Inputs b3-b0 are input values in MSB to LSB order. Out3-out0 is the output value in MSB to LSB order. Start with the CONTROL switch at ‘0’. Apply various values (0000-1111) to verify the output is exactly the same values. Create a table of all 16 possible inputs and record all 16 outputs for your report.
- Now change the CONTROL switch to a ‘1’. Apply various values (0000-1111) to verify the output is an inverted value. Create another table of all 16 possible inputs and record all 16 outputs for your report.
- Save your projects and close the LogicWorks software