Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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:
- Not(in=sel[0], out=ns0);
- Not(in=sel[1], out=ns1);
- And(a=sel[0], b=sel[1], out=s1);
- And(a=ns0, b=sel[1], out=ns);
- And(a=sel[0], b=ns1, out=sn);
- And(a=ns0, b=ns1, out=s0);
- And(a=in, b=s0, out=a);
- And(a=in, b=ns, out=c);
- And(a=in, b=sn, out=b);
- And(a=in, b=s1, out=d);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement