So, I'm working on a simple register that takes a synchronized input and, as soon as input is asserted, holds that state until reset is enabled.
My code should be pretty self explanatory. Is this checking-of-reg-output going to cause any problems?
module walk_reg(
input Walk_Sync, //pedestrian set walk-request
input WR_Reset, //FSM reset, for during the walk service
input clk, //clock
output reg WR //output
);
always @(posedge (clk))
begin
if(WR_Reset) //if reset enables, output goes to 0
WR <= 1'b0;
else if (WR) //if WR is already on, keep it on
WR <= WR;
else
WR <= Walk_Sync; //if reset is not enabled and WR isn't already one, assign output to Walk_Sync
end
endmodule // walk_reg
EDIT Changed name of variable, forgot to change it in code