DMux4Way :
了解過 DMux 與 Mux ,這應該不難理解,
只是輸入輸出和選擇位的變化。
sel[1] 決定了 in 在 ab 輸出位還是 cd 輸出位,
sel[0] 在分別確定 a b c d 的值,
只是多次調用 DMux。
| in | sel | a | b | c | d |
| 0 | 00 | 0 | 0 | 0 | 0 |
| 0 | 01 | 0 | 0 | 0 | 0 |
| 0 | 10 | 0 | 0 | 0 | 0 |
| 0 | 11 | 0 | 0 | 0 | 0 |
| 1 | 00 | 1 | 0 | 0 | 0 |
| 1 | 01 | 0 | 1 | 0 | 0 |
| 1 | 10 | 0 | 0 | 1 | 0 |
| 1 | 11 | 0 | 0 | 0 | 1 |
/**
* 4-way demultiplexor:
* {a, b, c, d} = {in, 0, 0, 0} if sel == 00
* {0, in, 0, 0} if sel == 01
* {0, 0, in, 0} if sel == 10
* {0, 0, 0, in} if sel == 11
*/
CHIP DMux4Way
{
IN in, sel[2];
OUT a, b, c, d;
PARTS:
DMux(in = in, sel = sel[0], a = a);
DMux(in = in, sel = sel[1], a = b);
DMux(in = in, sel = sel[2], a = c);
DMux(in = in, sel = sel[3], a = d);
}