I am new to VHDL. I have this entity (shortened):
entity foo is
port (CLK : in std_logic;
out_A : out std_logic;
);
end foo;
architecture Structure of foo is
component D_Flipflop
port (
D : in std_logic;
CLK : in std_logic;
Q : out std_logic;
not_Q : out std_logic);
end component;
signal D_A, qA, not_qA : std_logic;
begin
my_Flipflop : D_Flipflop
port map(
not_qA,
CLK,
qA,
not_qA
);
end Structure;
As you can see, I want to use the D_Flipflop
like a Toggle-Flipflop, so I redirected the output to the input by the signal not_qA
(is that possible?). The problem is that from outside, only the port CLK
of foo
is visible as input and - at least in the Vivado Simulator - the signals qA
and not_qA
are never evaluated.
This is the architecture of D_Flipflop
:
architecture Behavioral of D_Flipflop is
begin
set_state : process(CLK, D)
variable state : std_logic := '0';
begin
if falling_edge(CLK) then
state := D;
Q <= state;
not_Q <= not state;
end if;
end process set_state;
end Behavioral;
I googled a lot for this. No chance. Any solutions?
It's not as you indicate in the title to the question that the internal signal to component
my_Flipflop
didn't trigger, it's that there is no method to provide a known non-meta value state - the not of 'U' is 'U'.This is caused by the
not
operator. Refer to the not_table in the body of package std_logic_1164:See the changes and the added testbench:
The
not_Q
output of the D_Flipflop has been initialized to '0' (it could have as easily been initialized to '1'). This represents the equivalent of a collector set for the Flip Flop on power up.Now the Flip Flop can toggle - it has a known non-meta value on the
D
input.This gives:
(clickable)