mirror of https://github.com/KLayout/klayout.git
WIP: prepared dual mode for netlist browser.
This commit is contained in:
parent
a433361c53
commit
829e337462
|
|
@ -947,7 +947,7 @@ int
|
|||
NetlistBrowserModel::columnCount (const QModelIndex & /*parent*/) const
|
||||
{
|
||||
// Item type & icon, link or description
|
||||
return 2;
|
||||
return mp_indexer->is_single () ? 2 : 3;
|
||||
}
|
||||
|
||||
QVariant
|
||||
|
|
@ -1286,23 +1286,27 @@ NetlistBrowserModel::text (const QModelIndex &index) const
|
|||
|
||||
if (is_id_circuit (id)) {
|
||||
|
||||
// circuit: header column = name, other columns empty
|
||||
// circuit:
|
||||
// + single mode: name | <empty> | <empty>
|
||||
// + dual mode: name(a)/name(b) | name(a) | name(b)
|
||||
IndexedNetlistModel::circuit_pair circuits = circuits_from_id (id);
|
||||
if (index.column () == 0) {
|
||||
IndexedNetlistModel::circuit_pair circuits = circuits_from_id (id);
|
||||
if (circuits.first) {
|
||||
return tl::to_qstring (circuits.first->name ());
|
||||
}
|
||||
return tl::to_qstring (str_from_names (circuits, mp_indexer->is_single ()));
|
||||
} else if (!mp_indexer->is_single ()) {
|
||||
return tl::to_qstring (str_from_name (index.column () == 2 ? circuits.first : circuits.second));
|
||||
}
|
||||
// TODO: in case of compare use different scheme
|
||||
|
||||
} else if (is_id_circuit_pin (id)) {
|
||||
|
||||
// circuit/pin: header column = pin name, other columns pin name
|
||||
// pin:
|
||||
// + single mode: xname | <empty> | <empty>
|
||||
// + dual mode: xname(a)/xname(b) | xname(a) | xname(b)
|
||||
IndexedNetlistModel::pin_pair pins = pins_from_id (id);
|
||||
if (pins.first) {
|
||||
return tl::to_qstring (pins.first->expanded_name ());
|
||||
if (index.column () == 0) {
|
||||
return tl::to_qstring (str_from_expanded_names (pins, mp_indexer->is_single ()));
|
||||
} else if (!mp_indexer->is_single ()) {
|
||||
return tl::to_qstring (str_from_expanded_name (index.column () == 2 ? pins.first : pins.second));
|
||||
}
|
||||
// TODO: in case of compare, column 1 is name(a):name(b), 2 is name(a) and 3 is name(b)
|
||||
|
||||
} else if (is_id_circuit_pin_net (id)) {
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ TEST (1)
|
|||
EXPECT_EQ (model->hasChildren (QModelIndex ()), true);
|
||||
// two circuits
|
||||
EXPECT_EQ (model->rowCount (QModelIndex ()), 2);
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, QModelIndex ()), Qt::UserRole).toString ()), "INV2");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, QModelIndex ()), Qt::DisplayRole).toString ()), "INV2");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, QModelIndex ()), Qt::DisplayRole).toString ()), "RINGO");
|
||||
EXPECT_EQ (model->parent (model->index (0, 0, QModelIndex ())).isValid (), false);
|
||||
|
|
@ -46,12 +47,14 @@ TEST (1)
|
|||
// 5 pins, 5 nets, 0 subcircuits, 4 devices
|
||||
EXPECT_EQ (model->rowCount (inv2Index), 14);
|
||||
// Pins
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2Index), Qt::UserRole).toString ()), "$1");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2Index), Qt::DisplayRole).toString ()), "$1");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, inv2Index), Qt::DisplayRole).toString ()), "$3");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (2, 0, inv2Index), Qt::DisplayRole).toString ()), "$4");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (3, 0, inv2Index), Qt::DisplayRole).toString ()), "IN");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (4, 0, inv2Index), Qt::DisplayRole).toString ()), "OUT");
|
||||
// Nets
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (5, 0, inv2Index), Qt::UserRole).toString ()), "$2");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (5, 0, inv2Index), Qt::DisplayRole).toString ()), "$2");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (5, 1, inv2Index), Qt::DisplayRole).toString ()), "$2 (5)");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (6, 0, inv2Index), Qt::DisplayRole).toString ()), "$4");
|
||||
|
|
@ -64,6 +67,7 @@ TEST (1)
|
|||
EXPECT_EQ (tl::to_string (model->data (model->index (9, 1, inv2Index), Qt::DisplayRole).toString ()), "NOUT (3)");
|
||||
// No Subcircuits
|
||||
// Devices
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (10, 0, inv2Index), Qt::UserRole).toString ()), "$1|PMOS");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (10, 0, inv2Index), Qt::DisplayRole).toString ()), "PMOS [L=0.25, W=0.95, AS=0.49875, AD=0.26125, PS=2.95, PD=1.5]");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (10, 1, inv2Index), Qt::DisplayRole).toString ()), "$1");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (11, 0, inv2Index), Qt::DisplayRole).toString ()), "PMOS [L=0.25, W=0.95, AS=0.26125, AD=0.49875, PS=1.5, PD=2.95]");
|
||||
|
|
@ -78,6 +82,7 @@ TEST (1)
|
|||
EXPECT_EQ (model->rowCount (ringoIndex), 22);
|
||||
// Pins
|
||||
// Nets
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, ringoIndex), Qt::UserRole).toString ()), "$10");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 1, ringoIndex), Qt::DisplayRole).toString ()), "$10 (2)");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 1, ringoIndex), Qt::DisplayRole).toString ()), "$11 (2)");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (2, 1, ringoIndex), Qt::DisplayRole).toString ()), "$12 (2)");
|
||||
|
|
@ -91,6 +96,7 @@ TEST (1)
|
|||
EXPECT_EQ (tl::to_string (model->data (model->index (10, 1, ringoIndex), Qt::DisplayRole).toString ()), "VDD (10)");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (11, 1, ringoIndex), Qt::DisplayRole).toString ()), "VSS (10)");
|
||||
// Subcircuits
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (12, 0, ringoIndex), Qt::UserRole).toString ()), "INV2|$1");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (12, 0, ringoIndex), Qt::DisplayRole).toString ()), "<a href='int:circuit?id=0'>INV2</a>");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (12, 1, ringoIndex), Qt::DisplayRole).toString ()), "$1");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (21, 0, ringoIndex), Qt::DisplayRole).toString ()), "<a href='int:circuit?id=0'>INV2</a>");
|
||||
|
|
@ -115,6 +121,7 @@ TEST (1)
|
|||
EXPECT_EQ (model->hasChildren (inv2NOutIndex), true);
|
||||
EXPECT_EQ (model->rowCount (inv2NOutIndex), 3);
|
||||
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2NOutIndex), Qt::UserRole).toString ()), "D|PMOS|$2");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2NOutIndex), Qt::DisplayRole).toString ()), "D - PMOS [L=0.25, W=0.95, AS=0.26125, AD=0.49875, PS=1.5, PD=2.95]");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 1, inv2NOutIndex), Qt::DisplayRole).toString ()), "<a href='int:device?id=24'>$2</a>");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, inv2NOutIndex), Qt::DisplayRole).toString ()), "D - NMOS [L=0.25, W=0.95, AS=0.26125, AD=0.49875, PS=1.5, PD=2.95]");
|
||||
|
|
@ -134,6 +141,7 @@ TEST (1)
|
|||
EXPECT_EQ (model->hasChildren (inv2NOutDeviceIndex), true);
|
||||
EXPECT_EQ (model->rowCount (inv2NOutDeviceIndex), 3);
|
||||
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2NOutDeviceIndex), Qt::UserRole).toString ()), "S|$5");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, inv2NOutDeviceIndex), Qt::DisplayRole).toString ()), "S");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, inv2NOutDeviceIndex), Qt::DisplayRole).toString ()), "G");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (2, 0, inv2NOutDeviceIndex), Qt::DisplayRole).toString ()), "D");
|
||||
|
|
@ -149,6 +157,7 @@ TEST (1)
|
|||
EXPECT_EQ (model->hasChildren (ringoFbIndex), true);
|
||||
EXPECT_EQ (model->rowCount (ringoFbIndex), 2);
|
||||
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, ringoFbIndex), Qt::UserRole).toString ()), "$1|INV2|$1");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, ringoFbIndex), Qt::DisplayRole).toString ()), "<a href='int:pin?id=2'>$1</a> - <a href='int:circuit?id=0'>INV2</a>");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 1, ringoFbIndex), Qt::DisplayRole).toString ()), "<a href='int:subcircuit?id=7'>$1</a>");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, ringoFbIndex), Qt::DisplayRole).toString ()), "<a href='int:pin?id=50'>IN</a> - <a href='int:circuit?id=0'>INV2</a>");
|
||||
|
|
@ -159,6 +168,7 @@ TEST (1)
|
|||
EXPECT_EQ (model->hasChildren (ringoFbSubcircuit2Index), true);
|
||||
EXPECT_EQ (model->rowCount (ringoFbSubcircuit2Index), 5);
|
||||
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, ringoFbSubcircuit2Index), Qt::UserRole).toString ()), "$1|$2");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 0, ringoFbSubcircuit2Index), Qt::DisplayRole).toString ()), "<a href='int:pin?id=2'>$1</a>");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (0, 1, ringoFbSubcircuit2Index), Qt::DisplayRole).toString ()), "");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, ringoFbSubcircuit2Index), Qt::DisplayRole).toString ()), "<a href='int:pin?id=18'>$3</a>");
|
||||
|
|
@ -182,6 +192,7 @@ TEST (1)
|
|||
EXPECT_EQ (model->hasChildren (ringoSubcircuit1Index), true);
|
||||
EXPECT_EQ (model->rowCount (ringoSubcircuit1Index), 5);
|
||||
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (4, 0, ringoSubcircuit1Index), Qt::UserRole).toString ()), "OUT");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (4, 0, ringoSubcircuit1Index), Qt::DisplayRole).toString ()), "<a href='int:pin?id=66'>OUT</a>");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (4, 1, ringoSubcircuit1Index), Qt::DisplayRole).toString ()), "");
|
||||
|
||||
|
|
@ -197,6 +208,7 @@ TEST (1)
|
|||
EXPECT_EQ (model->hasChildren (inv2Device1Index), true);
|
||||
EXPECT_EQ (model->rowCount (inv2Device1Index), 3);
|
||||
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, inv2Device1Index), Qt::UserRole).toString ()), "G|NIN");
|
||||
EXPECT_EQ (tl::to_string (model->data (model->index (1, 0, inv2Device1Index), Qt::DisplayRole).toString ()), "G");
|
||||
|
||||
QModelIndex inv2Device1GateIndex = model->index (1, 0, inv2Device1Index);
|
||||
|
|
|
|||
Loading…
Reference in New Issue