Tuesday, 12 May 2020

4X1 Mux

4X1 Mux

A multiplexer or mux is a combinational circuit that selects several analog or digital input signals and forwards the selected input into a single output line. A multiplexer of 2n inputs has n selected lines, are used to select which input line to send to the output.


Code

module Mux(
    input a,b,c,d,
    input [1:0] s,
    output y
    );
    assign y = (s==2'b11)? a:
                  (s==2'b10)? b:
                          (s==2'b01)? c: d;
endmodule

Output