From 9542deeb483a00b6fabed7574720926ce97d7511 Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Tue, 16 Aug 2022 11:54:23 +0800 Subject: Projects, 01-06 completed --- projects/03/a/Register.hdl | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 projects/03/a/Register.hdl (limited to 'projects/03/a/Register.hdl') diff --git a/projects/03/a/Register.hdl b/projects/03/a/Register.hdl new file mode 100644 index 0000000..78c0636 --- /dev/null +++ b/projects/03/a/Register.hdl @@ -0,0 +1,33 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/03/a/Register.hdl + +/** + * 16-bit register: + * If load[t] == 1 then out[t+1] = in[t] + * else out does not change + */ + +CHIP Register { + IN in[16], load; + OUT out[16]; + + PARTS: + Bit(in=in[0], load=load, out=out[0]); + Bit(in=in[1], load=load, out=out[1]); + Bit(in=in[2], load=load, out=out[2]); + Bit(in=in[3], load=load, out=out[3]); + Bit(in=in[4], load=load, out=out[4]); + Bit(in=in[5], load=load, out=out[5]); + Bit(in=in[6], load=load, out=out[6]); + Bit(in=in[7], load=load, out=out[7]); + Bit(in=in[8], load=load, out=out[8]); + Bit(in=in[9], load=load, out=out[9]); + Bit(in=in[10], load=load, out=out[10]); + Bit(in=in[11], load=load, out=out[11]); + Bit(in=in[12], load=load, out=out[12]); + Bit(in=in[13], load=load, out=out[13]); + Bit(in=in[14], load=load, out=out[14]); + Bit(in=in[15], load=load, out=out[15]); +} -- cgit v1.2.3