mirror of
https://github.com/StepanovPlaton/Nand2Tetris.git
synced 2026-04-03 20:30:47 +04:00
Complete first project
This commit is contained in:
24
1_Boolean_Arithmetic/DMux8Way.hdl
Normal file
24
1_Boolean_Arithmetic/DMux8Way.hdl
Normal file
@@ -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: projects/1/DMux8Way.hdl
|
||||
/**
|
||||
* 8-way demultiplexor:
|
||||
* [a, b, c, d, e, f, g, h] = [in, 0, 0, 0, 0, 0, 0, 0] if sel = 000
|
||||
* [0, in, 0, 0, 0, 0, 0, 0] if sel = 001
|
||||
* [0, 0, in, 0, 0, 0, 0, 0] if sel = 010
|
||||
* [0, 0, 0, in, 0, 0, 0, 0] if sel = 011
|
||||
* [0, 0, 0, 0, in, 0, 0, 0] if sel = 100
|
||||
* [0, 0, 0, 0, 0, in, 0, 0] if sel = 101
|
||||
* [0, 0, 0, 0, 0, 0, in, 0] if sel = 110
|
||||
* [0, 0, 0, 0, 0, 0, 0, in] if sel = 111
|
||||
*/
|
||||
CHIP DMux8Way {
|
||||
IN in, sel[3];
|
||||
OUT a, b, c, d, e, f, g, h;
|
||||
|
||||
PARTS:
|
||||
DMux(in=in, sel=sel[2], a=x, b=y);
|
||||
DMux4Way(in=x, sel=sel[0..1], a=a, b=b, c=c, d=d);
|
||||
DMux4Way(in=y, sel=sel[0..1], a=e, b=f, c=g, d=h);
|
||||
}
|
||||
Reference in New Issue
Block a user