nand2tetris/nand2tetris-suite/tools/builtInChips/RAM16K.hdl

25 lines
819 B
Plaintext
Raw Normal View History

2021-09-29 13:13:29 +02:00
// 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/RAM16K.hdl
/**
* Memory of 16K registers, each 16-bit wide.
* The chip facilitates read and write operations, as follows:
* Read: out(t) = RAM16K[address(t)](t)
* Write: If load(t-1) then RAM16K[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 RAM16K {
IN in[16], load, address[14];
OUT out[16];
BUILTIN RAM16K;
CLOCKED in, load;
}