From 9c0cb1d1c32724fc95ac9548e4f8d873d3adaccc Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Tue, 16 Aug 2022 11:53:39 +0800 Subject: nand2tetris software suite --- tools/builtInChips/RAM512.hdl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tools/builtInChips/RAM512.hdl (limited to 'tools/builtInChips/RAM512.hdl') diff --git a/tools/builtInChips/RAM512.hdl b/tools/builtInChips/RAM512.hdl new file mode 100644 index 0000000..2a2f433 --- /dev/null +++ b/tools/builtInChips/RAM512.hdl @@ -0,0 +1,24 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: tools/builtIn/RAM512.hdl + +/** + * Memory of 512 registers, each 16-bit wide. + * The chip facilitates read and write operations, as follows: + * Read: out(t) = RAM512[address(t)](t) + * Write: If load(t-1) then RAM512[address(t-1)](t) = in(t-1) + * In words: the chip always outputs the value stored at the memory + * location specified by address. If load == 1, the in value is loaded + * into the memory location specified by address. This value becomes + * available through the out output starting from the next time step. + */ + +CHIP RAM512 { + + IN in[16], load, address[9]; + OUT out[16]; + + BUILTIN RAM512; + CLOCKED in, load; +} -- cgit v1.2.3