I'm learning the use of configuration statement. For this I've created a top level entity not_gate and an architecture structural. I've also added another vhd file to this program, and that vhd file (notgate) has a single entity and two architectures. I want to choose a specific architecture from the pair. To distinguish between the two, I've decided that the behavioural model of notgate will perform just like a buffer.
not_gate.vhd:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity not_gate is
Port ( NI : in STD_LOGIC;
NO : out STD_LOGIC);
end not_gate;
architecture structural of not_gate is
COMPONENT notgate IS
Port ( invin : in STD_LOGIC;
invout : out STD_LOGIC);
end COMPONENT;
begin
INV: notgate PORT MAP (NI,NO);
end structural;
CONFIGURATION config1 OF not_gate IS
FOR structural
FOR INV: notgate USE ENTITY WORK.notgate(notarch);
END FOR;
END FOR;
END config1;
The vhd file notgate was added to this.
notgate.vhd:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
ENTITY notgate IS
PORT (invin : IN STD_LOGIC;
invout: OUT STD_LOGIC);
END ENTITY notgate;
architecture notarch OF notgate IS
BEGIN
invout <= NOT invin;
END ARCHITECTURE notarch;
architecture notbeh OF notgate IS
BEGIN
PROCESS(invin)
BEGIN
IF invin = '0' THEN invout <= '0';
ELSIF invin = '1' THEN invout <= '1';
ELSE invout <= 'U';
END IF;
END PROCESS;
END ARCHITECTURE notbeh;
When I run not_gate.vhd, according to the configuration statement I wrote, the architecture notarch must be selected from notgate.vhd and the NOT operation should occur. However, it seems that vhdl is still selecting the last compiled architecture, that is, notbeh. Thus, the NOT operation doesn't occur. The configuration statement doesn't seem to be working. Could someone tell me where went wrong?