The structural code for 4-bit adder is given below. [code] COMPONENT adder IS GENERIC (n : INTEGER := 3); PORT(input : IN BIT_VECTOR(n

The structural code for 4-bit adder is given below.
Code:
COMPONENT adder IS
GENERIC (n : INTEGER := 3);
PORT(input : IN BIT_VECTOR(n DOWNTO 0);
output : OUT BIT_VECTOR(n DOWNTO 0));
END COMPONENT;
If user want to convert this in an 8 bit adder, which of the following variable should be changed?
A. n
B. input
C. output
D. component
 
Answer: a
Explanation: The only way to change it is by changing the value of n. If n is changed from 3 to 7, then it will have 8 input bits and 8 output bits. In this way, by using generic, the whole structure can be altered easily. Also, it may be noted if the value of the generic is not specified, then it will take the value used at the time of entity declaration.
 

Tìm kiếm

Back
Top