46 #include <Xyce_config.h>
52 #include <N_ERH_ErrorMgr.h>
53 #include <N_PDS_Comm.h>
54 #include <N_UTL_FeatureTest.h>
86 netlistLocation_(right.netlistLocation_),
135 std::vector<Param>::const_iterator it_pL, end_pL;
137 os <<
"Model Block" << std::endl;
138 os <<
"Model: " << mb.
name_ << std::endl;
139 os <<
" type: " << mb.
type_ << std::endl;
140 os <<
" Level: " << mb.
level_ << std::endl;
142 os <<
" Tagged Params" << std::endl;
143 os <<
" -------------" << std::endl;
147 for ( ; it_pL != end_pL; ++it_pL)
149 os << it_pL->tag() <<
"\t" << it_pL->stringValue() << std::endl;
152 os <<
" -------------" << std::endl;
204 std::vector<Param>::const_iterator it_tpL;
207 length =
name_.length();
208 byteCount +=
sizeof(int);
212 length =
type_.length();
213 byteCount +=
sizeof(int);
217 byteCount +=
sizeof(int);
221 byteCount +=
sizeof(int);
223 for (i = 0; i < size; ++i, ++it_tpL)
225 byteCount += it_tpL->packedByteCount();
230 byteCount +=
sizeof(int);
234 byteCount +=
sizeof(int);
253 std::vector<Param>::const_iterator it_tpL;
254 #ifdef Xyce_COUNT_PACKED_BYTES
259 length =
name_.length();
260 comm->pack(&length, 1, buf, bsize, pos );
261 comm->pack(
name_.c_str(), length, buf, bsize, pos );
264 length =
type_.length();
265 comm->pack(&length, 1, buf, bsize, pos );
266 comm->pack(
type_.c_str(), length, buf, bsize, pos );
269 comm->pack(&
level_, 1, buf, bsize, pos );
273 comm->pack(&size, 1, buf, bsize, pos );
275 for (i = 0; i < size; ++i, ++it_tpL)
277 it_tpL->pack( buf, bsize, pos, comm );
282 comm->pack(&length, 1, buf, bsize, pos );
283 comm->pack(
netlistLocation_.getFilename().c_str(), length, buf, bsize, pos );
287 comm->pack(&line_number, 1, buf, bsize, pos );
290 Xyce::dout() <<
"Packed " << pos <<
" bytes for ModelBlock: " <<
name_ << std::endl;
292 #ifdef Xyce_COUNT_PACKED_BYTES
293 if (pos != predictedPos)
295 DevelFatal(*
this,
"ModelBlock::pack") <<
"Predicted pos does not match actual pos";
316 comm->unpack( pB, bsize, pos, &length, 1 );
317 name_ = std::string( (pB+pos), length);
321 comm->unpack( pB, bsize, pos, &length, 1 );
322 type_ = std::string( (pB+pos), length);
326 comm->unpack( pB, bsize, pos, &
level_, 1 );
329 comm->unpack( pB, bsize, pos, &size, 1 );
332 for( i = 0; i < size; ++i )
334 dp.
unpack( pB, bsize, pos, comm );
339 comm->unpack( pB, bsize, pos, &length, 1 );
345 comm->unpack( pB, bsize, pos, &line_number, 1 );
349 Xyce::dout() <<
"Unpacked " << pos <<
" bytes for ModelBlock: " <<
name_ << std::endl;
385 : name_ (right.name_),
386 modelName_(right.modelName_),
387 iNumNodes (right.iNumNodes),
388 numIntVars(right.numIntVars),
389 numExtVars(right.numExtVars),
390 numStateVars(right.numStateVars),
391 modelFlag (right.modelFlag),
392 sourceFlag(right.sourceFlag),
393 bsourceFlag(right.bsourceFlag),
394 offFlag (right.offFlag),
396 netlistLocation_(right.netlistLocation_),
397 params (right.params)
478 std::vector<Param>::const_iterator it_tpL, end_tpL;
480 os <<
"Instance Block" << std::endl;
481 os <<
"Name: " << ib.
name_ << std::endl;
483 os <<
" # Nodes: " << ib.
iNumNodes << std::endl;
484 os <<
" # Int Vars: " << ib.
numIntVars << std::endl;
485 os <<
" # Ext Vars: " << ib.
numExtVars << std::endl;
486 os <<
" # State Vars: " << ib.
numStateVars << std::endl;
487 os <<
" modelFlag: " << ib.
modelFlag << std::endl;
488 os <<
" sourceFlag: " << ib.
sourceFlag << std::endl;
489 os <<
" bsourceFlag: " << ib.
bsourceFlag << std::endl;
490 os <<
" offFlag: " << ib.
offFlag << std::endl;
491 os <<
" off: " << ib.
off << std::endl;
493 os <<
" Tagged Params" << std::endl;
494 os <<
" -------------" << std::endl;
498 for ( ; it_tpL != end_tpL; ++it_tpL)
500 os << it_tpL->tag() <<
"\t" << it_tpL->stringValue() << std::endl;
503 os <<
" -------------" << std::endl;
536 std::vector<Param>::const_iterator it_tpL;
540 length = name.length();
541 byteCount +=
sizeof(int);
542 byteCount += length *
sizeof(char);
546 byteCount +=
sizeof(int);
547 byteCount += length *
sizeof(char);
551 byteCount +=
sizeof(int);
553 for (i = 0; i < size; ++i, ++it_tpL)
555 byteCount += it_tpL->packedByteCount();
559 byteCount +=
sizeof(int);
562 byteCount +=
sizeof(int);
565 byteCount +=
sizeof(int);
568 byteCount +=
sizeof(int);
571 byteCount +=
sizeof(int);
574 byteCount +=
sizeof(int);
577 byteCount +=
sizeof(int);
580 byteCount +=
sizeof(int);
583 byteCount +=
sizeof(int);
587 byteCount +=
sizeof(int);
588 byteCount += length *
sizeof(char);
591 byteCount +=
sizeof(int);
610 std::vector<Param>::const_iterator it_tpL;
611 #ifdef Xyce_COUNT_PACKED_BYTES
617 length = name.length();
618 comm->pack(&length, 1, buf, bsize, pos);
619 comm->pack(name.c_str(), length, buf, bsize, pos);
623 comm->pack(&length, 1, buf, bsize, pos );
624 comm->pack(
getModelName().c_str(), length, buf, bsize, pos );
628 comm->pack(&size, 1, buf, bsize, pos );
630 for (i = 0; i < size; ++i, ++it_tpL)
632 it_tpL->pack( buf, bsize, pos, comm );
636 comm->pack(&
iNumNodes, 1, buf, bsize, pos );
649 comm->pack(&i, 1, buf, bsize, pos );
653 comm->pack(&i, 1, buf, bsize, pos );
657 comm->pack(&i, 1, buf, bsize, pos );
661 comm->pack(&i, 1, buf, bsize, pos );
665 comm->pack(&i, 1, buf, bsize, pos );
669 comm->pack(&length, 1, buf, bsize, pos );
670 comm->pack(
netlistLocation_.getFilename().c_str(), length, buf, bsize, pos );
674 comm->pack(&line_number, 1, buf, bsize, pos );
677 Xyce::dout() <<
"Packed " << pos <<
" bytes for InstanceBlock: " <<
getInstanceName() << std::endl;
679 #ifdef Xyce_COUNT_PACKED_BYTES
680 if (pos != predictedPos)
682 DevelFatal(*
this,
"InstanceBlock::pack") <<
"Predicted pos does not match actual pos";
702 comm->unpack( pB, bsize, pos, &length, 1 );
707 comm->unpack( pB, bsize, pos, &length, 1 );
712 comm->unpack( pB, bsize, pos, &size, 1 );
715 for( i = 0; i < size; ++i )
717 dp.
unpack( pB, bsize, pos, comm );
722 comm->unpack( pB, bsize, pos, &
iNumNodes, 1 );
725 comm->unpack( pB, bsize, pos, &
numIntVars, 1 );
728 comm->unpack( pB, bsize, pos, &
numExtVars, 1 );
734 comm->unpack( pB, bsize, pos, &i, 1 );
738 comm->unpack( pB, bsize, pos, &i, 1 );
742 comm->unpack( pB, bsize, pos, &i, 1 );
746 comm->unpack( pB, bsize, pos, &i, 1 );
750 comm->unpack( pB, bsize, pos, &i, 1 );
754 comm->unpack( pB, bsize, pos, &length, 1 );
760 comm->unpack( pB, bsize, pos, &line_number, 1 );
764 Xyce::dout() <<
"Unpacked " << pos <<
" bytes for InstanceBlock: " <<
getInstanceName() << std::endl;
ModelBlock(const std::string &name="", const std::string &type="", int level=1)
void unpack(char *pB, int bsize, int &pos, N_PDS_Comm *comm)
Pure virtual class to augment a linear system.
Devices and models are each named.
const std::string & getEncodedName() const
Return the instance name encoded as: [s:]*xname [s:]*Ytype!name [s:]*Utype!name!count.
virtual void unpack(char *pB, int bsize, int &pos, N_PDS_Comm *comm)
void unpack(char *pB, int bsize, int &pos, N_PDS_Comm *comm)
NetlistLocation netlistLocation_
Path and line number of .MODEL command.
ModelName name_
Model name.
std::vector< Param > params
Parameters from the line.
InstanceBlock(const std::string &name=std::string())
Packable * instance() const
Packable * instance() const
ModelBlock & operator=(const ModelBlock &right)
void pack(char *buf, int bsize, int &pos, N_PDS_Comm *comm) const
std::string type_
Model type.
const ModelName & getModelName() const
const InstanceName & getInstanceName() const
int packedByteCount() const
InstanceName name_
Device instance name.
InstanceBlock & operator=(const InstanceBlock &right)
void pack(char *buf, int bsize, int &pos, N_PDS_Comm *comm) const
ModelBlock represents a .MODEL line from the netlist.
NetlistLocation netlistLocation_
Path and line number of .MODEL command.
InstanceBlock represent a device instance line from the netlist.
std::vector< Param > params
int packedByteCount() const
std::ostream & operator<<(std::ostream &os, const Configuration &configuration)
ModelName modelName_
Model name if provided.