VHDL Questions and Answers – Structural Modeling – 2

This set of VHDL Questions and Answers for Experienced people focuses on “Structural Modeling – 2”.

1. In which part of the VHDL code, components must be declared?
a) Library
b) Entity
c) Architecture
d) Configuration
View Answer

Answer: c
Explanation: The component can be declared only after entity declaration or in the package itself. So, components can be declared either in architecture or in package. If the component is declared in package, then just include the package and don’t declare it again in architecture body.

2. Which of the following function is used to map the component?
a) COMPONENT INSTANTIATE
b) PORT MAP
c) GENERIC MAP
d) USE
View Answer

Answer: b
Explanation: To map a component in the circuit, first it needs to be declared. Once it is declared, one can use the PORT MAP function to map the port on the design. This function can have as many arguments as the number of ports in the component.

3. How many ways are there in VHDL to map the components?
a) 1
b) 2
c) 3
d) 4
View Answer

Answer: b
Explanation: There are two ways by which one can map the components in VHDL design excluding the mapping of generic units. One method is positional mapping and another mapping is nominal mapping. Positional mapping is generally used mapping.
advertisement
advertisement

4. What is the property of Positional mapping?
a) Easier to write
b) Less error prone
c) Ports can be left unconnected
d) Difficult to write
View Answer

Answer: a
Explanation: Positional mapping is a type of component mapping that is generally used in VHDL and it is easier to write. But, positional mapping has slightly more chances of occurrence of an error.

5. __________ mapping is less error prone.
a) Port
b) Positional
c) Nominal
d) Generic
View Answer

Answer: c
Explanation: Nominal mapping has less chances of error since every port is assigned the specific value which is not the case with positional mapping. So, nominal mapping can take time but it is less prone to errors.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. A component has 3 ports- two inputs(a and b) and one output(y). Which of the following statement is for the positional mapping of the component?
a) LABEL : my_component PORT MAP (l, m, n);
b) LABEL : my_component PORT MAP (y, a);
c) LABEL : my_component PORT MAP (l => a, m => b, n => y);
d) LABEL : my_component PORT MAP(a, b, y>= a);
View Answer

Answer: a
Explanation: A component can be instantiated by using positional or nominal mapping. In case of positional mapping, arguments are written, in this case, 3 arguments among which first two must be taken as input and last one is taken as output port. SO, only option a is using the positional mapping in which l and m corresponds to a and b respectively and n corresponds to y.

7. The ports of a component can be left unconnected.
a) True
b) False
View Answer

Answer: a
Explanation: In VHDL, It is possible to leave any port unconnected. If our requirement is to leave a port unconnected in the circuit, then it can be done by using a keyword ‘OPEN’. By doing so, the port will not be connected to any input or output.
advertisement

8. Which of the following is the right way to leave a port unconnected?
a) L1 : my_component PORT MAP(a); a <= OPEN;
b) L1 : my_component PORT MAP(a := OPEN);
c) L1: my_component PORT MAP(a => OPEN);
d) L1 : my_component PORT MAP(a); a := OPEN;
View Answer

Answer: c
Explanation: To leave any port unconnected the keyword used Is ‘OPEN’. This keyword can be used only in the arguments of the function PORT MAP() by using “=>” operator. Therefore, option c is the right way to use keyword OPEN.

9. It is not necessary that the order of the arguments in PORT MAP is taken as the order in which ports are declared.
a) True
b) False
View Answer

Answer: b
Explanation: The order of arguments is taken as the order of ports declared in the component declaration in case of positional mapping. For example, the following statement declares a component-

advertisement
COMPONENT my_component IS
PORT (
a, b, c : IN BIT;
x, y : OUT BIT);
END COMPONENT;
U1: my_component PORT MAP(p, q, r, s, t);

Here, in the component instantiation statement p, q, r, s and t will corresponds to a, b, c, x and y respectively because of the order used at the time of declaration is inherited in the component instantiation statement.

10. How to declare a 2 input OR gate in the structural modeling?
a)

    COMPONENT or IS
     PORT ( a, b : IN BIT;
                  x, y : OUT BIT);
    END COMPONENT;

b)

     COMPONENT or IS
     PORT ( a, b : IN BIT;
                  y : OUT BIT);
    END COMPONENT;

c)

    COMPONENT or_gate IS
     PORT ( a, b : IN BIT;
                  x,  y : OUT BIT);
    END COMPONENT;

d)

    COMPONENT or_gate IS
     PORT ( a, b : IN BIT;
                  y : OUT BIT);
    END COMPONENT;
View Answer
Answer: d
Explanation: For a 2 input OR gate, there must be 2 inputs and only one output. Therefore, some options are legal. But, the name of component can’t be same as any reserved word of VHDL. Therefore, a name of component can’t be ‘or’.
 
 

Sanfoundry Global Education & Learning Series – VHDL.

To practice all areas of VHDL for Experienced people, 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.