Created
October 29, 2014 06:52
-
-
Save devyn/d9ff282df07a27b50325 to your computer and use it in GitHub Desktop.
Textual redstone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nor(out, A, B) { | |
| out !- A + B; | |
| } | |
| nand(out, A, B) { | |
| notA !- A; | |
| notB !- B; | |
| out <- notA + notB; | |
| } | |
| and(out, A, B) { | |
| nand(notOut, A, B); | |
| out !- notOut; | |
| } | |
| // Translation of design F from Wikia. | |
| xor(out, A, B) { | |
| notA !- A; | |
| notB !- B; | |
| both !- notA + notB; | |
| onlyA !- notA + both; | |
| onlyB !- notB + both; | |
| out <- onlyA + onlyB; | |
| } | |
| // Translation (and slight simplification) of design A from Wikia. | |
| xnor(out, A, B) { | |
| notA !- A; | |
| notB !- B; | |
| neither !- A + B; | |
| both !- notA + notB; | |
| out <- neither + both; | |
| } | |
| implies(out, A, B) { | |
| notA !- A; | |
| out <- notA + B; | |
| } | |
| srnor(q, ~q, Set, Reset) { | |
| nor( q, ~q, Reset); | |
| nor(~q, q, Reset); | |
| } | |
| // Transparent when clock is low. | |
| dlatch(q, ~q, Clock, Data) { | |
| set !- Clock + reset; | |
| reset !- Clock + Data; | |
| srnor(q, ~q, set, reset); | |
| } | |
| dflop(q, ~q, Clock, Data) { | |
| dlatch(q1, _, Clock, Data); | |
| notClock !- Clock; | |
| dlatch(q, ~q, notClock, q1); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment