/1/DMux4Way.hdl
http://github.com/happy4crazy/elements_of_computing_systems · Unknown · 22 lines · 17 code · 5 blank · 0 comment · 0 complexity · ca02c7b69145363def36289c0e8bc855 MD5 · raw file
- // This file is part of the materials accompanying the book
- // "The Elements of Computing Systems" by Nisan and Schocken,
- // MIT Press. Book site: www.idc.ac.il/tecs
- // File name: projects/01/DMux4Way.hdl
-
- /**
- * 4-way demultiplexor. The 2-bit sel input selects the output to which
- * the in input will be channeled: 00 to a, 01 to b, 10 to c, 11 to d.
- * The other outputs are set to 0.
- */
-
- CHIP DMux4Way {
-
- IN in, sel[2];
- OUT a, b, c, d;
-
- PARTS:
- DMux(in=in, a=ab, b=cd, sel=sel[1]);
- DMux(in=ab, a=a, b=b, sel=sel[0]);
- DMux(in=cd, a=c, b=d, sel=sel[0]);
- }