From 35e0c0f16f58a7503045de5e047e029dd06983a2 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Thu, 9 Jan 2014 16:02:56 +0100 Subject: Added FEED/FED signals in protocol. --- csim/sim.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'csim/sim.c') diff --git a/csim/sim.c b/csim/sim.c index 1dd2791..4451d0e 100644 --- a/csim/sim.c +++ b/csim/sim.c @@ -74,6 +74,13 @@ void read_inputs(t_machine *m, FILE *stream) { t_id var; t_program *p = m->prog; + int magic; + fscanf(stream, " %x", &magic); + if (magic != 0xFEED) { + fprintf(stderr, "(simulator) Protocol error.\n"); + exit(1); + } + if (p->n_inputs == 0) return; // nothing to do for (i = 0; i < p->n_inputs; i++) { @@ -213,6 +220,8 @@ void write_outputs(t_machine *m, FILE *stream) { t_value v, mask; t_program *p = m->prog; + fprintf(stream, "FED\n"); + for (i = 0; i < p->n_outputs; i++) { var = p->outputs[i]; fprintf(stream, "%s\t", p->vars[var].name); -- cgit v1.2.3