I am learning SystemVerilog. While coding, the synthesis schematic for the following if statements don't make sense to me.
module ifelseDUT(
input logic sela, selb, selc, da,db,dc,
output logic dout
);
always @*
begin
dout = 0;
priority if(sela)
dout = da;
if(selb)
dout = db;
if(selc)
dout = dc;
end
endmodule
Here is the synthesized schematic:
How to understand the schematic when sela is not used? I am also not able to make sense of S=default value on the muxes.
Here is the message generated by Vivado. There are no errors or warnings during the synthesis.
[Synth 8-293] found qualifier priority on case statement: implementing as full_case ["C:/Users/homealien/Xilinx/ifelse-test/ifelse-test.srcs/sources_1/new/ifelseDUT.sv":32]

Because your
priority ifstatement does not contain an else clause, synthesis is treating it as:and that is being optimized as just
This is because the
priorityis an assumption/assertion that a conditional branch will always be taken. Without anelseclause, synthesis is generating logic assuming the condition is always true. This should have been caught as a synthesis error, but it is a legal description.What you probably intended is:
Now you have written the code is such a way that a conditional branch statement will always be taken under all possible conditions.