Using krun with the SF simulator
[090300/noe]
SF is a functional simulator of APEmille, which uses binary assembly
files (.basm). Therefore, it can be used to simulate and to verify
the correctness of assembly code (i.e. before microcode generations).
The simulator is executed by the OS krun when passing instead of an
executable (.jex) file a binary assembly file (.basm).
One can simulate a .basm file by simply passing it as arguments to
'krun', e.g.
krun myprog.basm (extension .basm is mandatory)
The default topology of the simulated machine is 2 x 2 x 2,
and the available data memory is less than on the real hardware.
Remarks:
In order to obtain bit-identical results with HW runs, it is
necessary to:
1) execute SF with the simulation of the exact FILU model enabled
2) run on the HW an executable file, which has been generated without
enabled optimization of NORMAL operations (e.g. "psk -n").
SF does NOT implement user-defined remote communications (e.g.
when using TAO constructs like "set remote mycomm = [1,2,3])
and does not model the status and exception registers of the HW.
Exceptions and Warnings of SF:
SF is a development tool for debugging of system softare and
hardware of APEmille. Therefore, SF writes lots of diagnostics
output to STDERR, like
"Using Extended Jane Register File"
or
"ignoring PRAGMA_JMAXPHYS"
which is completely irrelevant for "normal" users.
In addition, SF may die with exceptions, like
EXCEPTION:Attempt to access a not initialized Tarzan Data Memory ...
EXCEPTION:Attempt to access a not initialized Jane Data Memory ...
Usually, such exceptions do NOT mean that the program would fail to
run correctly on the real hardware (at least after initialization of
all memories). However, such exceptions can be helpful for debugging
purposes (of the user program OR of the compiler). In order to disable
such exceptions, set the environment variable SF_NO_CHECK_MEM_INIT (see
also below).
Environment variables that affect the sf simulator.
Name Type Description
------------------------------------------------------------------------
SF_MASK_EXC bool Do not die on exceptions.
SF_NO_CHECK_MEM_INIT bool Do not check if accessed memory is initialized.
On the HW, acesses to uninitialized memory
may cause EDAC exceptions after power-up,
thus SF by default reports this as an exception.
SF_USE_FILU bool Use the exact hardware model (FILU) for
floating-point arithmetics to produce
bit-identical results to HW runs. Slows
down the simlation.
SF_VERBOSE_ALLOC bool Report verbosely the allocated memory.
SF_VERBOSE_LOAD bool Dump the basm records while loading.
SF_JANE_DM_SIZE int Size of the Jane Data Memory (in words)
Default: 500k (= 1/16 real size)
SF_JANE_RF_SIZE int Size of the Jane Register File (in words)
Note: on the basm level, jane registers are
virtual, i.e. a basm file may use an arbitrary
number of jane registers. SF copes with that
by supplying more registers than the hardware
has.
Default: 16384 (= 32 x real number)
SF_MAP_JREG bool Map all Jane registers to low numbers in
case that some tool uses few registers but
with high numbers.
SF_PROGMEM_SIZE int Size of the program memory (in instructions)
Default: 100000
SF_TZ_DM_SIZE int Size of the Tarzan Data Memory (in words).
Default: 128k (= real size)
SF_TZ_RF_SIZE int Size of the Tarzan Register File (in words).
Usually, Tz registers are NOT virtual, but
this option may be helpful for debugging.
Remarks:
Some versions of krun propagate the '-G' option to SF and thus can
simulate other geometries than 2x2x2.
Older versions of krun are linked against an SF version that can
handle only .basm files of format version 1. More recent ones can
handle both version 1 and 2. Use the 'file' command to determine
the version of your file. Use 'basmconv' if necessary to convert
back to format version 1 (in case your preferred krun complains
about unknown opcodes in the program).