From d3a0cc3a8ba6dfeb64d3faeffdeb6845b60e5840 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Sat, 20 Jan 2018 15:41:49 +0100 Subject: rearranged the dir for github - removed tools and pdfs - rearranged the projects dirs - added md files - other minor changes --- chips/FullAdder.hdl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 chips/FullAdder.hdl (limited to 'chips/FullAdder.hdl') diff --git a/chips/FullAdder.hdl b/chips/FullAdder.hdl new file mode 100644 index 0000000..451499f --- /dev/null +++ b/chips/FullAdder.hdl @@ -0,0 +1,20 @@ +// 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/02/FullAdder.hdl + +/** + * Computes the sum of three bits. + */ + +CHIP FullAdder { + IN a, b, c; // 1-bit inputs + OUT sum, // Right bit of a + b + c + carry; // Left bit of a + b + c + + PARTS: + // Put you code here: + HalfAdder (a=a, b=b, sum=sum1, carry=carry1); + HalfAdder (a=sum1, b=c, sum=sum, carry=carry2); + Or (a=carry1, b=carry2, out=carry); +} -- cgit v1.2.3