A
anupam
Guest
Hi alls,
I am facing problem with the following process.
state machine from state "0001" goes to state "0011" instead of "0010"
when the wr signal is low.
Can u suggest something ?
Regards,
Anupam
PROCESS (rst, extclk) --PROCESS no 01
BEGIN
IF rst = '0' THEN
temp_w <= "0000";
wrpointer_tx <= (OTHERS => (OTHERS => '0'));
wren_txram <= '0';
wraddress_txram <= (OTHERS => '0');
ELSIF rising_edge(extclk) THEN
case temp_w is
when "0000" =>
wren_txram <= '0';
IF cs = '0' AND offset < "100000" THEN
temp_w <= "0001";
else temp_w <= "0000";
end if;
when "0001" =>
wren_txram <= '0';
wraddress_txram <= ch_no & wrpointer_tx(conv_integer(ch_no));
data2txram <= datain;
if wr = '0' then
temp_w <= "0010";
elsif rd = '0' then
temp_w <= "0000";
else temp_w <= "0001";
end if;
when "0010" =>
temp_w <= "0100";
wren_txram <= '1';
wrpointer_tx(conv_integer(ch_no)) <=
wrpointer_tx(conv_integer(ch_no)) + 1;
when "0100" =>
wren_txram <= '1';
IF cs = '1' OR wr = '1' THEN
temp_w <= "0000";
ELSE
temp_w <= "0100";
END IF;
when others => null;
end case;
IF cs = '0' AND wr = '0' AND offset = OFFSET_XRES AND
datain(bit_XRES) = '1' THEN
wrpointer_tx(conv_integer(ch_no)) <= (OTHERS => '0');
END IF;
END IF;
END PROCESS;
I am facing problem with the following process.
state machine from state "0001" goes to state "0011" instead of "0010"
when the wr signal is low.
Can u suggest something ?
Regards,
Anupam
PROCESS (rst, extclk) --PROCESS no 01
BEGIN
IF rst = '0' THEN
temp_w <= "0000";
wrpointer_tx <= (OTHERS => (OTHERS => '0'));
wren_txram <= '0';
wraddress_txram <= (OTHERS => '0');
ELSIF rising_edge(extclk) THEN
case temp_w is
when "0000" =>
wren_txram <= '0';
IF cs = '0' AND offset < "100000" THEN
temp_w <= "0001";
else temp_w <= "0000";
end if;
when "0001" =>
wren_txram <= '0';
wraddress_txram <= ch_no & wrpointer_tx(conv_integer(ch_no));
data2txram <= datain;
if wr = '0' then
temp_w <= "0010";
elsif rd = '0' then
temp_w <= "0000";
else temp_w <= "0001";
end if;
when "0010" =>
temp_w <= "0100";
wren_txram <= '1';
wrpointer_tx(conv_integer(ch_no)) <=
wrpointer_tx(conv_integer(ch_no)) + 1;
when "0100" =>
wren_txram <= '1';
IF cs = '1' OR wr = '1' THEN
temp_w <= "0000";
ELSE
temp_w <= "0100";
END IF;
when others => null;
end case;
IF cs = '0' AND wr = '0' AND offset = OFFSET_XRES AND
datain(bit_XRES) = '1' THEN
wrpointer_tx(conv_integer(ch_no)) <= (OTHERS => '0');
END IF;
END IF;
END PROCESS;