46 #include <Xyce_config.h>
52 #include <N_ERH_ErrorMgr.h>
54 #include <N_PDS_Comm.h>
61 return instance_block.
getName().find_last_of(
":") != std::string::npos;
66 ? instance_block.
getName().substr(0, instance_block.
getName().find_last_of(
":"))
77 ? instance_block.
getName().substr(instance_block.
getName().find_last_of(
":") + 1, std::string::npos)
110 netlistFileName_(right.netlistFileName_),
111 lineNumber_(right.lineNumber_),
186 std::vector<Param>::const_iterator it_pL, end_pL;
188 os <<
"Model Block" << std::endl;
189 os <<
"Model: " << mb.
name << std::endl;
190 os <<
" type: " << mb.
type << std::endl;
191 os <<
" Level: " << mb.
level << std::endl;
193 os <<
" lineNumber_: " << mb.
lineNumber_ << std::endl;
194 os <<
" Tagged Params" << std::endl;
195 os <<
" -------------" << std::endl;
199 for ( ; it_pL != end_pL; ++it_pL)
201 os << it_pL->tag() <<
"\t" << it_pL->stringValue() << std::endl;
204 os <<
" -------------" << std::endl;
259 std::vector<Param>::const_iterator it_tpL;
262 length =
name.length();
263 byteCount +=
sizeof(int);
267 length =
type.length();
268 byteCount +=
sizeof(int);
272 byteCount +=
sizeof(int);
276 byteCount +=
sizeof(int);
278 for (i = 0; i < size; ++i, ++it_tpL)
280 byteCount += it_tpL->packedByteCount();
285 byteCount +=
sizeof(int);
289 byteCount +=
sizeof(int);
308 std::vector<Param>::const_iterator it_tpL;
309 #ifdef Xyce_COUNT_PACKED_BYTES
314 length =
name.length();
315 comm->pack(&length, 1, buf, bsize, pos );
316 comm->pack(
name.c_str(), length, buf, bsize, pos );
319 length =
type.length();
320 comm->pack(&length, 1, buf, bsize, pos );
321 comm->pack(
type.c_str(), length, buf, bsize, pos );
324 comm->pack(&
level, 1, buf, bsize, pos );
328 comm->pack(&size, 1, buf, bsize, pos );
330 for (i = 0; i < size; ++i, ++it_tpL)
332 it_tpL->pack( buf, bsize, pos, comm );
337 comm->pack(&length, 1, buf, bsize, pos );
343 #ifdef Xyce_DEBUG_TOPOLOGY
344 Xyce::dout() <<
"Packed " << pos <<
" bytes for ModelBlock: " <<
348 #ifdef Xyce_COUNT_PACKED_BYTES
349 if (pos != predictedPos)
351 DevelFatal(*
this,
"ModelBlock::pack") <<
"Predicted pos does not match actual pos";
372 comm->unpack( pB, bsize, pos, &length, 1 );
373 name = std::string( (pB+pos), length);
377 comm->unpack( pB, bsize, pos, &length, 1 );
378 type = std::string( (pB+pos), length);
382 comm->unpack( pB, bsize, pos, &
level, 1 );
385 comm->unpack( pB, bsize, pos, &size, 1 );
388 for( i = 0; i < size; ++i )
390 dp.
unpack( pB, bsize, pos, comm );
395 comm->unpack( pB, bsize, pos, &length, 1 );
402 #ifdef Xyce_DEBUG_TOPOLOGY
403 Xyce::dout() <<
"Unpacked " << pos <<
" bytes for ModelBlock: " <<
442 : name_ (right.name_),
443 modelName_(right.modelName_),
444 iNumNodes (right.iNumNodes),
445 numIntVars(right.numIntVars),
446 numExtVars(right.numExtVars),
447 numStateVars(right.numStateVars),
448 modelFlag (right.modelFlag),
449 sourceFlag(right.sourceFlag),
450 bsourceFlag(right.bsourceFlag),
451 offFlag (right.offFlag),
453 netlistFileName_ (right.netlistFileName_),
454 lineNumber_ (right.lineNumber_),
455 params (right.params)
562 std::vector<Param>::const_iterator it_tpL, end_tpL;
564 os <<
"Instance Block" << std::endl;
565 os <<
"Name: " << ib.
name_ << std::endl;
567 os <<
" # Nodes: " << ib.
iNumNodes << std::endl;
568 os <<
" # Int Vars: " << ib.
numIntVars << std::endl;
569 os <<
" # Ext Vars: " << ib.
numExtVars << std::endl;
570 os <<
" # State Vars: " << ib.
numStateVars << std::endl;
571 os <<
" modelFlag: " << ib.
modelFlag << std::endl;
572 os <<
" sourceFlag: " << ib.
sourceFlag << std::endl;
573 os <<
" bsourceFlag: " << ib.
bsourceFlag << std::endl;
574 os <<
" offFlag: " << ib.
offFlag << std::endl;
575 os <<
" off: " << ib.
off << std::endl;
577 os <<
" lineNumber_: " << ib.
lineNumber_ << std::endl;
578 os <<
" Tagged Params" << std::endl;
579 os <<
" -------------" << std::endl;
583 for ( ; it_tpL != end_tpL; ++it_tpL)
585 os << it_tpL->tag() <<
"\t" << it_tpL->stringValue() << std::endl;
588 os <<
" -------------" << std::endl;
621 std::vector<Param>::const_iterator it_tpL;
625 byteCount +=
sizeof(int);
626 byteCount += length *
sizeof(char);
630 byteCount +=
sizeof(int);
631 byteCount += length *
sizeof(char);
635 byteCount +=
sizeof(int);
637 for (i = 0; i < size; ++i, ++it_tpL)
639 byteCount += it_tpL->packedByteCount();
643 byteCount +=
sizeof(int);
646 byteCount +=
sizeof(int);
649 byteCount +=
sizeof(int);
652 byteCount +=
sizeof(int);
655 byteCount +=
sizeof(int);
658 byteCount +=
sizeof(int);
661 byteCount +=
sizeof(int);
664 byteCount +=
sizeof(int);
667 byteCount +=
sizeof(int);
671 byteCount +=
sizeof(int);
672 byteCount += length *
sizeof(char);
675 byteCount +=
sizeof(int);
694 std::vector<Param>::const_iterator it_tpL;
695 #ifdef Xyce_COUNT_PACKED_BYTES
701 comm->pack(&length, 1, buf, bsize, pos );
702 comm->pack(
name_.c_str(), length, buf, bsize, pos );
706 comm->pack(&length, 1, buf, bsize, pos );
707 comm->pack(
getModelName().c_str(), length, buf, bsize, pos );
711 comm->pack(&size, 1, buf, bsize, pos );
713 for (i = 0; i < size; ++i, ++it_tpL)
715 it_tpL->pack( buf, bsize, pos, comm );
719 comm->pack(&
iNumNodes, 1, buf, bsize, pos );
732 comm->pack(&i, 1, buf, bsize, pos );
736 comm->pack(&i, 1, buf, bsize, pos );
740 comm->pack(&i, 1, buf, bsize, pos );
744 comm->pack(&i, 1, buf, bsize, pos );
748 comm->pack(&i, 1, buf, bsize, pos );
752 comm->pack(&length, 1, buf, bsize, pos );
758 #ifdef Xyce_DEBUG_TOPOLOGY
759 Xyce::dout() <<
"Packed " << pos <<
" bytes for InstanceBlock: " <<
762 #ifdef Xyce_COUNT_PACKED_BYTES
763 if (pos != predictedPos)
765 DevelFatal(*
this,
"InstanceBlock::pack") <<
"Predicted pos does not match actual pos";
785 comm->unpack( pB, bsize, pos, &length, 1 );
786 name_ = std::string( (pB+pos), length);
790 comm->unpack( pB, bsize, pos, &length, 1 );
795 comm->unpack( pB, bsize, pos, &size, 1 );
798 for( i = 0; i < size; ++i )
800 dp.
unpack( pB, bsize, pos, comm );
805 comm->unpack( pB, bsize, pos, &
iNumNodes, 1 );
808 comm->unpack( pB, bsize, pos, &
numIntVars, 1 );
811 comm->unpack( pB, bsize, pos, &
numExtVars, 1 );
817 comm->unpack( pB, bsize, pos, &i, 1 );
821 comm->unpack( pB, bsize, pos, &i, 1 );
825 comm->unpack( pB, bsize, pos, &i, 1 );
829 comm->unpack( pB, bsize, pos, &i, 1 );
833 comm->unpack( pB, bsize, pos, &i, 1 );
837 comm->unpack( pB, bsize, pos, &length, 1 );
844 #ifdef Xyce_DEBUG_TOPOLOGY
845 Xyce::dout() <<
"Unpacked " << pos <<
" bytes for InstanceBlock: " <<