DD Lab Expt 2
DD Lab Expt 2
1. Open LTSpice from desktop and open a New Schematic from File tab.
2. Click on the Component tab (looks like a AND gate) on the new schematic
window
3. Note the path of the LT SPICE lib file
4. Copy paste 74ct.lib file in the folder C:\Program Files\LTC\LTspiceIV\lib\sub
5. Copy paste all the files contained in the downloaded folder
“Sym” into C:\Program Files\LTC\LTspiceIV\lib\sym
6. Click on the SPICE Directive tab as shown below:-
1
7. Select spice directive and type .include 74hct.lib
8. Place the SPICE directive on the schematic
9. Select the component tab and you will be able to see the 74XX series gates.
10. Ex. IC number: 74HCT08 for AND gate, 74HCT32 for OR gate ,….
11. Label i/p and o/p terminals of the gate.
12. Applying inputs to the input terminals:
From components tab select voltage and then by right-clicking and selecting
‘Advanced’ in which select PULSE. Set the 2-input voltages
2
For first input
T on =1µ, T period= 2µ → ok
13. To simulate:
14. right click → edit simulation → transient→ Stop time: 4µs → Run
15. Verify the truth table of the gate from the output
16. Try Similar runs for NOT, NAND, NOR and XOR Gates on LTSpice and verify
corresponding Truth Tables.
II. LTSpice Simulation of Boolean function and verification using Digital IC trainer kit
The first circuit we will be investigating is a majority circuit. A majority circuit is a circuit whose
output is a 1 when a majority of input variables are 1’s and 0 otherwise. An incomplete truth table
of a 3-input majority circuit is given below. Complete the truth table.
A B C F
0 0 0 0
0 0 1
0 1 0
0 1 1 1
1 0 0
1 0 1 1
1 1 0
1 1 1
From the truth table write the output F in canonical SOP form & POS form
F (SOP form) =
F (POS form) =
Q1: How many AND gates and OR gates would be required to implement the canonical
SOP form of F? How many inputs should each of these gates have?
3
From the above we can infer that implementing the canonical form of F as it is would require more
hardware resources, A better alternative would be to implement a simpler form of F. Using
Boolean algebra obtain a simplified expression for F and write it down.
Draw the circuit diagram of the simplified SOP form of F using 2 input AND gates and 2 input
OR gates. (Use the minimum number of gates)
CIRCUIT - 1
Draw the circuit diagram to realize F using minimum number of 2 input AND and 2 input OR
gates.
CIRCUIT – 2
4
Simulation of the simplified expression using LTSpice:
1. Select the component tab and you will be able to see the 74XX series gates.
2. Simulate the logic circuit of the simplified Boolean expression.
3. Connect appropriate inputs to the logic circuit and label the output.
4. Run the simulation and verify the truth table of the majority circuit
A B C F
Now wire up the above circuit using the required number of ICs in the Digital IC trainer kit. (the
pin out of the ICs is given in Appendix A). Feed inputs using toggle switches and observe the
output on LEDs. Tabulate your observations for any four input combinations below.
A B C F
5
No. of NAND gates used :
Total number of ICs used :
What are the advantages and disadvantages of the two implementations? Record your
comments below.
1)
2)
3)
Table 2.4: Simulation and experimental results 3-input majority circuit using only NAND
gates
A B C F (Simulation) F (Digital IC
trainer kit)
Exercise #01: Write the Verilog code of the NAND – NAND implementation of the majority
circuit. Simulate the circuit with the same inputs as in the experiment and verify that the circuits
are equivalent.
Exercise #02: Write the Verilog description of a 3 input XOR gate without using the XOR
primitive
6
1. Can a NOT gate be implemented using a) NAND gates only b) NOR gates only c)
XOR gates only? If so, how?
2. Name the universal gates. Why are they called ‘universal’?
3. How many 7400 ICs will be required to implement a) 2-input XOR gate b) input
XNOR gate? Draw diagrams to justify.
4. Why multiple variable XOR operation is called odd function? Write the canonical
SOP form of four variable odd function. Which operation would give rise to even
function?
5. Prove that any function can be implemented using only XOR and AND gates.
6. Write one advantage and one disadvantage of gray code over binary code.
7. Where is parity generation and checking useful?
8. The Verilog description of a circuit is given below. Draw the equivalent circuit and
identify its functionality.
module circuit(f,a,b,c);
input a,b,c;
output f;
wire ab,bc,ca;
or or1(ab,a,b),
or2(ac,a,c),
or3(bc,b,c);
and(f,ab,bc,ca);
endmodule
Write Verilog code for gate-level design of Majority Function using logic gates. In this design you require
three 2-input AND gates and two 2-input OR gates.
7. Repeat this for all inputs and then click to run the simulation for specified amount of time.
8. You can test your design by 8 input combinations below. Also follow these steps
9.
8
5. When the ‘Welcome to PlanAhead’ dialog pops up, click on “Close” to continue…
6. Click on plus sign to view all of the “Scalar Ports” i.e. input and output ports.
22. Click on “Device2 ( FPGA xc3s50)”And then select “FPGA Device Specific Programming
Properties” → Click on OK to continue.
23. Click on “Program” and wait till it runs→ After running, “Program Succeeded” will appear.
24. Now the program is dumped into the FPGA kit successfully. Apply inputs and check the outputs
on FPGA Kit.