one hot state machine using for/generate

Joined
Feb 20, 2009
Messages
1
Reaction score
0
I'm trying to create the states for a state machine using for/generate and there is an issue that I hope somebody could help with.

Below is a code snippet used to generate one-hot states:
type state_reg_type is array (NSTATE-1 downto 0) of std_logic_vector (NSTATE-1 downto 0);
signal bist_ctrl_state : state_reg_type;
begin
gen_state_values :
for i in 0 to NSTATE-1 generate
bist_ctrl_state(i) <= to_stdlogicvector(shift_in sll i);
end generate;

However when time comes to code the next state control if/elsif/else has to be used. When a case is tried the following error is produced:
** Error: ./ctrl.vhd(88): Case choice must be a locally static expression

I take it this means that bist_ctrl_state has to be declared as a constant.

Is there a way to declare the state values using a generate that would allow next state control to be performed using a case?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top