I am really confused, because it is a simple code and I dont find the error. Syntax is fine, but in Simulation the Values of Dready and acc_value dont change.
This is my module MVM.vhd:
entity MVM is
port (
CLK: IN std_logic;
RST: IN std_logic;
DREADY: OUT std_logic
);
end entity MVM;
architecture base of MVM is
begin
process(CLK)
variable acc_value : signed(15 downto 0);
begin
IF rising_edge(CLK) then
IF RST='1' THEN
acc_value := (OTHERS => '0'); -- reset
DREADY <= '0';
END IF;
END IF;
END process;
end base;
If Reset is high, it should set the values of Dready and acc_value to "0"
My Testbench:
entity tb_MVM is
-- Port ( );
end tb_MVM;
architecture TEST of tb_MVM is
Component MVM
port (
CLK: IN std_logic;
RST: IN std_logic;
DREADY: OUT std_logic
);
End component;
signal CLK: std_logic;
signal RST: std_logic;
signal DREADY: std_logic;
BEGIN
uut: MVM Port Map(
CLK=>CLK,
RST=>RST,
DREADY => DREADY
);
tb: process
BEGIN
wait for 100ns;
CLK <= '1';
RST <= '1';
wait for 100ns;
CLK <= '0';
wait for 100ns;
CLK <= '1';
RST <= '0';
END PROCESS;
end TEST;
In the Simulation, the DREADY and acc_value are undefined ('X')
Assuming you mean the output before 300ns...
In simplified words: rising_edge()
checks a transition from '0'
to '1'
, and is not true for transitions from 'X'
to '1'
.
You might also want to make sure that RST
is stable when CLK
actually rises, for example:
tb: process
BEGIN
CLK <= '0';
RST <= '1';
wait for 100ns;
CLK <= '1';
wait for 100ns;
CLK <= '0';
RST <= '0';
END PROCESS;
This brings DREADY
and acc_value
to zero after 100ns.