summaryrefslogtreecommitdiff
path: root/csim
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-09 16:02:56 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-09 16:02:56 +0100
commit35e0c0f16f58a7503045de5e047e029dd06983a2 (patch)
treec2cf5661ae346644cb1c3eee7aeb2eb9edabffc6 /csim
parentf8c7333c7045ee9e4dae38933c29c6db12dd2501 (diff)
downloadSystDigit-Projet-35e0c0f16f58a7503045de5e047e029dd06983a2.tar.gz
SystDigit-Projet-35e0c0f16f58a7503045de5e047e029dd06983a2.zip
Added FEED/FED signals in protocol.
Diffstat (limited to 'csim')
-rw-r--r--csim/sim.c9
1 files changed, 9 insertions, 0 deletions
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);