🔌
nand2tetris
  • Introduction
  • Combinational Chips
    • Nand Gate
    • Not Gate
    • And Gate
    • Or Gate
    • Xor Gate
    • Multiplexor Chip
    • Demultiplexor Chip
    • Not16 Chip
    • And16 Chip
    • Or16 Chip
    • Mux16 Chip
    • Or8Way Chip
    • Mux4Way16 Chip
    • Mux8Way16 Chip
    • DMux4Way Chip
    • DMux8Way Chip
    • Half Adder Chip
    • Full Adder Chip
    • Add16 Chip
    • Inc16 Chip
    • Half Subtractor Chip
    • Full Subtractor Chip
    • Subtract16 Chip
    • Dec16 Chip
    • Arithmetic Chip
    • ALU
  • Misc
    • Int2Bool
    • Bool2Int
    • Arrayto16
Powered by GitBook
On this page
  • Multiplexor (Mux)
  • Implementation of Multiplexor Chip in HDL
  • Implementation of Multiplexor Chip in Java™
  1. Combinational Chips

Multiplexor Chip

Abstraction and Implementation of Multiplexor Chip in Hardware Design Language and Java™.

PreviousXor GateNextDemultiplexor Chip

Last updated 3 years ago

Multiplexor (Mux)

A Multiplexor, also known as Selector, is a three-input bit gate that uses one of the input called "selection bit" to select one of the given two inputs for outputting them.

The name multiplexor was adopted from communications systems, where similar devices are used to serialize (multiplex) several input signals over a single output wire.

Abstraction of Multiplexor Chip - Representation and Truth Table

Implementation of Multiplexor Chip in HDL

The expression in the above abstraction can help in the implementation of Multiplexor chip.

CHIP Mux {
    IN a, b, sel;
    OUT out;

    PARTS:
    Not(in=a, out=notsel);
    And(a=a, b=notsel, out=aAndnotsel);
    And(a=sel, b=b, out=bAndsel);
    Or(a=aAndnotsel, b=bAndsel, out=out);
}

Implementation of Multiplexor Chip in Java™

Similar to the Implementation in HDL

package CombChips;

class Mux_Gate extends And_Gate {

    protected static int Mux(int a, int b, int sel) {
        int first = And(a, Not(sel));
        int second = And(b, sel);
        return Or_Gate.Or(first, second);
    }
}
Implementation of Multiplexor using Not, And and Or gates.