Ma'am I was analysing the VHDL programs you had sent us.
In the main declaration of the entity "regn" we have made N as 4.
Later in the "testbench" initially for entity "tbregn" we make N as 7 and when regn component is added to the testbench we declare N as 4.
I agree that both these N work differently.
However since here we have only one component in the testbench, shouldn't N for both be same(as the main purpose of N here is to define the size of input and output "std_logic_vector".
If there were more than one component we could have said that some signals of the testbench were connected to one component and some to the other, so the difference in the value of N for testbench entity and regn entity. But why are they different here?
Plus there is the statement "generic portmap(7)". Does this statement change the generic N of the component inside the testbench to 7 meaning changing the value of N from 4 to 7 for regn?
Also since the input is given in hexadecimal (X"00") when we are writing the stimulus process. My doubt continues on the fact that since inpt lines are 5(4 downto 0) how can give input as 8 lines?-----TEST BENCH------- LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY regntb IS generic (N:natural:=7); END regntb; ARCHITECTURE behavior OF regntb IS -- Component Declaration for the Unit Under Test (UUT) COMPONENT regn generic (N: natural:=4); PORT( regin : IN std_logic_vector(N downto 0); regout : inOUT std_logic_vector(N downto 0); reset : IN bit; incr : IN bit; clk : IN bit; load: in bit ); END COMPONENT; --Inputs signal regin : std_logic_vector(N downto 0) := (others => '0'); signal reset : bit := '0'; signal incr : bit := '0'; signal clk : bit := '0'; signal load: bit := '0'; --Outputs signal regout : std_logic_vector(N downto 0); -----clock time period constant clk_period : time := 10 ns; BEGIN -- Instantiate DUT dut: regn generic map (7) PORT MAP ( regin => regin, regout => regout, reset => reset, incr => incr, clk => clk, load =>load );--
Regards
Tarun Gehlaut
Third Year Undergratuate
Department Of Computer Engineering,
Netaji Subhas Institute of Technology
Dwarka, New Delhi
Ph: +91-9868733361
Thank you ma'am
It did solve my doubt.