Switch statements express conditionals across many branches.
Here’s a basic switch.
You can use commas to separate multiple expressions in the same case statement. VHDL does not have a direct default case, so we use when others instead.
Switch without an expression is an alternate way to express if/else logic. Here we also show how the case expressions can be non-constants.
A type switch compares types instead of values. Since VHDL does not support this kind of type checking directly, you would typically use a combination of different VHDL constructs to handle multiple types.
Here’s an example demonstrating handling different types: