/***************************************************************************** * file: tfsetup.c * * Purpose: * * This file creates the Divide-by-8 counter State Model completely. */ #include #include "olc96fa.h" /* OLC Fall Semester 96 schema input file */ #include "olc3common.h" #include "activeclass.h" #include "activeinstance.h" #include "eventinstance.h" #include "statemodel.h" #include "processevent.h" /* ** Toggle FlipFlop (TF) SetUp and Action routines */ PROTOTYPE(extern void TFsetup, (void)) PROTOTYPE(extern void TFAction0, (hcg_key EIid)) PROTOTYPE(extern void TFAction1, (hcg_key EIid)) PROTOTYPE(extern void PCAction0, (hcg_key EIid)) PROTOTYPE(extern void PCAction1, (hcg_key EIid)) extern void TFFCreate(hcg_key, hcg_key, hcg_key, char *, int); /* */ /*======================================================================== * Function Name: TFsetup * * Description: This function creates the divide-by-8 State * Model Completely. An Active Class (AC) and * Active Instance(s) (AI) of the counter are * created. */ FUNCTION( void TFsetup ) { static EventTypeList TFEventTypes[] = { {"T", "Toggle"}} ; static StateList TFStates[] = { {"TFS1", "OFF", TFAction1}, {"TFS0", "ON", TFAction0}}; static StateTransitionList TFTransitions[] = { {"TFS0", "TFS1", "T"}, {"TFS1", "TFS0", "T"}}; hcg_key TFSMid; hcg_key TFACid; hcg_key TFAIid1 ; hcg_key TFAIid2 ; hcg_key TFAIid3 ; TFSMid = StateModelCreateCompletely("Divide-by-8 State Machine", "TF", ARRAY_SIZE(TFEventTypes), TFEventTypes, ARRAY_SIZE(TFStates), TFStates, ARRAY_SIZE(TFTransitions), TFTransitions); TFACid = ActiveClassCreate("Counter Active Class", TFSMid); TFAIid1 = ActiveInstanceCreate("AI1", TFACid, "TFS0"); TFAIid2 = ActiveInstanceCreate("AI2", TFACid, "TFS0"); TFAIid3 = ActiveInstanceCreate("AI3", TFACid, "TFS0"); TFFCreate(TFAIid1,TFAIid1,TFAIid2,"T",1); TFFCreate(TFAIid2,TFAIid2,TFAIid3,"T",2); TFFCreate(TFAIid3,TFAIid3,TFAIid3,"T",4); }