3 * (c)2010 felix salfelder
15 #include "d_rcd_sym.h"
17 /*--------------------------------------------------------------------------*/
18 double MODEL_BUILT_IN_RCD_SYM::P( const COMPONENT
* brh
) const
20 const DEV_BUILT_IN_RCD
* c
= prechecked_cast
<const DEV_BUILT_IN_RCD
*>(brh
);
21 const COMMON_BUILT_IN_RCD
* cc
= prechecked_cast
<const COMMON_BUILT_IN_RCD
*>(c
->common());
22 if (_sim
->analysis_is_tt()) { untested();
23 return (cc
->_zero
+ c
->_Ccgfill
->tt()) * cc
->_weight
* cc
->_wcorr
; // shifted
25 assert(is_number( c
->_Ccgfill
->tt() * cc
->_weight
* cc
->_wcorr
));
26 // return c->_Ccgfill->tt() * cc->_weight * cc->_wcorr;
28 return double((c
->_tr_fill
+ c
->_Ccgfill
->tt() + cc
->_zero
) * cc
->_weight
* cc
->_wcorr
); // shifted
31 /*--------------------------------------------------------------------------*/
32 void MODEL_BUILT_IN_RCD_SYM::do_stress_apply( COMPONENT
* ) const
34 if (!_sim
->analysis_is_tt()){
38 /*--------------------------------------------------------------------------*/
39 void DEV_BUILT_IN_RCD_SYM::tr_stress()
42 const COMMON_BUILT_IN_RCD
* c
= static_cast<const COMMON_BUILT_IN_RCD
*>(common());
45 const MODEL_BUILT_IN_RCD
* m
= prechecked_cast
<const MODEL_BUILT_IN_RCD
*>(c
->model());
50 unreachable(); //obsolete.
53 ///*--------------------------------------------------------------------------*/
54 namespace MODEL_BUILT_IN_RCD_DISPATCHER
{
55 static DEV_BUILT_IN_RCD_SYM p2d
;
56 static MODEL_BUILT_IN_RCD_SYM
p2(&p2d
);
57 static DISPATCHER
<MODEL_CARD
>::INSTALL
58 d2(&model_dispatcher
, "rcdsym_base", &p2
);
60 ///*--------------------------------------------------------------------------*/
61 void MODEL_BUILT_IN_RCD_SYM::do_expand( COMPONENT
* ) const
64 /*--------------------------------------------------------------------------*/
65 std::string
MODEL_BUILT_IN_RCD_SYM::dev_type()const
69 /*--------------------------------------------------------------------------*/
70 MODEL_BUILT_IN_RCD_SYM::MODEL_BUILT_IN_RCD_SYM(const BASE_SUBCKT
* p
)
71 : MODEL_BUILT_IN_RCD(p
){ }
72 /*--------------------------------------------------------------------------*/
73 MODEL_BUILT_IN_RCD_SYM::MODEL_BUILT_IN_RCD_SYM(const MODEL_BUILT_IN_RCD_SYM
& p
)
74 : MODEL_BUILT_IN_RCD(p
){ }
75 /*--------------------------------------------------------------------------*/
76 void DEV_BUILT_IN_RCD_SYM::expand() {
79 const COMMON_BUILT_IN_RCD
* c
= static_cast<const COMMON_BUILT_IN_RCD
*>(common());
82 const MODEL_BUILT_IN_RCD
* m
= prechecked_cast
<const MODEL_BUILT_IN_RCD
*>(c
->model());
85 const SDP_BUILT_IN_RCD
* s
= prechecked_cast
<const SDP_BUILT_IN_RCD
*>(c
->sdp());
88 trace0("DEV_BUILT_IN_RCD_SYM::expand()");
90 if (_sim
->is_first_expand()) {
94 //assert(!(_n[n_ic].n_()));
95 //BUG// this assert fails on a repeat elaboration after a change.
96 //not sure of consequences when new_model_node called twice.
98 if (!(_n
[n_ic
].n_())) {
102 _n
[n_ic
].new_model_node("." + long_label() + ".ic", this);
106 assert(_n
[n_ic
] == _n
[n_b
]);
108 //_n[n_ic].new_model_node("ic." + long_label(), this);
114 /*--------------------------------------------------------------------------*/
115 void MODEL_BUILT_IN_RCD_SYM::do_tr_stress( const COMPONENT
*) const
117 assert(false); // use DEV::tr_stress
119 /*--------------------------------------------------------------------------*/
120 void MODEL_BUILT_IN_RCD_SYM::do_tt_prepare( COMPONENT
* brh
) const
122 const DEV_BUILT_IN_RCD
* c
= prechecked_cast
<const DEV_BUILT_IN_RCD
*>(brh
);
123 const COMMON_BUILT_IN_RCD
* cc
= prechecked_cast
<const COMMON_BUILT_IN_RCD
*>(c
->common());
124 assert(is_number(cc
->_zero
));
126 trace7( "MODEL_BUILT_IN_RCD_SYM_V2::do_tt_prepare", brh
->short_label(),
127 -cc
->_wcorr
, cc
->_zero
, c
->_Ccgfill
->tt(), hp(c
->_Ccgfill
), c
->_Ccgfill
->m_(), _sim
->_adp_nodes
);
130 assert(is_number(cc
->_zero
));
131 assert(is_number(c
->_Ccgfill
->tt()));
132 assert(c
->_Ccgfill
->tt() == 0); //shifted
136 /*--------------------------------------------------------------------------*/
137 DEV_BUILT_IN_RCD_SYM::DEV_BUILT_IN_RCD_SYM()
141 // attach_common(&Default_BUILT_IN_RCD);
146 /*--------------------------------------------------------------------------*/
147 int MODEL_BUILT_IN_RCD_SYM::tt_region(const COMPONENT
* brh
) const
149 const DEV_BUILT_IN_RCD
* c
= (const DEV_BUILT_IN_RCD
*) brh
;
152 return ( (c
->_Ccgfill
)->region() );
154 /*--------------------------------------------------------------------------*/
155 //double MODEL_BUILT_IN_RCD_SYM::__Edu(double s, const COMMON_COMPONENT* c ) const
157 // const COMMON_BUILT_IN_RCD* cc = dynamic_cast<const COMMON_BUILT_IN_RCD*>(c) ;
158 // double te = __Re( s, cc);
159 // double tc = __Rc( s, cc);
160 // double dte = __dRe( s, cc);
161 // double dtc = __dRc( s, cc);
162 // double ret = (dtc * ( te + tc ) - ( dte + dtc ) * tc) / ( dte + dtc ) / ( dte + dtc ) ;
163 // assert(is_number(ret));
166 /*--------------------------------------------------------------------------*/
167 /*--------------------------------------------------------------------------*/
168 //ADP_NODE_RCD* MODEL_BUILT_IN_RCD_SYM::new_adp_node(const COMPONENT* c) const{
169 // return new ADP_NODE_RCD(c);