/*$Id: u_sdp.h,v 26.9 2006/12/04 05:18:09 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. *------------------------------------------------------------------ * A class for Size Dependent Parameters, like those used in Spice BSIM models * A single read gets the nominal, and length and width dependencies. * A single print prints them all. * operator() returns the value to use, adjusted for L and W. */ //testing=script 2006.07.14 #ifndef U_SDP_H #define U_SDP_H #include "ap.h" #include "u_parameter.h" /*--------------------------------------------------------------------------*/ class OMSTREAM; class CARD_LIST; /*--------------------------------------------------------------------------*/ class SDP { friend bool get(CS& cmd, const std::string& key, SDP* value); private: PARAMETER _nom; // nominal value PARAMETER _ld; // length dependency PARAMETER _wd; // width dependency PARAMETER _pd; // cross-term dependency (p is for product) explicit SDP() {unreachable();} public: explicit SDP(const SDP& p) :_nom(p._nom),_ld(p._ld),_wd(p._wd),_pd(p._pd) {} ~SDP() {} explicit SDP(double Nom) :_nom(Nom), _ld(0.), _wd(0.), _pd(0.) {} void print(OMSTREAM& o, LANGUAGE, const std::string& name)const; double operator()(double L,double W,double def,const CARD_LIST* scope)const { return _nom.e_val(def,scope) + _ld.e_val(0.,scope)/L + _wd.e_val(0.,scope)/W + _pd.e_val(0.,scope)/(W*L); } double nom()const {return _nom;} void set_nom(double n) {untested();_nom = n;} bool has_hard_value()const {return _nom.has_hard_value();} bool has_good_value()const {return _nom.has_good_value();} }; /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/ #endif