Conditions, case, and unintended latches
Write complete choices, make priorities visible, and avoid storage created by omission.
What an if statement describes
Inside a combinational block, an if followed by else if branches describes a priority. The first true condition selects the result.
module request_priority (
input wire [2:0] i_request,
output reg [2:0] o_grant,
output reg o_valid
);
always @* begin
o_grant = 3'b000;
o_valid = 1'b1;
if (i_request[2])
o_grant = 3'b100;
else if (i_request[1