PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/3/1/Bit.hdl

http://github.com/happy4crazy/elements_of_computing_systems
Unknown | 20 lines | 16 code | 4 blank | 0 comment | 0 complexity | 089f9f0d1016e30eda8e9deaef006f66 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/03/1/Bit.hdl
 5
 6/**
 7 * 1-bit memory register.
 8 * If load[t-1]=1 then out[t] = in[t-1]
 9 * else out does not change (out[t] = out[t-1])
10 */
11
12CHIP Bit {
13
14    IN  in, load;
15    OUT out;
16
17    PARTS:
18    Mux(a=dffOut, b=in, sel=load, out=dffIn);
19    DFF(in=dffIn, out=out, out=dffOut);
20}