mirror of https://github.com/KLayout/klayout.git
Refined solution for issue-245 by providing a better name mapping (checked with ngspice)
This commit is contained in:
parent
9356f32026
commit
e545d6af3f
|
|
@ -246,12 +246,21 @@ std::string NetlistSpiceWriter::net_to_string (const db::Net *net) const
|
|||
|
||||
} else {
|
||||
|
||||
// Tested with ngspice: this tool likes in net names: . $ ! & \ # + : | (but not at beginning)
|
||||
// It does not like: , ;
|
||||
// We translate , to | for the net separator
|
||||
|
||||
std::string n = net->expanded_name ();
|
||||
std::string nn;
|
||||
nn.reserve (n.size ());
|
||||
nn.reserve (n.size () + 1);
|
||||
if (!isalnum (*n.c_str ())) {
|
||||
nn += "\\";
|
||||
}
|
||||
for (const char *cp = n.c_str (); *cp; ++cp) {
|
||||
if (isspace (*cp)) {
|
||||
nn += tl::sprintf ("$x%02x", (unsigned char) *cp);
|
||||
if (! isalnum (*cp) && strchr (".$!&\\#+:,", *cp) == 0) {
|
||||
nn += tl::sprintf ("\\x%02x", (unsigned char) *cp);
|
||||
} else if (*cp == ',') {
|
||||
nn += "|";
|
||||
} else {
|
||||
nn += *cp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ XSC1 n1 n2 C1
|
|||
* cell C1
|
||||
* pin p1
|
||||
* pin p2
|
||||
.SUBCKT C1 N1 N$x202
|
||||
.SUBCKT C1 N1 N\x202
|
||||
* device instance $1 0,0 XCLS
|
||||
XD_$1 N1 n3 XCLS PARAMS: U=-17 V=42
|
||||
* device instance $2 0,0 XCLS
|
||||
XD_$2 n3 N$x202 XCLS PARAMS: U=17 V=-42
|
||||
XD_$2 n3 N\x202 XCLS PARAMS: U=17 V=-42
|
||||
.ENDS C1
|
||||
|
|
|
|||
Loading…
Reference in New Issue