/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. * 1-bit memory register.
  7. * If load[t-1]=1 then out[t] = in[t-1]
  8. * else out does not change (out[t] = out[t-1])
  9. */
  10. CHIP Bit {
  11. IN in, load;
  12. OUT out;
  13. PARTS:
  14. Mux(a=dffOut, b=in, sel=load, out=dffIn);
  15. DFF(in=dffIn, out=out, out=dffOut);
  16. }