Altera_Forum
Honored Contributor
9 years agoWhen to reset a signal.
In one process I set a command
when X"01" => --continious data read
cont_ram_addr := to_integer(unsigned(addr_bus));
ram_command <= RAM_CONT_WRITE;
when X"02" => --continious data write
cont_ram_addr := to_integer(unsigned(addr_bus));
ram_command <= RAM_CONT_READ;
when X"03" => --read data command
ram_command <= RAM_BYTE_WRITE;
when X"04" => --write data command
ram_command <= RAM_BYTE_READ;
In another process I read this command and do some actions according the command.
case RamState is
when ST_IDLE =>
if(ram_command > "000") then
case ram_command is
when RAM_CONT_WRITE => RamState <= ST_CONT_WR_RAM;
when RAM_CONT_READ => RamState <= ST_CONT_RD_RAM;
when RAM_BYTE_WRITE => RamState <= ST_WR_RAM;
when RAM_BYTE_READ => RamState <= ST_RD_RAM;
when others => RamState <= ST_IDLE;
end case;
end if;
when ST_WR_RAM => -
--do something
RamState <= ST_IDLE;
when ST_RD_RAM =>
--do something
RamState <= ST_IDLE;
when ST_CONT_WR_RAM =>
-do something
RamState <= ST_IDLE;
when ST_CONT_RD_RAM =>
-- do something
RamState <= ST_IDLE;
But where and when I should reset ram_command. If I return to ST_IDLE I once again evaluate ram_command case and create endless loop. ram_command should be reset at some point.