//===================================================== file = csim_ex3.c ===== //= Demonstration of CSIM processes and events = //============================================================================= //= Notes: This program does nothing useful. = //=---------------------------------------------------------------------------= //= Build: Standard CSIM build = //=---------------------------------------------------------------------------= //= History: KJC (03/05/05) - Genesis = //============================================================================= //----- Include files --------------------------------------------------------- #include // Needed for printf() #include "csim.h" // Needed for CSIM stuff //----- Function prototypes --------------------------------------------------- void proc1(void); // Process #1 //----- Globals --------------------------------------------------------------- EVENT Sync_event; // Done event //===== Main program ========================================================== void sim(void) { create("sim"); Sync_event = event("synchronize event"); printf("BEGIN at clock = %f \n", clock); proc1(); do { hold(1.00); printf("(1) at %f \n", clock); set(Sync_event); } while (clock < 5.0); printf("END at clock = %f \n", clock); } void proc1(void) { create("process #1"); while(1) { printf("(2) at %f \n", clock); wait(Sync_event); } }