VHDL Questions and Answers – Implementing Gates with Different Modelling – 2

This set of Basic VHDL Questions and Answers focuses on “Implementing Gates with Different Modelling – 2”.

1. What is the minimum number of NAND gates required to implement an EXOR gate?
a) 2
b) 3
c) 4
d) 5
View Answer

Answer: c
Explanation: We can implement an EXOR gate with a minimum of 4 NAND gates. However, when we follow the conventional way to convert an EXOR logic into the NADN logic, then the number of logic gates required is 5, but 1 of them is redundant and therefore, we can implement EXOR get by using 4 NAND gates.

2. Which of the following logic describes the EXOR gate?
a) y <= ((not a) OR (not b)) AND ((not a) OR (not b));
b) y <= ((not a) OR b) AND (a OR (not b))
c) y <= ((not a) AND (not b)) OR ((not a) AND (not b));
d) y <= ((not a) AND b) OR (a AND (not b));
View Answer

Answer: d
Explanation: EXOR function or Exclusive OR is a function in which two inputs of the gate can’t be at high level exclusively, in that case the output will be low. It is described by Y = A’B + AB’. This function is described in the VHDL terms by using option d. Therefore, option d represents EXOR gate.

3. What logic circuit is described by the following code?

advertisement
advertisement
ARCHITECTURE gate OF my_gate IS
BEGIN
WITH ab SELECT
y<= 0 WHEN “01” OR10;
        1 WHEN OTHERS;
END gate;

a) NAND
b) NOR
c) EXOR
d) EXNOR
View Answer

Answer: d
Explanation: Since the output is high when all the two inputs are either high or low. Otherwise, the output is low. This is the case opposite of EXOR gate. So, this must be EXNOR gate.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

4. Sometimes gates modeled with ________ modeling may behave differently.
a) Dataflow
b) Behavioral
c) Structural
d) Structural and Behavioral
View Answer

Answer: a
Explanation: Sometimes, dataflow modeling doesn’t behave as we want it to. This different behavior can be with any of the gate. For example, OR gate may behave as AND gate for instance. This occurs at the time of synthesis due to switches in the switch bank.

5. The odd behavior of gates in dataflow modeling may be the result of ________
a) Sequential statements
b) Wrong logic definitions
c) Concurrency
d) Inappropriate assignments
View Answer

Answer: c
Explanation: The VHDL code is concurrent code and it has its own advantages and disadvantages. Concurrency of VHDL results in faster execution. In some PAL or PLA device, it may be like executing AND after OR execution which may result in different results.
advertisement

6. Which of the following option represents a structural model for not gate?
a)

    Architecture not_gate OF my_func IS
    BEGIN
    x: IN STD_LOGIC;
    y: OUT STD_LOGIC;
    END not_gate;

b)

advertisement
    Architecture not_gate OF my_func IS
    BEGIN
    x: IN STD_LOGIC;
    y: OUT STD_LOGIC;
    y<= NOT x;
    END not_gate;

c)

   Architecture not_gate OF my_func IS
    BEGIN
   COMPONENT NOT IS
   Port(  x: IN STD_LOGIC;
   y: OUT STD_LOGIC);
   END COMPONENT;
    END not_gate;

d)

   Architecture not_gate OF my_func IS
    BEGIN
    COMPONENT not1 IS
    PORT( x: IN STD_LOGIC;
    y: OUT STD_LOGIC);
    END COMPONENT;
    END not_gate;
View Answer
Answer: d
Explanation: Since the structural modeling defines only the components with their input and output ports. But the name of component can’t be same as any reserved word of VHDL.
 
 

7. In CPLD, there are many input switches arranged in a switch bank, if an AND gate is behaving oddly but could be the reason?
a) Incorrect interconnections
b) Concurrent execution of statements
c) Mismatch of ports name and switches
d) Wrong libraries included
View Answer

Answer: b
Explanation: A CPLD is a device which has many input outputs and logic gates and it also includes interconnection between them. The inputs are arranged in the form of switch banks, the gate may perform different due to concurrency of the statement. Due to concurrent statements, the state of a switch can vary and which can affect the output.

8. For gates, which of the following modeling style will corresponds to shortest code?
a) Behavioral
b) Data flow
c) Structural
d) Both data flow and behavioral
View Answer

Answer: b
Explanation: Since in case of dataflow modeling we just need to define the relation between inputs and outputs using some logical function. So, gates can be modeled be using dataflow style in just one line. Whereas Behavioral needs selected assignment and structural used component declaration and instantiation.

9. Generally, structural modeling is used with another modeling style.
a) True
b) False
View Answer

Answer: a
Explanation: We can’t describe a logic gate or circuit by using a structural model alone. At least one more architecture is needed to properly describe the behavior of the circuit. So generally more than one architectures are used.

10. Which of the following doesn’t corresponds to NAND gate?
a)

y <= NOT( a AND b)

b)

y <= NOT a OR NOT b

c)

y <= NOT a AND NOT b

d)

   WITH ab SELECT
    y <= 0 WHEN111 WHEN OTHERS
View Answer
Answer: c
Explanation: Option a corresponds to NAND gate and option d is also the truth table of NAND gate. Now in option b, the gate described is bubbled OR gate which is equivalent to NAND gate. Option c corresponds to bubbled AND which is equivalent to NOR gate.
 
 

Sanfoundry Global Education & Learning Series – VHDL.

To practice basic questions and answers on all areas of VHDL, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.