-
Notifications
You must be signed in to change notification settings - Fork 0
/
DMux8Way.hdl
36 lines (34 loc) · 1.51 KB
/
DMux8Way.hdl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* 8-way Demux gate:
* out0 = Demux( Demux( Demux(in, sel[2])[0], sel[0] )[0], sel[0] )[0]
* out1 = Demux( Demux( Demux(in, sel[2])[0], sel[0] )[0], sel[0] )[1]
* out2 = Demux( Demux( Demux(in, sel[2])[0], sel[0] )[1], sel[0] )[0]
* out3 = Demux( Demux( Demux(in, sel[2])[0], sel[0] )[1], sel[0] )[1]
* out4 = Demux( Demux( Demux(in, sel[2])[1], sel[0] )[0], sel[0] )[0]
* out5 = Demux( Demux( Demux(in, sel[2])[1], sel[0] )[0], sel[0] )[1]
* out6 = Demux( Demux( Demux(in, sel[2])[1], sel[0] )[1], sel[0] )[0]
* out7 = Demux( Demux( Demux(in, sel[2])[1], sel[0] )[1], sel[0] )[1]
*
* sel[2] sel[1] sel[0] a b c d e f g h
* ---------------------------------------------
* 0 0 0 in 0 0 0 0 0 0 0
* 0 0 1 0 in 0 0 0 0 0 0
* 0 1 0 0 0 in 0 0 0 0 0
* 0 1 1 0 0 0 in 0 0 0 0
* 1 0 0 0 0 0 0 in 0 0 0
* 1 0 1 0 0 0 0 0 in 0 0
* 1 1 0 0 0 0 0 0 0 in 0
* 1 1 1 0 0 0 0 0 0 0 in
*/
CHIP DMux8Way {
IN in, sel[3];
OUT a, b, c, d, e, f, g, h;
PARTS:
DMux(in=in, sel=sel[2], a=dmuxABCD, b=dmuxEFGH);
DMux(in=dmuxABCD, sel=sel[1], a=dmuxAB, b=dmuxCD);
DMux(in=dmuxEFGH, sel=sel[1], a=dmuxEF, b=dmuxGH);
DMux(in=dmuxAB, sel=sel[0], a=a, b=b);
DMux(in=dmuxCD, sel=sel[0], a=c, b=d);
DMux(in=dmuxEF, sel=sel[0], a=e, b=f);
DMux(in=dmuxGH, sel=sel[0], a=g, b=h);
}