00001 00024 #ifndef _BASE_LOGIC_GATE_H_ 00025 #define _BASE_LOGIC_GATE_H_ 00026 00027 #include <string> 00028 00029 #include "comDefs.h" 00030 #include "logicDefs.h" 00031 00032 class BaseLogicGate { 00033 static const SimTime MIN_DELAY = 1l; 00034 00035 private: 00037 SimTime delay; 00038 00039 public: 00040 BaseLogicGate (const SimTime& delay) { 00041 setDelay (delay); 00042 } 00043 00044 BaseLogicGate (const BaseLogicGate& that) { 00045 setDelay (delay); 00046 } 00047 00053 const SimTime& getDelay() const { 00054 return delay; 00055 } 00056 00062 void setDelay(const SimTime& delay) { 00063 this->delay = delay; 00064 if (this->delay <= 0) { 00065 this->delay = MIN_DELAY; 00066 } 00067 } 00068 00074 virtual LogicVal evalOutput() const = 0; 00075 00080 virtual bool hasInputName(const std::string& net) const = 0; 00081 00086 virtual bool hasOutputName(const std::string& net) const = 0; 00087 00093 virtual const std::string& getOutputName() const = 0; 00094 }; 00095 00096 #endif