/1/DMux8Way.hdl

http://github.com/happy4crazy/elements_of_computing_systems · Unknown · 22 lines · 17 code · 5 blank · 0 comment · 0 complexity · 3dcc57fb6e76a72f79263986c0348e5c 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/DMux8Way.hdl
  5. /**
  6. * 8-way demultiplexor. The 3-bit sel input selects the output to which
  7. * the in input will be channeled: (000 to a, 001 to b, ..., 111 to h).
  8. * The other outputs are set to 0.
  9. */
  10. CHIP DMux8Way {
  11. IN in, sel[3];
  12. OUT a, b, c, d, e, f, g, h;
  13. PARTS:
  14. DMux(in=in, a=abcd, b=efgh, sel=sel[2]);
  15. DMux4Way(in=abcd, a=a, b=b, c=c, d=d, sel=sel[0..1]);
  16. DMux4Way(in=efgh, a=e, b=f, c=g, d=h, sel=sel[0..1]);
  17. }