From e6df3495f249a22a8386103b9f910e223a663acb Mon Sep 17 00:00:00 2001 From: Konarak Date: Sat, 25 Dec 2021 22:13:42 +0530 Subject: [PATCH] add Computer.hdl --- projects/05/Computer.hdl | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/05/Computer.hdl diff --git a/projects/05/Computer.hdl b/projects/05/Computer.hdl new file mode 100644 index 0000000..9c7c2dc --- /dev/null +++ b/projects/05/Computer.hdl @@ -0,0 +1,42 @@ +// 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/05/Computer.hdl + +/** + * The HACK computer, including CPU, ROM and RAM. + * When reset is 0, the program stored in the computer's ROM executes. + * When reset is 1, the execution of the program restarts. + * Thus, to start a program's execution, reset must be pushed "up" (1) + * and "down" (0). From this point onward the user is at the mercy of + * the software. In particular, depending on the program's code, the + * screen may show some output and the user may be able to interact + * with the computer via the keyboard. + */ + +CHIP Computer { + + IN reset; + + PARTS: + // Put your code here: + + ROM32K( + address=addressI, + out=instruction); + + Memory( + in=outM, + load=writeM, + address=addressM, + out=inM); + + CPU( + inM=inM, + instruction=instruction, + reset=reset, + outM=outM, + writeM=writeM, + addressM=addressM, + pc=addressI); +}