LAB00
LAB00
1. Getting Started
1st question.
There are 3 types of VHDL design styles, namely dataflow, structural, and behavioral styles.
- The VHDL design style of the mux2in1b.vhd is dataflow, because it describes the circuit by
describing how data flow in the circuit.
2nd question
In the mux2in1b_3state.vhd, it is clear that the design style of the multiplxer is behavioral
because the code describes the mux2 at the most abstract level, not gate or interconnected
gates.
From the truth table given above, the derived function of the NAND gate is:
2nd question
Since the NAND gates has 2 inputs, there are 4 possible different inputs pair: 00,01,10,11.
Looking at the simulation results, it is clear that the outputs corresponding to the 4 inputs are 1,
1, 1, 0, which are the same as the results in the truth table ( Figure 3).
From the truth table given above, the derived function of the XOR gate with 3 inputs is:
or simply
2nd question
The VHDL code of the 3 input XOR gate in dataflow style is:
Figure 8: Simulation result of 3-input XOR gate designed with dataflow style.
The VHDL code of the 3 input XOR gate in structural style is:
Figure 9: Simulation result of 3-input XOR gate designed with structural style.
The VHDL code of the 3 input XOR gate in behavioral style is:
Figure 10:Simulation result of 3-input XOR gate designed with behavioral style.
3rd question
Looking at 3 simulation results of the XOR3 gate with 3 design styles, it is clear that the results of
each design styles is the same and similar to the outputs of the truth table given in Figure 5.
4. Simulation using testbench
1st question
The test_vector(0), (1), (2) correspond to 3 inputs of the XOR gate A, B, C, respectively. Take the
test_vector 001, for example, the inputs A, B, and C would be 0, 0, 1. Based on the truth table
given in Figure 4, the output corresponding with 001 is 1.
2nd question
The program below is the testbench for the 2-input NAND gate in Section 2.
library ieee;
use ieee.std_logic_1164.all;
entity nand_gate_tb is
end;
end process;
end;
Figure 12: testbench of the 2-input NAND gate.