/* ------------------------------ $Id: ssam.h,v 1.2 2006/02/02 16:35:11 marquet Exp $ ------------------------------------------------------------ First simulator of systems and architectures Philippe Marquet, Jan 2006 */ #ifndef _SSAM_H_ #define _SSAM_H_ /* Most of the int functions normally return 0, and return the value RETURN_FAILURE (usually -1) in case of error */ /* Initialization and finalization mandatory functions */ extern int ssam_init(unsigned int nb_comp); extern int ssam_exit(void); /* First of all, you need to declare a number of connections: - the connection name is used for tracing purpose - connection are typed Return a connection address, (void *) 0 in case of error */ enum ssam_cnct_type_e {SSAM_BOOL_T, SSAM_UINT_T, SSAM_DOUBLE_T}; typedef struct ssam_cnct_s ssam_cnct_t; extern ssam_cnct_t *ssam_create_connection(const char *name, enum ssam_cnct_type_e type); /* You may then create a number of components which are implemented by function that ssam_{read,write,wait} in an infinite loop: */ extern int ssam_create_component(void* (*component)(void*)); /* A component function may read and write via connections. Pval is the address of the value that will be read/written */ extern int ssam_read(ssam_cnct_t *cnct, void *pval); extern int ssam_write(ssam_cnct_t *cnct, void *pval); /* A component function may wait for the next clock tick, or for a given duration */ extern int ssam_wait(); extern int ssam_wait_duration(unsigned int duration); /* You can then launch the simulation for a given number of clock ticks (0 = infinite) */ int ssam_start(unsigned duration, const char *trace_filename); #endif