← All exercises

Mux 4

easy

A select input (0 to 3) chooses which of four inputs is routed to the output.

What it teaches

Input routing — forward exactly one of four sources based on a select value. The shape is four explicit cases, one per select value, each claiming the output for its source. Foundation for recipe selection and signal arbitration.

Inputs and outputs

TagTypeDefaultDescription
In_SelectDINTSelector value
In_Source0DINT10First input source
In_Source1DINT20Second input source
In_Source2DINT30Third input source
In_Source3DINT40Fourth input source
Out_SelectedDINTRouted value

Required behavior

  • Out_Selected equals In_Source0 when In_Select is 0.
  • Out_Selected equals In_Source1 when In_Select is 1.
  • Out_Selected equals In_Source2 when In_Select is 2.
  • Out_Selected equals In_Source3 when In_Select is 3.