3
3Finker
Guest
Hi All,
I am currently writing a state machine, using the '3 always block'
method, with separate sequential blocks for the state and nextState
registers. I have the following type of constructs.
always_ff@(posedge clk or negedge resetb) begin:sm
if(!resetb) begin
sigA <= sigB;
sigC <= sigC;
end
else begin:notReset
if(!sigA)
sigA <= 5'd'0;
if(sigB == 5'd2)
sigB <= 5'd'0;
case(next)
state0: sigA <= 5'd22;
state1: sigB <= 5'd23;
endcase
end:notReset
end:sm
I am concerned that this style is bad coding practice and may come to
haunt me post tape-out - I hope it is clear what i am attempting to do
- on every edge of clk i want sigA and sigB checked and assigned
different values, but these values may be assigned again, on the same
clk edge as a result of the case statement.
All comments welcome and thanks for reading.
Rgds,
sean
I am currently writing a state machine, using the '3 always block'
method, with separate sequential blocks for the state and nextState
registers. I have the following type of constructs.
always_ff@(posedge clk or negedge resetb) begin:sm
if(!resetb) begin
sigA <= sigB;
sigC <= sigC;
end
else begin:notReset
if(!sigA)
sigA <= 5'd'0;
if(sigB == 5'd2)
sigB <= 5'd'0;
case(next)
state0: sigA <= 5'd22;
state1: sigB <= 5'd23;
endcase
end:notReset
end:sm
I am concerned that this style is bad coding practice and may come to
haunt me post tape-out - I hope it is clear what i am attempting to do
- on every edge of clk i want sigA and sigB checked and assigned
different values, but these values may be assigned again, on the same
clk edge as a result of the case statement.
All comments welcome and thanks for reading.
Rgds,
sean