summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--csim/sim.c6
-rw-r--r--sched/main.ml4
-rw-r--r--tests/Makefile2
-rw-r--r--tests/nadder.mj4
5 files changed, 9 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore
index 7f124fb..be8fd58 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,5 @@
csim/csim
*.o
tests/*.net
+tests/*.snet
tests/*.dumb
diff --git a/csim/sim.c b/csim/sim.c
index 94bf70e..3aa09c2 100644
--- a/csim/sim.c
+++ b/csim/sim.c
@@ -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