+/TECS

git clone https://git.julia.blue/+/TECS

P1n3appl3Remove headers5e97a3a

v1.0
563 B19 linesraw
1/**
2 * 8-way demultiplexor:
3 * {a, b, c, d, e, f, g, h} = {in, 0, 0, 0, 0, 0, 0, 0} if sel == 000
4 *                            {0, in, 0, 0, 0, 0, 0, 0} if sel == 001
5 *                            etc.
6 *                            {0, 0, 0, 0, 0, 0, 0, in} if sel == 111
7 */
8
9CHIP DMux8Way {
10    IN in, sel[3];
11    OUT a, b, c, d, e, f, g, h;
12
13    PARTS:
14    Not(in=sel[2],out=w1);
15    And(a=in,b=w1,out=w2);
16    DMux4Way(in=w2,sel=sel[0..1],a=a,b=b,c=c,d=d);
17    And(a=in,b=sel[2],out=w3);
18    DMux4Way(in=w3,sel=sel[0..1],a=e,b=f,c=g,d=h);
19}