Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ahuth/emitter-gates
EventEmitter-based logic gates
https://github.com/ahuth/emitter-gates
Last synced: 4 days ago
JSON representation
EventEmitter-based logic gates
- Host: GitHub
- URL: https://github.com/ahuth/emitter-gates
- Owner: ahuth
- License: mit
- Created: 2020-05-26T15:31:11.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-22T16:55:48.000Z (almost 4 years ago)
- Last Synced: 2023-04-04T16:46:44.098Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 243 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# emitter-gates
Logic gate simulation based on [Node EventEmitters](https://nodejs.org/api/events.html#events_class_eventemitter).
While logic gates can be implemented as pure functions (see [Logic Gates in JavaScript](https://ahuth.github.io/articles/logic-gates-in-javascript.html) and https://github.com/ahuth/bit-adder), they can't easily model circuits that require a delay.
For example, an [oscsillator](https://en.wikipedia.org/wiki/Electronic_oscillator) generally requires a feedback loop, and therefore a delay, for it to work. This project is an exploration of APIs that better support such circuits. By basing the simulation on events emitters, we can easily introduce slight a slight delay between the time a logic gate receives a signal, and the time the output signal is sent.
Working through this reminded me of the [A Simulator for Digital Circuits](https://mitpress.mit.edu/sites/default/files/sicp/full-text/sicp/book/node64.html) exercise in [Structure and Interpretation of Computer Programs](https://mitpress.mit.edu/sites/default/files/sicp/index.html).
## Usage
Tests can be ran with the following command:
```
yarn test
```