When to read a configuration register?

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
 
Uwe Stange a écrit :
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:
...

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?
Your solution looks OK to me. What you need is a way to update your
local configuration register. If your reset is synchronized somewhere
you can just use it as an enable:

always @ (posedge Clk) if (!notReset) ConfigReg_local = ConfigReg;

If your reset is not synchronized you'll have troubles so synchronize it.

Regards,
--
Renaud Pacalet, GET/ENST/COMELEC/LabSoC
Institut Eurecom BP 193, 2229 route des Cretes
F-06904 Sophia-Antipolis Cedex
Tel : +33 (0) 4 9300 2770
Fax : +33 (0) 4 9300 2627
Fight Spam! Join EuroCAUCE: http://www.euro.cauce.org/
 

Welcome to EDABoard.com

Sponsor

Back
Top