mirror of https://github.com/KLayout/klayout.git
Modified display of devices in LVS xref view, so the primary and secondary parameters are separated
This commit is contained in:
parent
f2172d8e2a
commit
5cd1c187ab
|
|
@ -237,7 +237,9 @@ static
|
||||||
std::string formatted_value (double v)
|
std::string formatted_value (double v)
|
||||||
{
|
{
|
||||||
double va = fabs (v);
|
double va = fabs (v);
|
||||||
if (va < 100e-15) {
|
if (va < 1e-20) {
|
||||||
|
return "0";
|
||||||
|
} else if (va < 100e-15) {
|
||||||
return tl::to_string (v * 1e15) + "f";
|
return tl::to_string (v * 1e15) + "f";
|
||||||
} else if (va < 100e-12) {
|
} else if (va < 100e-12) {
|
||||||
return tl::to_string (v * 1e12) + "p";
|
return tl::to_string (v * 1e12) + "p";
|
||||||
|
|
@ -269,25 +271,50 @@ std::string device_parameter_string (const db::Device *device)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
std::string term;
|
||||||
|
|
||||||
const std::vector<db::DeviceParameterDefinition> &pd = device->device_class ()->parameter_definitions ();
|
const std::vector<db::DeviceParameterDefinition> &pd = device->device_class ()->parameter_definitions ();
|
||||||
|
|
||||||
for (std::vector<db::DeviceParameterDefinition>::const_iterator p = pd.begin (); p != pd.end (); ++p) {
|
for (std::vector<db::DeviceParameterDefinition>::const_iterator p = pd.begin (); p != pd.end (); ++p) {
|
||||||
|
if (p->is_primary ()) {
|
||||||
double v = device->parameter_value (p->id ());
|
double v = device->parameter_value (p->id ());
|
||||||
if (v > 0.0) {
|
|
||||||
if (first) {
|
if (first) {
|
||||||
s += " [";
|
s += " [";
|
||||||
first = false;
|
|
||||||
} else {
|
} else {
|
||||||
s += ", ";
|
s += ", ";
|
||||||
}
|
}
|
||||||
s += p->name ();
|
s += p->name ();
|
||||||
s += "=";
|
s += "=";
|
||||||
s += formatted_value (v);
|
s += formatted_value (v);
|
||||||
|
term = "]";
|
||||||
|
first = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! first) {
|
|
||||||
s += "]";
|
bool first_sec = true;
|
||||||
|
|
||||||
|
for (std::vector<db::DeviceParameterDefinition>::const_iterator p = pd.begin (); p != pd.end (); ++p) {
|
||||||
|
double v = device->parameter_value (p->id ());
|
||||||
|
std::string vs = formatted_value (v);
|
||||||
|
std::string vs_def = formatted_value (p->default_value ());
|
||||||
|
if (! p->is_primary () && vs != vs_def) {
|
||||||
|
if (first) {
|
||||||
|
s += " [(";
|
||||||
|
} else if (first_sec) {
|
||||||
|
s += ", (";
|
||||||
|
} else {
|
||||||
|
s += ", ";
|
||||||
}
|
}
|
||||||
return s;
|
s += p->name ();
|
||||||
|
s += "=";
|
||||||
|
s += vs;
|
||||||
|
term = ")]";
|
||||||
|
first = false;
|
||||||
|
first_sec = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return s + term;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,7 @@ TEST (2)
|
||||||
|
|
||||||
// INV2, net 1 has one pin and one terminal at BULK
|
// INV2, net 1 has one pin and one terminal at BULK
|
||||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2Net0Index), Qt::UserRole).toString ()), "B|B|PMOS|PMOS|$1|$1");
|
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2Net0Index), Qt::UserRole).toString ()), "B|B|PMOS|PMOS|$1|$1");
|
||||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2Net0Index), Qt::DisplayRole).toString ()), "B / PMOS [L=0.25, W=3.5, AS=1.4, AD=1.4, PS=6.85, PD=6.85]");
|
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2Net0Index), Qt::DisplayRole).toString ()), "B / PMOS [L=0.25, W=3.5, (AS=1.4, AD=1.4, PS=6.85, PD=6.85)]");
|
||||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, inv2Net0Index), Qt::DisplayRole).toString ()), "$1");
|
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, inv2Net0Index), Qt::DisplayRole).toString ()), "$1");
|
||||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, inv2Net0Index), Qt::DisplayRole).toString ()), "$1");
|
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, inv2Net0Index), Qt::DisplayRole).toString ()), "$1");
|
||||||
|
|
||||||
|
|
@ -357,8 +357,8 @@ TEST (2)
|
||||||
// first of devices in INV2 circuit
|
// first of devices in INV2 circuit
|
||||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_devices), Qt::UserRole).toString ()), "$1|$1|PMOS|PMOS");
|
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_devices), Qt::UserRole).toString ()), "$1|$1|PMOS|PMOS");
|
||||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_devices), Qt::DisplayRole).toString ()), "PMOS");
|
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, sn_devices), Qt::DisplayRole).toString ()), "PMOS");
|
||||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, sn_devices), Qt::DisplayRole).toString ()), "$1 / PMOS [L=0.25, W=3.5, AS=1.4, AD=1.4, PS=6.85, PD=6.85]");
|
EXPECT_EQ (tl::to_string (model->data (model->index (0, 2, sn_devices), Qt::DisplayRole).toString ()), "$1 / PMOS [L=0.25, W=3.5, (AS=1.4, AD=1.4, PS=6.85, PD=6.85)]");
|
||||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, sn_devices), Qt::DisplayRole).toString ()), "$1 / PMOS [L=0.25, W=3.5, AS=1.4, AD=1.4, PS=6.85, PD=6.85]");
|
EXPECT_EQ (tl::to_string (model->data (model->index (0, 3, sn_devices), Qt::DisplayRole).toString ()), "$1 / PMOS [L=0.25, W=3.5, (AS=1.4, AD=1.4, PS=6.85, PD=6.85)]");
|
||||||
|
|
||||||
QModelIndex inv2PairIndex = model->index (2, 0, QModelIndex ());
|
QModelIndex inv2PairIndex = model->index (2, 0, QModelIndex ());
|
||||||
EXPECT_EQ (model->parent (inv2PairIndex).isValid (), false);
|
EXPECT_EQ (model->parent (inv2PairIndex).isValid (), false);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue