Electronic – VHDL: Are if-else and case statements supposed to synthesize the same hardware

fpgasynthesisvhdl

The if-else and case statements are equivalent. The later maybe easier to read when we have a lot of possibilities being checked.

A conditional is supposed to infer mux in hardware. However, there is different between having a chain of 2-to-1 mux and a big n-to-1 mux doing the same thing in terms of propagation delay.

Is the if-else statement and case statement supposed to infer the same hardware? Or is there some difference in how they would be synthesized?

Best Answer

No: if-else is sequential; case is concurrent. A single if followed by an else will be equivalent to a two input multiplexer. An if followed by if else statements is equivalent to a series of two input multiplexers like this: mux This is because the order you check the conditions of the if-else matters, i.e. you have priority.

A case statement, on the other hand is concurrent. Everything happens at the same time.