/*------------------------------------------------------------------*/ /* circuit.h */ /*------------------------------------------------------------------*/ #ifndef CIRCUIT_INCLUDED #define CIRCUIT_INCLUDED #include "expr.h" enum SymbolType {SYMBOL_FLIPFLOP, SYMBOL_INPUT, SYMBOL_UNKNOWN}; /* These functions are called by Parser: */ int Circuit_declareInput(const char *pcName); /* If pcName was declared previously as a Circuit input name or as a Circuit flip flop name, then return 0 (FALSE). Otherwise, store a copy of pcName as a Circuit input name and return 1 (TRUE). It is a checked runtime error for the Circuit to be uninitialized. It is a checked runtime error for pcName to be NULL. */ int Circuit_declareFlipFlop(const char *pcName); /* If pcName was declared previously as a Circuit flip flop name or as a Circuit input, then return 0 (FALSE). Otherwise, store a copy of pcName as a Circuit flip flop name, and return 1 (TRUE). It is a checked runtime error for the Circuit to be uninitialized. It is a checked runtime error for pcName to be NULL. */ enum SymbolType Circuit_getSymbolType(const char *pcName); /* Return SYMBOL_FLIPFLOP if pcName is the name of a Circuit flip flop, SYMBOL_INPUT if pcName is the name of a Circuit input, or SYMBOL_UNKNOWN if pcName the name of neither a Circuit flip flop nor a Circuit input. It is a checked runtime error for the Circuit to be uninitialized. It is a checked runtime error for pcName to be NULL. */ int Circuit_getFlipFlopIndex(const char *pcName); /* Return the (zero-based) index of the Circuit flip flop whose name is pcName, or -1 if there is no such Circuit flip flop. It is a checked runtime error for the Circuit to be uninitialized. It is a checked runtime error for pcName to be NULL. */ int Circuit_getInputIndex(const char *pcName); /* Return the (zero-based) index of the Circuit input whose name is pcName, or -1 if there is no such Circuit input. It is a checked runtime error for the Circuit to be uninitialized. It is a checked runtime error for pcName to be NULL. */ int Circuit_defineFlipFlop(int iIndex, Expr_T oExpr); /* If the Circuit flip flop whose index is iIndex is already defined, then return 0 (FALSE). Otherwise, record oExpr as the definition of the Circuit flip flop whose index is iIndex, and return 1 (TRUE). It is a checked runtime error for the Circuit to be uninitialized. It is a checked runtime error for iIndex to be negative or for oExpr to be NULL. */ const char *Circuit_findUndefinedFlipFlop(void); /* Return the name of the first declared Circuit flip flop that has not been defined, or NULL if there is no undefined Circuit flip flop. It is a checked runtime error for the Circuit to be uninitialized. */ void Circuit_complete(void); /* The Parser is finished parsing the Circuit description, so do whatever (if any) work is required to complete the Circuit internal form. It is a checked runtime error for the Circuit to be uninitialized. */ /* These functions are called by the main module: */ /* You should determine. */ /* These functions are called by Simulator: */ /* You should determine. */ #endif