J
john
Guest
Hello,
I have basic questions regarding sequential machines
Q.1: Is the following way is the right way to define sequential
machine?
signal State : unsigned(7 downto 0);
signal nextstate : unsigned(7 downto 0);
constant E0 : unsigned(7 downto 0):="00000000";
constant E1 : unsigned(7 downto 0):="00000001";
constant E2 : unsigned(7 downto 0):="00000010";
constant E3 : unsigned(7 downto 0):="00000011";
Process (State,nextstate)
Begin
Case State is
When E0=>
..............
nextstate<=E1;
When E1=>
...............
nextstate<=E2;
When E2 =>
...............
nextstate<=E3;
When E3=>
................
nextstate<=E0;
When others =>
nextstate <= E0;
End case;
End Process;
Process (DPR_CLK,State,nextstate)
Begin
If (CLK'event And CLK='1') Then
State <= nextstate;
End If;
End Process;
End DPR_ARCH;
------------------------------------------------------------------------------
Q.2: some times the sequential mahine loose its direction. like state
E0 to E2,
What would be the solution?
Q.3: And whats the difference between
When others =>
nextstate <= E0;
AND
When others =>
nextstate <= NULL;
When we power up the CPLD, then by default the cpld goes to the state
E0, if
we use
When others =>
nextstate <= E0;
or the state machine will never run if we use
When others =>
nextstate <= NULL;
Please adivce me that I am right or wrong?
------------------------------------------------------------------------------
Q.3 Is sequential machine is the only best way to generate the cycles
for reading and
writing the Memory or is there an another way to do it?
I have basic questions regarding sequential machines
Q.1: Is the following way is the right way to define sequential
machine?
signal State : unsigned(7 downto 0);
signal nextstate : unsigned(7 downto 0);
constant E0 : unsigned(7 downto 0):="00000000";
constant E1 : unsigned(7 downto 0):="00000001";
constant E2 : unsigned(7 downto 0):="00000010";
constant E3 : unsigned(7 downto 0):="00000011";
Process (State,nextstate)
Begin
Case State is
When E0=>
..............
nextstate<=E1;
When E1=>
...............
nextstate<=E2;
When E2 =>
...............
nextstate<=E3;
When E3=>
................
nextstate<=E0;
When others =>
nextstate <= E0;
End case;
End Process;
Process (DPR_CLK,State,nextstate)
Begin
If (CLK'event And CLK='1') Then
State <= nextstate;
End If;
End Process;
End DPR_ARCH;
------------------------------------------------------------------------------
Q.2: some times the sequential mahine loose its direction. like state
E0 to E2,
What would be the solution?
Q.3: And whats the difference between
When others =>
nextstate <= E0;
AND
When others =>
nextstate <= NULL;
When we power up the CPLD, then by default the cpld goes to the state
E0, if
we use
When others =>
nextstate <= E0;
or the state machine will never run if we use
When others =>
nextstate <= NULL;
Please adivce me that I am right or wrong?
------------------------------------------------------------------------------
Q.3 Is sequential machine is the only best way to generate the cycles
for reading and
writing the Memory or is there an another way to do it?