VHDL Questions and Answers – Value Kind Attributes

«
»

This set of VHDL Multiple Choice Questions & Answers (MCQs) focuses on “Value Kind Attributes”.

1. What does a value kind attribute return?
a) A single value
b) A signal
c) A function
d) A type
View Answer

Answer: a
Explanation: Value kind attributes to return a single value. This value can give information about anything like an array, a block or a type. This can be used to return the length of an array or some related information.
advertisement

2. Value attributes are classified into _______ subclasses.
a) 1
b) 2
c) 3
d) 4
View Answer

Answer: c
Explanation: Value kind attributes are further broken down into three subclasses. This classification is done on the basis of the information they provide. For example, if an attribute is providing the information about an array then it is called Value array attribute.

3. Which of the following is not a category of Value kind attribute?
a) Value type attributes
b) Value array attributes
c) Value block attributes
d) Value function attributes
View Answer

Answer: d
Explanation: The Value kind attributes are divided into three categories which are Value type attributes (which returns the value of a type), Value array attributes (information about array) and Value Block attributes (information about block).
advertisement
advertisement

4. If T is an object, then T’LEFT attribute returns ________
a) Upper bound of object
b) Leftmost value of object
c) Leftmost value of an array
d) Lower bound of the object
View Answer

Answer: b
Explanation: T’LEFT is an attribute which returns the left bound or the leftmost value of the object T. This object can be any predefined type, array or any block as well. Similarly, T’RIGHT returns the rightmost value of array.

5. What does the attribute T’HIGH returns?
a) Upper bound of the object
b) Lower bound of the object
c) Highest value of the object
d) Rightmost value of the object
View Answer

Answer: a
Explanation: T’HIGH is another value kind attribute which gives information about the type, array or block. It returns the upper bound of the type or array. In a similar manner T’LOW will returns the lower bound of the object T.
advertisement

6. What will be the value of x and y?

TYPE my_type IS ARRAY (15 DOWNTO 0) OF BIT;VARIABLE x, y : INTEGER;
x := my_type’LEFT;
y := my_type’HIGH;

a) 0, 0
b) 0, 15
c) 15, 0
d)15, 15
View Answer

Answer: d
Explanation: Since the attribute used is for the type, so it is value type attribute. ‘LEFT will give the left bound of the type or the leftmost value which is 15. Here my_type is described as a data type which has bound 0 to 15. So, HIGH will return the upper bound which is 15. So, x and y both will be 15 in this case.
advertisement

7. What will be the value of x and y in the code given below?

advertisement
TYPE bit_range IS ARRAY (0 TO 15) OF BIT;
VARIABLE x, y : INTEGER;
x := bit_range’RIGHT;
y := bit_range’LOW;

a) 0, 0
b) 0, 15
c) 15, 0
d) 15, 15
View Answer

Answer: c
Explanation: T’RIGHT returns the rightmost value of any type. So, x will be 15. Similarly, T’LOW retruns the lower bound of the same. Here the bounds of the array are 0 and 15 as lower and upper bound. So, the resulting value of y will be 0.

8. What will be the type of value returned by the attribute T’LENGTH?
a) BIT
b) INTEGER
c) STD_LOGIC
d) BOOLEAN
View Answer

Answer: b
Explanation: T’LENGTH is a Value Array attribute which returns the length of array. For example, if an array has 32 elements, then it will return 32. So, T’LENGTH returns a value of integer type.

9. What will be the value of my_array’LENGTH, if my_array is defined as below code?

TYPE my_array IS ARRAY (15 DOWNTO 0) OF STD_LOGIC;

a) 15
b) 16
c) 0
d) 32
View Answer

Answer: b
Explanation: Since, T’LENGTH returns the length of object T. So, my_array’LENGTH will return the length of my_array. Here, my_array has 16 elements from 0 to 15, so the value returned by ‘LENGTH attribute will be 16.

10. The formula for T’LENGTH is best described by which of the following?
a) T’HIGH – T’LOW + 1
b) T’HIGH – T’LOW
c) T’HIGH + T’LOW – 1
d) T’HIGH + T’LOW
View Answer

Answer: a
Explanation: T’HIGH will return the upper bound of the array and T’LOW will return the lower bound of the array. Also, the number of elements in an array is given by upper bound – lower bound + 1. Therefore, option a describes the formula best.

11. Which of the following is the return type of value T’ASCENDING?
a) Bit
b) Integer
c) Boolean
d) Same as T
View Answer

Answer: c
Explanation: Ascending is a value kind attribute which can take two values either TRUE or FALSE. Regardless of type of the object T, the value returned by attribute ‘ASCENDING is always of Boolean type.

12. For which of the following declarations, the value returned by ‘ASCENDING attribute will be true?

TYPE array_1 IS ARRAY (0 TO 31) OF BIT;
TYPE array_2 IS ARRAY (15 DOWNTO 0) OF BOOLEAN;

a) For array_1 only
b) For array_2 only
c) For both array_1 and array_2
d) Neither for array_1 nor for array_2
View Answer

Answer: a
Explanation: The T’ASCENDING will return true only if the array T is defined as in an ascending order. For example, areay_1 is defined from 0 to 31 whereas array_2 is defined from 15 to 0. Therefore, in case of array_1, the value will be true.

13. Which of the following attribute is available for all types?
a) ‘LEFT
b) ‘ASCENDING
c) ‘BASE
d) ‘HIGH
View Answer

Answer: c
Explanation: ‘BASE is an attribute available for all the types, May it be a predefined data type or user defined data type. It returns the base type of the object. The type of object must have some base type which is returned by attribute.

14. What kind of information is provided by the value block attributes?
a) About the block name
b) About the modeling of block
c) About the architecture name
d) About the inputs used in block
View Answer

Answer: b
Explanation: Value block attributes returns information about how a block in a design is modeled. For example, whether the structural modeling is used or behavioral modeling is used within a block or architecture.

15. Which of the following returns TRUE if there is no component instantiation statement in the block?
a) ‘STRUCTURE
b) ‘BLOCK_COMPONENT
c) ‘BLOCK_BEHAVIOUR
d) ‘BEHAVIOR
View Answer

Answer: d
Explanation: ‘STRUCTURE and ‘BEHAVIOR are two predefined attributes that are under the category Value block. Both of them return true value. ‘BEHAVIOR will return true if there is no component declaration and instantiation inside the block to which it is attached. However, ‘STRUCTURE performs exactly opposite.

Sanfoundry Global Education & Learning Series – VHDL.

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

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!

advertisement
advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
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 | Youtube | Instagram | Facebook | Twitter