PageRenderTime 765ms CodeModel.GetById 623ms app.highlight 1ms RepoModel.GetById 140ms app.codeStats 0ms

/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/**
 7 * 8-way demultiplexor.  The 3-bit sel input selects the output to which 
 8 * the in input will be channeled: (000 to a, 001 to b, ..., 111 to h).
 9 * The other outputs are set to 0.
10 */
11
12CHIP DMux8Way {
13
14    IN  in, sel[3];
15    OUT a, b, c, d, e, f, g, h;
16
17    PARTS:
18    DMux(in=in, a=abcd, b=efgh, sel=sel[2]);
19    DMux4Way(in=abcd, a=a, b=b, c=c, d=d, sel=sel[0..1]);
20    DMux4Way(in=efgh, a=e, b=f, c=g, d=h, sel=sel[0..1]);
21}
22