/2/ZN.hdl

http://github.com/happy4crazy/elements_of_computing_systems · Unknown · 12 lines · 10 code · 2 blank · 0 comment · 0 complexity · 76d1cb172a9873076b0d1adcfdac6e63 MD5 · raw file

  1. CHIP ZN {
  2. IN in[16], z, n;
  3. OUT out[16];
  4. PARTS:
  5. // first decide whether to zero input
  6. Mux16(a=in, b=false, sel=z, out=zout);
  7. // then decide whether to negate possibly zeroed input
  8. Not16(in=zout, out=notzout);
  9. Mux16(a=zout, b=notzout, sel=n, out=out);
  10. }