Learning Functional Programming in Go
上QQ阅读APP看书,第一时间看更新

Programming CMOS with Unix pipes

Unix pipes can also be used to model the flow control of NAND gates of a CMOS device.

Assuming nil represents and electron then, /dev/zero (aka VSS) provides an infinite supply of electrons and /dev/null (aka VDD) will consume every electron sent to it.

CMOS NAND gate

In our model, the UNIX pipe acts like a wire. When the pipe is connected to Vss, its buffer fills up with nil-bytes and the pipe acts like a negatively charged metal plate. When it is connected to Vdd, the pipe's buffer is drained, and the pipe acts like a positively charged metal plate. Unix pipes are used to model flow control in our NAND logic gate.

For more details, see http://www.linusakesson.net/programming/pipelogic/index.php.