W
Weng Tianxiang
Guest
One of my project contains a state machine that has no conditions with
nRESET.
The code is as follows:
SDRAMStateA : process(CLK66M)
begin
if(CLK66M'event and CLK66M = '1') then
SDRAMState <= SDRAMNextState;
end if;
end process;
SDRAMNextState is defined in another process without clock.
The state machine has 42 states.
The project design is compiled by Exemplar vhdl compiler and its
generated *.edf file is compiled by Quartus 2.1. Then the final file
is loaded into Altera APEX 20K160 chip.
The project works well, especially after power-up: it starts with the
first state.
The coding is one hot coding.
Now the project grows and we shifted the project from Altera
APEX20K160 to 20K200 with almost the same state machine without reset
condition as above.
The new project is compiled by Exemplar and by Quartus 2.1, it fails
after power-up. The data shows after power-up, the state machine
enters no valid state.
After some experiements, we get the state machine work:
SDRAMStateA : process(CLK66M)
begin
if(CLK66M'event and CLK66M = '1') then
-- enumerate all states
if(StateSDRAM(5 downto 0) = "111111") then
SDRAMState <= Reset_S;
else
SDRAMState <= SDRAMNextState;
end if;
end if;
end process;
StateSDRAM(5 downto 0) is defined as "111111" if it is not one of 42
states.
Now I want to ask such a question:
In my opinion, in one hot coding, VHDL compiler "will and should" pick
up a state as its initial state and implement it after power-up, no
matter there is or isn't reset condition.
Am I wrong or right?
Weng
nRESET.
The code is as follows:
SDRAMStateA : process(CLK66M)
begin
if(CLK66M'event and CLK66M = '1') then
SDRAMState <= SDRAMNextState;
end if;
end process;
SDRAMNextState is defined in another process without clock.
The state machine has 42 states.
The project design is compiled by Exemplar vhdl compiler and its
generated *.edf file is compiled by Quartus 2.1. Then the final file
is loaded into Altera APEX 20K160 chip.
The project works well, especially after power-up: it starts with the
first state.
The coding is one hot coding.
Now the project grows and we shifted the project from Altera
APEX20K160 to 20K200 with almost the same state machine without reset
condition as above.
The new project is compiled by Exemplar and by Quartus 2.1, it fails
after power-up. The data shows after power-up, the state machine
enters no valid state.
After some experiements, we get the state machine work:
SDRAMStateA : process(CLK66M)
begin
if(CLK66M'event and CLK66M = '1') then
-- enumerate all states
if(StateSDRAM(5 downto 0) = "111111") then
SDRAMState <= Reset_S;
else
SDRAMState <= SDRAMNextState;
end if;
end if;
end process;
StateSDRAM(5 downto 0) is defined as "111111" if it is not one of 42
states.
Now I want to ask such a question:
In my opinion, in one hot coding, VHDL compiler "will and should" pick
up a state as its initial state and implement it after power-up, no
matter there is or isn't reset condition.
Am I wrong or right?
Weng