Line 597... |
Line 597... |
library, the flag, @code{-lsim} should be added to the link command.
|
library, the flag, @code{-lsim} should be added to the link command.
|
|
|
The header file @file{or1ksim.h} contains appropriate declarations of
|
The header file @file{or1ksim.h} contains appropriate declarations of
|
the functions exported by the @value{OR1KSIM} library. These are:
|
the functions exported by the @value{OR1KSIM} library. These are:
|
|
|
@deftypefn {@file{or1ksim.h}} int or1ksim_init (const char *@var{config_file}, const char *@var{image_file}, void *@var{class_ptr}, unsigned long int (*@var{upr})(void *@var{class_ptr}, unsigned long int @var{addr}, unsigned long int @var{mask}), void (*@var{upw})(void *@var{class_ptr}, unsigned long int @var{addr}, unsigned long int @var{mask}, unsigned long int @var{wdata}))
|
@deftypefn {@file{or1ksim.h}} int or1ksim_init (const char
|
|
*@var{config_file}, const char *@var{image_file}, void *@var{class_ptr},
|
|
int (*@var{upr})(void *@var{class_ptr}, unsigned long int @var{addr},
|
|
unsigned char @var{mask}[], unsigned char @var{rdata}[], int
|
|
@var{data_len}), int (*@var{upw})(void *@var{class_ptr}, unsigned long
|
|
int @var{addr}, unsigned char @var{mask}[], unsigned char @var{wdata}[],
|
|
int @var{data_len}))
|
|
|
The initialization function is supplied with the name of a
|
The initialization function is supplied with the name of a
|
configuration file, @var{config_file}, an executable image, @var{image_file}, a pointer to the calling
|
configuration file, @var{config_file}, an executable image, @var{image_file}, a pointer to the calling
|
class, @var{class_ptr} (since the library may be used from C++) and
|
class, @var{class_ptr} (since the library may be used from C++) and
|
two up-call functions, one for reads, @var{upr}, and one for writes,
|
two up-call functions, one for reads, @var{upr}, and one for writes,
|
Line 613... |
Line 619... |
@var{upw} is called for any write to an address external to the model
|
@var{upw} is called for any write to an address external to the model
|
(determined by a @code{generic} section in the configuration
|
(determined by a @code{generic} section in the configuration
|
file). @var{upr} is called for any reads to an external address. The
|
file). @var{upr} is called for any reads to an external address. The
|
@var{class_ptr} is passed back with these upcalls, allowing the
|
@var{class_ptr} is passed back with these upcalls, allowing the
|
function to associate the call with the class which originally
|
function to associate the call with the class which originally
|
initialized the library.
|
initialized the library. Both @var{upw} and @var{upr} should return
|
|
zero on success and non-zero otherwise. At the present time the meaning
|
|
of non-zero values is not defined but this may change in the future.
|
|
|
@var{mask} indicates which bytes in the word are to be written or
|
@var{mask} indicates which bytes in the data are to be written or
|
read. Bytes to be read/written should have 0xff set in
|
read. Bytes to be read/written should have 0xff set in
|
@var{mask}. Otherwise the byte should be zero.
|
@var{mask}. Otherwise the byte should be zero. The adddress,
|
|
@var{addr}, is the @emph{full} address, since the upcall function must
|
@var{addr}, @var{mask}, @var{wdata} and the result from @var{upr} all
|
handle all generic devices, using the full address for decoding.
|
use host-endianess, @emph{not} model-endianess. The internal
|
|
@value{OR1KSIM} routines manage all the conversion.
|
Endianness is not completely transparent, since @value{OR1KSIM} is
|
|
transferring byte vectors, not multi-byte values.
|
|
|
|
@quotation Caution
|
|
This is a change from version 0.3.0. It simplifies the interface, and
|
|
makes @value{OR1KSIM} more consistent with payload representation in
|
|
SystemC TLM 2.0.
|
|
@end quotation
|
|
|
|
@quotation Note
|
|
The current implementation of Or1ksim always transfers single words (4
|
|
bytes), using masks if smaller values are required. In this it mimcs the
|
|
behavior of the WishBone bus.
|
|
@end quotation
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@deftypefn {@file{or1ksim.h}} int or1ksim_run (double @var{duration})
|
@deftypefn {@file{or1ksim.h}} int or1ksim_run (double @var{duration})
|
|
|