dos2unix old files

This commit is contained in:
2021-12-23 19:44:21 +05:30
parent 041e5b5789
commit 0be22ea1ea
28 changed files with 822 additions and 822 deletions

View File

@@ -1,33 +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/b/RAM16K.hdl
/**
* Memory of 16K registers, each 16 bit-wide. Out holds the value
* stored at the memory location specified by address. If load==1, then
* the in value is loaded into the memory location specified by address
* (the loaded value will be emitted to out from the next time step onward).
*/
CHIP RAM16K {
IN in[16], load, address[14];
OUT out[16];
PARTS:
// Put your code here:
DMux4Way(in=load, sel=address[12..13], a=toRAM4KA,
b=toRAM4KB,
c=toRAM4KC,
d=toRAM4KD);
RAM4K(in=in, load=toRAM4KA, address=address[0..11], out=fromRAM4KA);
RAM4K(in=in, load=toRAM4KB, address=address[0..11], out=fromRAM4KB);
RAM4K(in=in, load=toRAM4KC, address=address[0..11], out=fromRAM4KC);
RAM4K(in=in, load=toRAM4KD, address=address[0..11], out=fromRAM4KD);
Mux4Way16(sel=address[12..13], out=out, a=fromRAM4KA,
b=fromRAM4KB,
c=fromRAM4KC,
d=fromRAM4KD);
}
// 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/b/RAM16K.hdl
/**
* Memory of 16K registers, each 16 bit-wide. Out holds the value
* stored at the memory location specified by address. If load==1, then
* the in value is loaded into the memory location specified by address
* (the loaded value will be emitted to out from the next time step onward).
*/
CHIP RAM16K {
IN in[16], load, address[14];
OUT out[16];
PARTS:
// Put your code here:
DMux4Way(in=load, sel=address[12..13], a=toRAM4KA,
b=toRAM4KB,
c=toRAM4KC,
d=toRAM4KD);
RAM4K(in=in, load=toRAM4KA, address=address[0..11], out=fromRAM4KA);
RAM4K(in=in, load=toRAM4KB, address=address[0..11], out=fromRAM4KB);
RAM4K(in=in, load=toRAM4KC, address=address[0..11], out=fromRAM4KC);
RAM4K(in=in, load=toRAM4KD, address=address[0..11], out=fromRAM4KD);
Mux4Way16(sel=address[12..13], out=out, a=fromRAM4KA,
b=fromRAM4KB,
c=fromRAM4KC,
d=fromRAM4KD);
}

View File

@@ -1,45 +1,45 @@
// 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/b/RAM4K.hdl
/**
* Memory of 4K registers, each 16 bit-wide. Out holds the value
* stored at the memory location specified by address. If load==1, then
* the in value is loaded into the memory location specified by address
* (the loaded value will be emitted to out from the next time step onward).
*/
CHIP RAM4K {
IN in[16], load, address[12];
OUT out[16];
PARTS:
// Put your code here:
DMux8Way(in=load, sel=address[9..11], a=toRAM512A,
b=toRAM512B,
c=toRAM512C,
d=toRAM512D,
e=toRAM512E,
f=toRAM512F,
g=toRAM512G,
h=toRAM512H);
RAM512(in=in, load=toRAM512A, address=address[0..8], out=fromRAM512A);
RAM512(in=in, load=toRAM512B, address=address[0..8], out=fromRAM512B);
RAM512(in=in, load=toRAM512C, address=address[0..8], out=fromRAM512C);
RAM512(in=in, load=toRAM512D, address=address[0..8], out=fromRAM512D);
RAM512(in=in, load=toRAM512E, address=address[0..8], out=fromRAM512E);
RAM512(in=in, load=toRAM512F, address=address[0..8], out=fromRAM512F);
RAM512(in=in, load=toRAM512G, address=address[0..8], out=fromRAM512G);
RAM512(in=in, load=toRAM512H, address=address[0..8], out=fromRAM512H);
Mux8Way16(sel=address[9..11], out=out, a=fromRAM512A,
b=fromRAM512B,
c=fromRAM512C,
d=fromRAM512D,
e=fromRAM512E,
f=fromRAM512F,
g=fromRAM512G,
h=fromRAM512H);
}
// 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/b/RAM4K.hdl
/**
* Memory of 4K registers, each 16 bit-wide. Out holds the value
* stored at the memory location specified by address. If load==1, then
* the in value is loaded into the memory location specified by address
* (the loaded value will be emitted to out from the next time step onward).
*/
CHIP RAM4K {
IN in[16], load, address[12];
OUT out[16];
PARTS:
// Put your code here:
DMux8Way(in=load, sel=address[9..11], a=toRAM512A,
b=toRAM512B,
c=toRAM512C,
d=toRAM512D,
e=toRAM512E,
f=toRAM512F,
g=toRAM512G,
h=toRAM512H);
RAM512(in=in, load=toRAM512A, address=address[0..8], out=fromRAM512A);
RAM512(in=in, load=toRAM512B, address=address[0..8], out=fromRAM512B);
RAM512(in=in, load=toRAM512C, address=address[0..8], out=fromRAM512C);
RAM512(in=in, load=toRAM512D, address=address[0..8], out=fromRAM512D);
RAM512(in=in, load=toRAM512E, address=address[0..8], out=fromRAM512E);
RAM512(in=in, load=toRAM512F, address=address[0..8], out=fromRAM512F);
RAM512(in=in, load=toRAM512G, address=address[0..8], out=fromRAM512G);
RAM512(in=in, load=toRAM512H, address=address[0..8], out=fromRAM512H);
Mux8Way16(sel=address[9..11], out=out, a=fromRAM512A,
b=fromRAM512B,
c=fromRAM512C,
d=fromRAM512D,
e=fromRAM512E,
f=fromRAM512F,
g=fromRAM512G,
h=fromRAM512H);
}

View File

@@ -1,45 +1,45 @@
// This file is part of the materials accompanying the book
// "The Elements of Computing Systems" by Nisan and Schocken,
// MIT Press. Book site: www.idc.ac.il/tecs
// File name: projects/03/b/RAM512.hdl
/**
* Memory of 512 registers, each 16 bit-wide. Out holds the value
* stored at the memory location specified by address. If load==1, then
* the in value is loaded into the memory location specified by address
* (the loaded value will be emitted to out from the next time step onward).
*/
CHIP RAM512 {
IN in[16], load, address[9];
OUT out[16];
PARTS:
// Put your code here:
DMux8Way(in=load, sel=address[6..8], a=toRAM64A,
b=toRAM64B,
c=toRAM64C,
d=toRAM64D,
e=toRAM64E,
f=toRAM64F,
g=toRAM64G,
h=toRAM64H);
RAM64(in=in, load=toRAM64A, address=address[0..5], out=fromRAM64A);
RAM64(in=in, load=toRAM64B, address=address[0..5], out=fromRAM64B);
RAM64(in=in, load=toRAM64C, address=address[0..5], out=fromRAM64C);
RAM64(in=in, load=toRAM64D, address=address[0..5], out=fromRAM64D);
RAM64(in=in, load=toRAM64E, address=address[0..5], out=fromRAM64E);
RAM64(in=in, load=toRAM64F, address=address[0..5], out=fromRAM64F);
RAM64(in=in, load=toRAM64G, address=address[0..5], out=fromRAM64G);
RAM64(in=in, load=toRAM64H, address=address[0..5], out=fromRAM64H);
Mux8Way16(sel=address[6..8], out=out, a=fromRAM64A,
b=fromRAM64B,
c=fromRAM64C,
d=fromRAM64D,
e=fromRAM64E,
f=fromRAM64F,
g=fromRAM64G,
h=fromRAM64H);
}
// This file is part of the materials accompanying the book
// "The Elements of Computing Systems" by Nisan and Schocken,
// MIT Press. Book site: www.idc.ac.il/tecs
// File name: projects/03/b/RAM512.hdl
/**
* Memory of 512 registers, each 16 bit-wide. Out holds the value
* stored at the memory location specified by address. If load==1, then
* the in value is loaded into the memory location specified by address
* (the loaded value will be emitted to out from the next time step onward).
*/
CHIP RAM512 {
IN in[16], load, address[9];
OUT out[16];
PARTS:
// Put your code here:
DMux8Way(in=load, sel=address[6..8], a=toRAM64A,
b=toRAM64B,
c=toRAM64C,
d=toRAM64D,
e=toRAM64E,
f=toRAM64F,
g=toRAM64G,
h=toRAM64H);
RAM64(in=in, load=toRAM64A, address=address[0..5], out=fromRAM64A);
RAM64(in=in, load=toRAM64B, address=address[0..5], out=fromRAM64B);
RAM64(in=in, load=toRAM64C, address=address[0..5], out=fromRAM64C);
RAM64(in=in, load=toRAM64D, address=address[0..5], out=fromRAM64D);
RAM64(in=in, load=toRAM64E, address=address[0..5], out=fromRAM64E);
RAM64(in=in, load=toRAM64F, address=address[0..5], out=fromRAM64F);
RAM64(in=in, load=toRAM64G, address=address[0..5], out=fromRAM64G);
RAM64(in=in, load=toRAM64H, address=address[0..5], out=fromRAM64H);
Mux8Way16(sel=address[6..8], out=out, a=fromRAM64A,
b=fromRAM64B,
c=fromRAM64C,
d=fromRAM64D,
e=fromRAM64E,
f=fromRAM64F,
g=fromRAM64G,
h=fromRAM64H);
}