diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2013-11-08 21:49:39 +0100 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2013-11-08 21:49:39 +0100 |
commit | 435042774cd03687297a8100e807c70dd7b1b3e4 (patch) | |
tree | 4c08ca4d16515e73cb69b6e6e5cac23dbad885d9 | |
parent | 05749abf8efdcaae6afd9f3dd087df475e5e93ad (diff) | |
download | SystDigit-Projet-435042774cd03687297a8100e807c70dd7b1b3e4.tar.gz SystDigit-Projet-435042774cd03687297a8100e807c70dd7b1b3e4.zip |
Simulator fixed.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | csim/sim.c | 6 | ||||
-rw-r--r-- | sched/main.ml | 4 | ||||
-rw-r--r-- | tests/Makefile | 2 | ||||
-rw-r--r-- | tests/nadder.mj | 4 |
5 files changed, 9 insertions, 8 deletions
@@ -4,4 +4,5 @@ csim/csim *.o tests/*.net +tests/*.snet tests/*.dumb @@ -11,7 +11,7 @@ #include "sim.h" -#define DEBUG 1 +#define DEBUG 0 // Util @@ -39,7 +39,7 @@ t_machine *init_machine (t_program *p) { t_value a = 1; char *o = p->vars[i].name + 1; while (*o) { - m->var_values[i] |= a; + if (*o == '1') m->var_values[i] |= a; a >>= 1; o++; } @@ -204,7 +204,7 @@ void machine_step(t_machine *m) { // SAVE REGISTERS && MEMORY for (i = 0; i < p->n_regs; i++) { m->reg_data[i] = m->var_values[p->regs[i].source]; - if (DEBUG) printf("reg %s <- %s : %lx\n", + if (DEBUG) fprintf(stderr, "reg %s <- %s : %lx\n", p->vars[p->regs[i].dest].name, p->vars[p->regs[i].source].name, m->reg_data[i]); diff --git a/sched/main.ml b/sched/main.ml index ab6ef30..c8ea58e 100644 --- a/sched/main.ml +++ b/sched/main.ml @@ -6,9 +6,9 @@ let dumb_down = ref false let compile filename = try let p = Netlist.read_file filename in - let out_name = (Filename.chop_suffix filename ".net") ^ "_sch.net" in + let out_name = (Filename.chop_suffix filename ".net") ^ ".snet" in let dumb_out_name = (Filename.chop_suffix filename ".net") ^ ".dumb" in - let out_opt_name = (Filename.chop_suffix filename ".net") ^ "_sch_opt.net" in + let out_opt_name = (Filename.chop_suffix filename ".net") ^ "_opt.snet" in let dumb_opt_out_name = (Filename.chop_suffix filename ".net") ^ "_opt.dumb" in let q, q_opt = ref p, ref p in diff --git a/tests/Makefile b/tests/Makefile index 0721dab..7f1e355 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -7,7 +7,7 @@ SIM=../csim/csim %.sim: %.dumb $(SIM) $< -%.dumb %_sch.net %_opt.dumb %_sch_opt.net: %.net +%.dumb %.snet %_opt.dumb %_opt.snet: %.net $(SCHED) $< %.net: %.mj diff --git a/tests/nadder.mj b/tests/nadder.mj index 0e24ca4..c8b0fbe 100644 --- a/tests/nadder.mj +++ b/tests/nadder.mj @@ -14,6 +14,6 @@ adder<n>(a:[n], b:[n], c_in) = (o:[n], c_out) where end if end where -main(a:[2], b:[2]) = (o:[2], c) where - (o, c) = adder<2>(a,b,0) +main(a:[8], b:[8]) = (o:[8], c) where + (o, c) = adder<8>(a,b,0) end where |