X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fvisitor%2FsystemC%2Flib%2Fdol.h;fp=dol%2Fsrc%2Fdol%2Fvisitor%2FsystemC%2Flib%2Fdol.h;h=282bc4d9ed56cf9371a67544ac0c8b44455e2e80;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/visitor/systemC/lib/dol.h b/dol/src/dol/visitor/systemC/lib/dol.h new file mode 100644 index 0000000..282bc4d --- /dev/null +++ b/dol/src/dol/visitor/systemC/lib/dol.h @@ -0,0 +1,77 @@ +#ifndef DOL_H +#define DOL_H + +#include +#include +#include +#include + +/************************************************************************ + * do not add code to this header + ************************************************************************/ + +/** + * - Local variables for each process can be defined in the structure + * LocalState. For each process, a new instance of LocalState is + * instantiated. + * - The ProcessInit function pointer points to the function which is + * called to initialize a process. + * - The ProcessFire function pointer points to the function which is + * called repeatedly by the scheduler. + * - The wptr is a placeholder for callback. A pointer to the wrapper + * class instance of the process can be assigned. This is done in the + * code generated by the code generation, so one can just leave it + * blank. + */ + +//structure for local memory of process +typedef struct _local_states *LocalState; + +//additional behavioral functions could be declared here +typedef void (*ProcessInit)(struct _process*); +typedef int (*ProcessFire)(struct _process*); +typedef void *WPTR; + +//process handler +struct _process; + +typedef struct _process { + LocalState local; + ProcessInit init; + ProcessFire fire; + WPTR wptr; //placeholder for wrapper instance +} DOLProcess; + + +//macros to deal with iterated ports + +/** + * macro to create a variable to store a port name + * + * @param name name of the variable + */ +#define MAX_PORT_NAME_LENGTH 255 +#define CREATEPORTVAR(name) char name[MAX_PORT_NAME_LENGTH] + + +/** + * Create the port name of an iterated port based on its basename and the + * given indices. + * + * @param port buffer where the result is stored (created using + * CREATEPORTVAR) + * @param base basename of the port + * @param number_of_indices number of dimensions of the port + * @param index_range_pairs index and range values for each dimension + */ +#define CREATEPORT(port, base, number_of_indices, indices...) \ + createPort(port, base, number_of_indices, indices) + +char* createPort(char* port, + char* base, + int number_of_indices, + int indices, ...); + +int getIndex(const char* string, char* tokens, int indexNumber); + +#endif