/*$Id: bm_generator.cc,v 26.14 2007/02/07 09:06:48 al Exp $ -*- C++ -*- * Copyright (C) 2001 Albert Davis * Author: Albert Davis * * This file is part of "Gnucap", the Gnu Circuit Analysis Package * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. *------------------------------------------------------------------ * behavioral modeling simple value * used with tc, etc, and conditionals */ //testing=script,complete 2005.10.06 #include "l_dispatcher.h" #include "e_elemnt.h" #include "bm.h" extern DISPATCHER bm_dispatcher; /*--------------------------------------------------------------------------*/ namespace { /*--------------------------------------------------------------------------*/ class EVAL_BM_GENERATOR : public EVAL_BM_ACTION_BASE { private: explicit EVAL_BM_GENERATOR(const EVAL_BM_GENERATOR& p); public: explicit EVAL_BM_GENERATOR(int c=0); ~EVAL_BM_GENERATOR() {} private: // override virtual bool operator==(const COMMON_COMPONENT&)const; COMMON_COMPONENT* clone()const {return new EVAL_BM_GENERATOR(*this);} //void parse(CS&); //COMPONENT_COMMON void print(OMSTREAM&, LANGUAGE)const; //void elabo3(const COMPONENT*); //EVAL_BM_ACTION_BASE //COMMON_COMPONENT* deflate(); //COMPONENT_COMMON/nothing void tr_eval(ELEMENT*)const; void ac_eval(ELEMENT*)const; //bool has_tr_eval()const; //EVAL_BM_BASE/true //bool has_ac_eval()const; //EVAL_BM_BASE/true const char* name()const {return "GENERATOR";} bool ac_too()const {return true;} bool parse_numlist(CS&); //bool parse_params(CS&); //EVAL_BM_ACTION_BASE }; /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/ EVAL_BM_GENERATOR::EVAL_BM_GENERATOR(int c) :EVAL_BM_ACTION_BASE(c) { } /*--------------------------------------------------------------------------*/ EVAL_BM_GENERATOR::EVAL_BM_GENERATOR(const EVAL_BM_GENERATOR& p) :EVAL_BM_ACTION_BASE(p) { } /*--------------------------------------------------------------------------*/ bool EVAL_BM_GENERATOR::operator==(const COMMON_COMPONENT& x)const { const EVAL_BM_GENERATOR* p = dynamic_cast(&x); bool rv = p && EVAL_BM_ACTION_BASE::operator==(x); if (rv) { incomplete(); untested(); } return rv; } /*--------------------------------------------------------------------------*/ void EVAL_BM_GENERATOR::print(OMSTREAM& o, LANGUAGE lang)const { assert(lang == lSPICE || lang == lVERILOG); o << name(); EVAL_BM_ACTION_BASE::print(o, lang); } /*--------------------------------------------------------------------------*/ void EVAL_BM_GENERATOR::tr_eval(ELEMENT* d)const { tr_finish_tdv(d, SIM::genout); } /*--------------------------------------------------------------------------*/ void EVAL_BM_GENERATOR::ac_eval(ELEMENT* d)const { d->_ev = 1; ac_final_adjust_with_temp(&(d->_ev)); } /*--------------------------------------------------------------------------*/ bool EVAL_BM_GENERATOR::parse_numlist(CS& cmd) { int here = cmd.cursor(); PARAMETER new_value(NOT_VALID); cmd >> new_value; if (cmd.gotit(here)) { _scale = new_value; return true; }else{ return false; } } /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/ EVAL_BM_GENERATOR p1(CC_STATIC); DISPATCHER::INSTALL d1(&bm_dispatcher, "gen,generator", &p1); } /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/