mii_io_rx: Drive all signals in all branches

This avoids some edge cases with if statements and default values.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
This commit is contained in:
Sean Anderson 2022-10-16 17:40:44 -04:00
parent bdbfd4efcd
commit ab341eca0e
1 changed files with 10 additions and 10 deletions

View File

@ -24,31 +24,31 @@ module mii_io_rx (
); );
reg rx_clk_p_next, rx_clk_n, rx_clk_n_next; reg rx_clk_p_next, rx_clk_n, rx_clk_n_next;
reg [1:0] state = HIGH, state_next; reg [1:0] state, state_next;
initial state = HIGH;
localparam LOW = 2; localparam LOW = 2;
localparam RISING = 1; localparam RISING = 1;
localparam HIGH = 0; localparam HIGH = 0;
always @(*) begin always @(*) begin
rx_clk_p_next = 0;
rx_clk_n_next = 0;
if (ce) begin if (ce) begin
state_next = LOW; state_next = LOW;
end else case (state) rx_clk_p_next = 0;
LOW: begin rx_clk_n_next = 0;
end else if (state == LOW) begin
state_next = RISING; state_next = RISING;
end rx_clk_p_next = 0;
RISING: begin rx_clk_n_next = 0;
end else if (state == RISING) begin
state_next = HIGH; state_next = HIGH;
rx_clk_p_next = 0;
rx_clk_n_next = 1; rx_clk_n_next = 1;
end end else begin
HIGH: begin
state_next = HIGH; state_next = HIGH;
rx_clk_p_next = 1; rx_clk_p_next = 1;
rx_clk_n_next = 1; rx_clk_n_next = 1;
end end
endcase
end end
always @(posedge clk) begin always @(posedge clk) begin