I have the following problem:
I have a simple entity driven by a single process:
LIBRARY IEEE;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.ALL;
USE ieee.std_logic_arith.ALL;
entity somma_CDC is
Port
(
A : in std_logic;
B : in std_logic;
Reset : in std_logic;
Internal_Carry_enable : in std_logic;
S : out std_logic
);
end somma_CDC;
architecture Behavioral_somma_CDC of somma_CDC is
signal Internal_Carry: std_logic;
begin
somma_CDC:process (Reset,A,B)
begin
if Reset = '1'
then
Internal_Carry <= '0';
else
S <= A XOR B XOR Internal_Carry ;
if (Internal_Carry_enable = '1')
then
Internal_Carry <= (A AND B) OR (Internal_Carry AND A) OR (Internal_Carry AND B) ;
end if;
end if;
end process;
end architecture;
In practice, it is very similar to a full adder. Ideally, the block diagram should look like this:
My problem arises when in the cycles following the first, I find the values of the operands equal. In this case, the process does not activate and therefore fails to calculate the case in which A = 1, B = 1, Carry_In = 1. There is a clock signal in my system, but the clock goes faster than the input data change. If I put the clock in the sensitivity list I get wrong results, as the carry "propagates" in the wrong way. I tried without using the sensitivity list and putting a wait for "X" time, with "X" the minimum time for changing operands A and B. It works, but it depends on something that can always change in a project. Is there another way to activate this process?