D
DG
Hi,
First I apalogize because my question is probably stupid but I am trying to
learn VHDL by writing very basic programs but I have a problem with the
follwing one
I want to simulate the following peace of code (I have no problem with that
code) :
------------------------
Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.numeric_std.all;
Use ieee.std_logic_unsigned.all;
entity CMP4BITS is
PORT (
CLOCK : in std_logic;
Q : inout std_logic_vector(3 downto 0));
end CMP4BITS;
architecture DESCRIPTION of CMP4BITS is
begin
process (CLOCK)
begin
if (CLOCK ='1' and CLOCK'event) then
Q <= Q + 1;
end if;
end process;
end DESCRIPTION;
------------------------
My problem is with the program in charge to launch the simulation of the
code above; which is:
------------------------
Library ieee;
Use ieee.std_logic_1164.all;
ENTITY test_cmpt IS
END test_cmpt;
ARCHITECTURE behavior OF test_cmpt IS
COMPONENT cmp4bits
PORT (CLOCK : in std_logic;
Q : inout std_logic_vector(3 downto 0));
END COMPONENT;
SIGNAL CLOCK : std_logic;
SIGNAL Q : std_logic_vector(3 downto 0);
BEGIN
DUT: cmp4bits PORT MAP (CLOCK, Q);
stimulus: PROCESS
BEGIN
CLOCK <= '0';
wait for 100 ns;
CLOCK <= '1';
wait for 100 ns;
END PROCESS;
END behavior;
------------------------
Actually the problem is when I launch the simulation all the values of Q are
X (which means undetermined) and after having executed "Q <= Q + 1", Q is
always undetermined and so son. I guess one solution would be to initialize
Q before the execution of "cmp4bits", but I don't know how... Obviously I
tried to put an "Q <= "0000" before "CLOCK <= '0'" but it had no effects.
If someone had an idea, do not hesitate to suggest .
Regards
First I apalogize because my question is probably stupid but I am trying to
learn VHDL by writing very basic programs but I have a problem with the
follwing one
I want to simulate the following peace of code (I have no problem with that
code) :
------------------------
Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.numeric_std.all;
Use ieee.std_logic_unsigned.all;
entity CMP4BITS is
PORT (
CLOCK : in std_logic;
Q : inout std_logic_vector(3 downto 0));
end CMP4BITS;
architecture DESCRIPTION of CMP4BITS is
begin
process (CLOCK)
begin
if (CLOCK ='1' and CLOCK'event) then
Q <= Q + 1;
end if;
end process;
end DESCRIPTION;
------------------------
My problem is with the program in charge to launch the simulation of the
code above; which is:
------------------------
Library ieee;
Use ieee.std_logic_1164.all;
ENTITY test_cmpt IS
END test_cmpt;
ARCHITECTURE behavior OF test_cmpt IS
COMPONENT cmp4bits
PORT (CLOCK : in std_logic;
Q : inout std_logic_vector(3 downto 0));
END COMPONENT;
SIGNAL CLOCK : std_logic;
SIGNAL Q : std_logic_vector(3 downto 0);
BEGIN
DUT: cmp4bits PORT MAP (CLOCK, Q);
stimulus: PROCESS
BEGIN
CLOCK <= '0';
wait for 100 ns;
CLOCK <= '1';
wait for 100 ns;
END PROCESS;
END behavior;
------------------------
Actually the problem is when I launch the simulation all the values of Q are
X (which means undetermined) and after having executed "Q <= Q + 1", Q is
always undetermined and so son. I guess one solution would be to initialize
Q before the execution of "cmp4bits", but I don't know how... Obviously I
tried to put an "Q <= "0000" before "CLOCK <= '0'" but it had no effects.
If someone had an idea, do not hesitate to suggest .
Regards