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 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.
advertisement

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.

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 which 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.
advertisement

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.

8. Which of the following is a 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-

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.

advertisement

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)

advertisement
    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.

advertisement
advertisement
advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn