I'm looking to verify the result of some algorithm against the output of a known-good "truth table". For this, I'd need to write a byte to a file/pipe/stdout/... at the end of each loop iteration. ucSim (from the sdcc project) implements simif (simulator interface), which works like so: you define a memory address to use with simif and an output file on the host, then whenever you send 'w', followed by a byte, the byte is written into the file.
Is there something similar available for gpsim? It feels like FileRecorder might be able to do what I want, but I'm not sure how to set that up. (afaict, it's supposed to write output on each cpu cycle?)
Anonymous
One possible option is to add the .command to your code.
In gpasm code the following
.command "porta"
nop
thanks! in the meantime, i've figured out something else that kind-of works: I'm writing the bytes I need to
debug_var
(in SRAM) and invoke gpsim like so:printf 'log on test.log\nlog w debug_var\nbreak w <exit condition>\nrun\nq\n'|gpsim -i test.cod
this is then post-processed to get the raw bytes like this:
grep -o '^ Wrote: 0x....' test.log|cut -b14-15|xxd -pl -r > /tmp/test.bin
yours would've been a bit cleaner, but still require some post-processing.