From 8d51d1e4bbf463d18067f8a66977f78d7f2e5fe3 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 6 Jan 2019 01:54:36 +0100 Subject: [PATCH] WIP: better optimization of hierarchical net output. --- src/db/db/dbLayoutToNetlist.cc | 5 +- src/db/db/gsiDeclDbLayoutToNetlist.cc | 48 ++++++++++++++++++ .../algo/device_extract_au1_rebuild_nr.gds | Bin 36354 -> 9874 bytes 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/db/db/dbLayoutToNetlist.cc b/src/db/db/dbLayoutToNetlist.cc index af2026460..0e2adb5d0 100644 --- a/src/db/db/dbLayoutToNetlist.cc +++ b/src/db/db/dbLayoutToNetlist.cc @@ -336,7 +336,6 @@ LayoutToNetlist::build_net (const db::Net &net, db::Layout &target, db::Cell &ta } std::map, db::cell_index_type> cell_map; - cell_map.insert (std::make_pair (std::make_pair (net.circuit ()->cell_index (), net.cluster_id ()), target_cell.cell_index ())); build_net_rec (net, target, target_cell, lmap, cell_name_prefix, cell_map); } @@ -348,6 +347,8 @@ LayoutToNetlist::build_all_nets (const db::CellMapping &cmap, db::Layout &target throw tl::Exception (tl::to_string (tr ("The netlist has not been extracted yet"))); } + std::map, db::cell_index_type> cell_map; + const db::Netlist *netlist = mp_netlist.get (); for (db::Netlist::const_circuit_iterator c = netlist->begin_circuits (); c != netlist->end_circuits (); ++c) { @@ -390,7 +391,7 @@ LayoutToNetlist::build_all_nets (const db::CellMapping &cmap, db::Layout &target } - build_net (*n, target, target.cell (net_ci), lmap, circuit_cell_name_prefix); + build_net_rec (*n, target, target.cell (net_ci), lmap, circuit_cell_name_prefix, cell_map); } diff --git a/src/db/db/gsiDeclDbLayoutToNetlist.cc b/src/db/db/gsiDeclDbLayoutToNetlist.cc index 1e47fddc8..2b6b003fc 100644 --- a/src/db/db/gsiDeclDbLayoutToNetlist.cc +++ b/src/db/db/gsiDeclDbLayoutToNetlist.cc @@ -151,6 +151,54 @@ Class decl_dbLayoutToNetlist ("db", "LayoutToNetlist", "If 'recursive'' is true, the returned region will contain the shapes of\n" "all subcircuits too.\n" ) + + gsi::method ("build_net", &db::LayoutToNetlist::build_net, gsi::arg ("net"), gsi::arg ("target"), gsi::arg ("target_cell"), gsi::arg ("lmap"), gsi::arg ("cell_name"), + "@brief Builds a net representation in the given layout and cell\n" + "\n" + "This method has two modes: recursive and top-level mode. In recursive mode,\n" + "it will create a proper hierarchy below the given target cell to hold all subcircuits the\n" + "net connects to. It will copy the net's parts from this subcircuits into these cells.\n" + "\n" + "In top-level mode, only the shapes from the net inside it's circuit are copied to\n" + "the given target cell. No other cells are created.\n" + "\n" + "Recursive mode is picked when a cell name prefix is given. The new cells will be\n" + "named like cell_name_prefix + circuit name.\n" + "\n" + "@param target The target layout\n" + "@param target_cell The target cell\n" + "@param lmap Target layer indexes (keys) and net regions (values)\n" + "@param cell_name_prefix Chooses recursive mode if non-nil\n" + ) + + gsi::method ("build_all_nets", &db::LayoutToNetlist::build_all_nets, gsi::arg ("cmap"), gsi::arg ("target"), gsi::arg ("lmap"), gsi::arg ("net_cell_name_prefix"), gsi::arg ("circuit_cell_name_prefix"), + "@brief Builds a full hierarchical representation of the nets\n" + "\n" + "This method copies all nets into cells corresponding to the circuits. It uses the cmap\n" + "object to determine the target cell (create them with \\cell_mapping_into or \\const_cell_mapping_into.\n" + "If no mapping is requested, the specific circuit it skipped.\n" + "\n" + "The method has two net annotation modes:\n" + "\n" + "@ul\n" + "@li 'No annotation'' (net_cell_name_prefix == 0): the shapes will be put into the target cell simply @/li\n" + "@li Individual subcells per net (net_cell_name_prefix != 0): for each net, a subcell is created\n" + " and the net shapes will be put there (name of the subcell = net_cell_name_prefix + net name). @/li\n" + "@/ul\n" + "\n" + "In addition, net hierarchy is covered in two ways:\n" + "\n" + "@ul\n" + "@li No connection indicated (circuit_cell_name_prefix == 0: the net shapes are simply put into their\n" + " respective circuits. The connections are not indicated. @/li\n" + "@li Subnet hierarchy (circuit_cell_name_prefix != 0): for each root net, a full hierarchy is built\n" + " to accomodate the subnets (see build_net in recursive mode). @/li\n" + "@/ul\n" + "\n" + "@param cmap The mapping of internal layout to target layout for the circuit mapping\n" + "@param target The target layout\n" + "@param lmap Target layer indexes (keys) and net regions (values)\n" + "@param circuit_cell_name_prefix See method description\n" + "@param net_cell_name_prefix See method description\n" + ) + gsi::method ("probe_net", (db::Net *(db::LayoutToNetlist::*) (const db::Region &, const db::DPoint &)) &db::LayoutToNetlist::probe_net, gsi::arg ("of_layer"), gsi::arg ("point"), "@brief Finds the net by probing a specific location on the given layer\n" "\n" diff --git a/testdata/algo/device_extract_au1_rebuild_nr.gds b/testdata/algo/device_extract_au1_rebuild_nr.gds index ef77178c545b852d9518460564c779aa602ad854..19301649d9a82d85a444a52f72759d322613b88e 100644 GIT binary patch delta 1216 zcmZpg!!*fPiGhuQi7A3XhLMT=F#{uz$H-vHz>LhEsHDk{CN#N9_9=!~o*brFl6*3T zx@VahlP~14O`ewKFuAUnZL(XE%H$8e9Gly+`WZ14tK`5Gt4w}Sz&+VFNN93>G3(@O zdB&4tgLyaK$f?HAv^gnHo(bKg%@Ybb`pS&1a&ljpv=o|$8F<*({9HrgRXhzR z|8EqV{IN}SQaS(R+D3uNiXEzxW9sneFoNj-D&v`4)hG{igV~ZJFi(CW3KLOPQY%+&y3#dle^bem+ z7H}UGPam}s@(#pg^)T+kUE0KnHYeL z1EvVvR+<=s)j*Q~9(6`wb-*~sqsADl1{%?L)R}@A8dIem$pxKrF%-&lJ!1v{pa~kZ literal 36354 zcmeHQ--{(j6|Q^dPT!f?iA=`HOR|c{2nuVQ`(tObgoNGfMl!5y!tS`}vatCB6a+3_%c*r|3fvj1Tci5CX}Qh!5t)2j8+tK=3WFkSA9&?RUER+^(uy-F>=m+jpF< zh2hLrO`UV9>YT5tPM@w;k?QxqqfYnw!+)rritzIVH8y`&YyIe32Tv)rv$Fc+#n;YV z`SWk@oxl9vH{Sl`%|ms1HNV|X6kR&FcIn#(hqn)}UA%gIcRE&s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