U
Uwe Stange
Guest
Hi!
Imagine a FSM with some state transitions depending on the content
of a configuration register.
My first approach is to evaluate the next state depending on the
configuration register. OK.
But what if the config register must not be transparent - in other
words: a reprogramming of the configuration register should only be
visible (take effect) after a reset?
One possibility is:
always @ (posedge Clk or negedge notReset) begin
if (!notReset) begin
// Reset some registers.
ConfigReg_local = ConfigReg; // Update only while in reset.
FSMState = `IDLE; // Next State: IDLE
end else begin
case(FSMState)
`IDLE: begin
// Do something.
if (//SomeCondition)
FSMState = `SOMESTATE1;
else
FSMState = `IDLE;
end
`SOMESTATE1: begin
// Do something.
if (ConfigReg_local[`BITSELECT] = `TRUE)
FSMState = `SOMESTATE2;
else
FSMState = `IDLE;
end
`SOMESTATE2: begin
// Do something.
FSMState = `IDLE;
end
default: FSMState = `IDLE;
endcase
end
end
then the evaluation of the next state in `SOMESTATE1 would depend on
the content of register ConfigReg_local which only updates while the
state machine is in reset. Any pros and cons?
How would you implement such a "non-transparent" configuration register?
Thanks in advance
Uwe
Imagine a FSM with some state transitions depending on the content
of a configuration register.
My first approach is to evaluate the next state depending on the
configuration register. OK.
But what if the config register must not be transparent - in other
words: a reprogramming of the configuration register should only be
visible (take effect) after a reset?
One possibility is:
always @ (posedge Clk or negedge notReset) begin
if (!notReset) begin
// Reset some registers.
ConfigReg_local = ConfigReg; // Update only while in reset.
FSMState = `IDLE; // Next State: IDLE
end else begin
case(FSMState)
`IDLE: begin
// Do something.
if (//SomeCondition)
FSMState = `SOMESTATE1;
else
FSMState = `IDLE;
end
`SOMESTATE1: begin
// Do something.
if (ConfigReg_local[`BITSELECT] = `TRUE)
FSMState = `SOMESTATE2;
else
FSMState = `IDLE;
end
`SOMESTATE2: begin
// Do something.
FSMState = `IDLE;
end
default: FSMState = `IDLE;
endcase
end
end
then the evaluation of the next state in `SOMESTATE1 would depend on
the content of register ConfigReg_local which only updates while the
state machine is in reset. Any pros and cons?
How would you implement such a "non-transparent" configuration register?
Thanks in advance
Uwe