Reply by wzab November 4, 20102010-11-04
A few times I have sent questions to different groups regarding
possibilities to simulate the amforth ( http://amforth.sf.net )
in different simulators (e.g. VMLAB, or the new simavr ).
Unfortunately I didn't succeed with it. I have even refreshed 
my Windows partition and installed AVR studio - but the simulation
was awfully slow.

Last time I have discovered, that the old simulavr simulator
is actively developed (even though the released versions are 
very old), and I've found a way to successfully simulate amforth in it.

To simulate amforth, you need a newest version from git repository:

git clone git://git.savannah.nongnu.org/simulavr.git

Then you should modify the src/python/pysimulavr.i and
examples/python/ex_utils.py files as described in
http://lists.nongnu.org/archive/html/simulavr-devel/2010-11/msg00001.html

and compile it:
./bootstrap
./configure --prefix=/your/install/directory --enable-python
make

To prepare amforth for simulation in simulavr one needs to convert
the hex files generated by avrasm2 into the elf format.
Assuming, that you've generated amforth from the template,
you can do it using the following commands:

srec_cat template.eep.hex -Intel \
 -fill 0xFF 0x00 -maximum-address template.eep.hex -Intel \
 -multiple  -Output eeprom.bin -Binary
srec_cat template.hex -Intel \
 -fill 0xFF 0x00 -maximum-address template.hex -Intel \
 -multiple  -Output code.bin -Binary
avr-objcopy --rename-section .data=.text,CONTENTS,ALLOC,LOAD,READONLY,CODE \
  --set-section-flags .eeprom=CONTENTS,ALLOC,LOAD,READONLY \
  --add-section .eeprom=eeprom.bin \
  --change-section-vma .eeprom=0x810000 \
  -I binary  code.bin  -O elf32-avr code.elf

Then you should copy the resulting code.elf file into 
the examples/python directory to the compiled simulavr.

The rest of the process (with necessary modifications of some 
simulavr files) is described here: 
http://lists.nongnu.org/archive/html/simulavr-devel/2010-11/msg00001.html
so I won't duplicate it.

The nice thing is that simulavr allows you to tightly interface your
simulated AVR with environment/testbench implemented in Python or Verilog
(I haven't tested yet the VPI functionality however).

I hope, that the above info may be usefull for someone
-- 
Regards,
Wojtek Zabolotny
wzb@ise.pw.edu.pl