summaryrefslogtreecommitdiff
path: root/csim
diff options
context:
space:
mode:
Diffstat (limited to 'csim')
-rw-r--r--csim/Makefile2
-rw-r--r--csim/load.c4
-rw-r--r--csim/main.c4
3 files changed, 7 insertions, 3 deletions
diff --git a/csim/Makefile b/csim/Makefile
index 32d100d..c94bee2 100644
--- a/csim/Makefile
+++ b/csim/Makefile
@@ -1,4 +1,4 @@
-main: main.o load.o sim.o
+csim: main.o load.o sim.o
gcc -o csim $^
%.o: %.c
diff --git a/csim/load.c b/csim/load.c
index 05c5f70..a7e6cac 100644
--- a/csim/load.c
+++ b/csim/load.c
@@ -60,6 +60,10 @@ t_program *load_dumb_netlist (FILE *stream) {
p->vars[i].name = malloc(42); // let's bet that the name of a variable will never be longer than 42 chars
fscanf(stream, "%s\n", p->vars[i].name);
+
+ if (p->vars[i].size >= 8*sizeof(t_value)) {
+ fprintf(stderr, "Warning: variable %s might be too big for machine integers.\n", p->vars[i].name);
+ }
}
// read input list
diff --git a/csim/main.c b/csim/main.c
index ad23cd8..a43d7c9 100644
--- a/csim/main.c
+++ b/csim/main.c
@@ -16,7 +16,7 @@ void usage() {
printf ("\nUsage:\n\tcsim [options] <netlist_file>\n\n");
printf("Available options:\n");
printf("\n -rom <file>\n\tLoad a filename as a ROM file for the machine\n");
- printf("\n -n <steps>\n\tOnly run #steps steps of simulation (-1 = infinity)\n");
+ printf("\n -n <steps>\n\tOnly run #steps steps of simulation (0 = infinity)\n");
printf("\n -in <in-file>\n\tRead inputs from given file (eg. named pipe). Defaults to STDIN.\n");
printf("\n -out <out-file>\n\tWrite outputs to given file (eg. named pipe). Defaults to STDOut.\n");
exit(1);
@@ -81,7 +81,7 @@ int main(int argc, char **argv) {
// Run
t_machine *machine = init_machine(program);
i = 0;
- while (i < steps || steps == -1) {
+ while (i < steps || steps == 0) {
read_inputs(machine, input);
machine_step(machine);
write_outputs(machine, output);