/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

  1. // This file is part of the materials accompanying the book
  2. // "The Elements of Computing Systems" by Nisan and Schocken,
  3. // MIT Press. Book site: www.idc.ac.il/tecs
  4. // File name: projects/01/DMux4Way.hdl
  5. /**
  6. * 4-way demultiplexor. The 2-bit sel input selects the output to which
  7. * the in input will be channeled: 00 to a, 01 to b, 10 to c, 11 to d.
  8. * The other outputs are set to 0.
  9. */
  10. CHIP DMux4Way {
  11. IN in, sel[2];
  12. OUT a, b, c, d;
  13. PARTS:
  14. DMux(in=in, a=ab, b=cd, sel=sel[1]);
  15. DMux(in=ab, a=a, b=b, sel=sel[0]);
  16. DMux(in=cd, a=c, b=d, sel=sel[0]);
  17. }