PageRenderTime 235ms CodeModel.GetById 134ms app.highlight 0ms RepoModel.GetById 100ms app.codeStats 1ms

/1/DMux.hdl

http://github.com/happy4crazy/elements_of_computing_systems
Unknown | 19 lines | 15 code | 4 blank | 0 comment | 0 complexity | 6a374a92bd8c14660d065a3304d22c59 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/DMux.hdl
 5
 6/** 
 7 * Demultiplexer. If sel = 0 then {a = in; b = 0} else {a = 0; b = in}
 8 */
 9 
10CHIP DMux {
11
12    IN  in, sel;
13    OUT a, b;
14
15    PARTS:
16    Not(in=sel, out=notsel);
17    And(a=in, b=notsel, out=a);
18    And(a=in, b=sel, out=b);
19}