U
u_stadler@yahoo.de
Guest
hi i have a problem with the following code i can't solve:
entity SBOX is
Port ( CLK : in std_logic;
RESET : in std_logic;
Input : in std_logic_vector(7 downto 0);
Output : out std_logic_vector(7 downto 0);
Ready : out std_logic;
Substitute : in std_logic;
Invers : in std_logic );
end SBOX;
architecture Behavioral of SBOX is
signal s_Next_Ready : std_logic;
begin
SYNC: process( CLK, RESET)
begin
if RESET = '0' then
s_Next_Ready <= '0';
Ready <= '0';
Output <= "00000000";
elsif CLK'event and CLK = '1' then
Ready <= s_Next_Ready;
end if;
end process SYNC;
SBOX: process(Input, Invers, Substitute)
begin
if Invers = '0' and Substitute = '1' then
s_Next_Ready <= '1';
elsif Substitute = '0' then
s_Next_Ready <= '0';
end if;
end process;
end Behavioral;
my testbench look like:
PROCESS -- clock process for CLK,
BEGIN
CLOCK_LOOP : LOOP
CLK <= transport '0';
WAIT FOR 50 ns;
CLK <= transport '1';
WAIT FOR 50 ns;
END LOOP CLOCK_LOOP;
END PROCESS;
tb : PROCESS
BEGIN
RESET <= '0';
wait for 1 us;
RESET <= '1';
wait for 100 ns;
Input <= X"02";
Invers <= '0';
Substitute <= '1';
wait;
END PROCESS;
my problem is the Ready signal. as long as Reset is '0' Ready is '0'
aswell.
if Reset goes to '1' Ready is still '0'. So far so good.
But if "Substitute" chanes to '1' Ready becomes undefines the next
positive clock egde.
any ideas?
i'm using the ise web pack.
thanks
Urban
entity SBOX is
Port ( CLK : in std_logic;
RESET : in std_logic;
Input : in std_logic_vector(7 downto 0);
Output : out std_logic_vector(7 downto 0);
Ready : out std_logic;
Substitute : in std_logic;
Invers : in std_logic );
end SBOX;
architecture Behavioral of SBOX is
signal s_Next_Ready : std_logic;
begin
SYNC: process( CLK, RESET)
begin
if RESET = '0' then
s_Next_Ready <= '0';
Ready <= '0';
Output <= "00000000";
elsif CLK'event and CLK = '1' then
Ready <= s_Next_Ready;
end if;
end process SYNC;
SBOX: process(Input, Invers, Substitute)
begin
if Invers = '0' and Substitute = '1' then
s_Next_Ready <= '1';
elsif Substitute = '0' then
s_Next_Ready <= '0';
end if;
end process;
end Behavioral;
my testbench look like:
PROCESS -- clock process for CLK,
BEGIN
CLOCK_LOOP : LOOP
CLK <= transport '0';
WAIT FOR 50 ns;
CLK <= transport '1';
WAIT FOR 50 ns;
END LOOP CLOCK_LOOP;
END PROCESS;
tb : PROCESS
BEGIN
RESET <= '0';
wait for 1 us;
RESET <= '1';
wait for 100 ns;
Input <= X"02";
Invers <= '0';
Substitute <= '1';
wait;
END PROCESS;
my problem is the Ready signal. as long as Reset is '0' Ready is '0'
aswell.
if Reset goes to '1' Ready is still '0'. So far so good.
But if "Substitute" chanes to '1' Ready becomes undefines the next
positive clock egde.
any ideas?
i'm using the ise web pack.
thanks
Urban