🔌
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
  • Demultiplexor (DMux)
  • Implementation of Demultiplexor Chip in HDL
  • Implementation of Demultiplexor Chip in Java™
  1. Combinational Chips

Demultiplexor Chip

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

PreviousMultiplexor ChipNextNot16 Chip

Last updated 3 years ago

Demultiplexor (DMux)

A Demultiplexor performs the opposite function of a Multiplexor.

It takes a single input and channels it to one of two possible outputs according to a selector bit that specifies which output to chose.

Abstraction of Demultiplexor Chip - Representation and Truth Table

Implementation of Demultiplexor Chip in HDL

You can create Demultiplexor Chip in the similar way as Multiplexor Chip.

Unlike Multiplexor Chip, Demultiplexor Chip has two outputs and one input.

CHIP DMux {
    IN in, sel;
    OUT a, b;

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

Implementation of Demultiplexor Chip in Java™

Similar to the Implementation in HDL

package CombChips;

class DMux_Gate extends And_Gate {

    protected static int[] DMux(int in, int sel) {
        int[] out = new int[16];
        out[0] = And(in, Not(sel));
        out[1] = And(in, sel);
        return out; 
    }
}
Implementation of Demultiplexor using a Not gate and two And gates.