diff options
Diffstat (limited to 'simulator.c')
-rw-r--r-- | simulator.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/simulator.c b/simulator.c index d89ceb0..657355f 100644 --- a/simulator.c +++ b/simulator.c @@ -1,10 +1,31 @@ +#include <stdio.h> +#include <string.h> + #include "gate.h" #include "logic.h" +#include "parser.h" int main(int argc, char **argv) { + char buf[4096]; + FILE *fd = stdin; + (void)argc; (void)argv; + logic_test(); gate_init(); + + while (NULL != fgets(buf, sizeof(buf), fd)) { + buf[strcspn(buf, "\r\n")] = '\0'; + if (parse_line(buf)) { + return 1; + } + } + + gate_set_input("a", LOGIC_LOW); + gate_set_input("b", LOGIC_LOW); + gate_update(); + gate_dump(); + return 0; } |