KiCad PCB EDA Suite
|
Generate a netlist compatible with Allegro. More...
#include <netlist_exporter_allegro.h>
Classes | |
struct | NET_NODE |
Public Member Functions | |
NETLIST_EXPORTER_ALLEGRO (SCHEMATIC *aSchematic) | |
bool | WriteNetlist (const wxString &aOutFileName, unsigned aNetlistOptions, REPORTER &aReporter) override |
Write netlist to aOutFileName. | |
Static Public Member Functions | |
static bool | CompareSymbolSheetpath (const std::pair< SCH_SYMBOL *, SCH_SHEET_PATH > &aItem1, const std::pair< SCH_SYMBOL *, SCH_SHEET_PATH > &aItem2) |
Compare two std::pair<SCH_SYMBOL*, SCH_SHEET_PATH> variables. | |
static bool | CompareSymbolRef (const wxString &aRefText1, const wxString &aRefText2) |
Compare two wxString variables. | |
static bool | CompareLibPin (const SCH_PIN *aPin1, const SCH_PIN *aPin2) |
Compare two SCH_PIN* variables. | |
static wxString | MakeCommandLine (const wxString &aFormatString, const wxString &aNetlistFile, const wxString &aFinalFile, const wxString &aProjectDirectory) |
Build up a string that describes a command line for executing a child process. | |
Protected Member Functions | |
std::vector< PIN_INFO > | CreatePinList (SCH_SYMBOL *aSymbol, const SCH_SHEET_PATH &aSheetPath, bool aKeepUnconnectedPins) |
Find a symbol from the DrawList and builds its pin list. | |
SCH_SYMBOL * | findNextSymbol (EDA_ITEM *aItem, const SCH_SHEET_PATH &aSheetPath) |
Check if the given symbol should be processed for netlisting. | |
void | eraseDuplicatePins (std::vector< PIN_INFO > &pins) |
Erase duplicate pins. | |
void | findAllUnitsOfSymbol (SCH_SYMBOL *aSchSymbol, const SCH_SHEET_PATH &aSheetPath, std::vector< PIN_INFO > &aPins, bool aKeepUnconnectedPins) |
Find all units for symbols with multiple symbols per package. | |
Protected Attributes | |
UNIQUE_STRINGS | m_referencesAlreadyFound |
Used for "multiple symbols per package" symbols to avoid processing a lib symbol more than once. | |
std::set< LIB_SYMBOL *, LIB_SYMBOL_LESS_THAN > | m_libParts |
unique library symbols used. LIB_SYMBOL items are sorted by names | |
SCHEMATIC_IFACE * | m_schematic |
The schematic we're generating a netlist for. | |
Private Member Functions | |
void | extractComponentsInfo () |
void | toAllegroPackages () |
Write the $PACKAGES section. | |
void | toAllegroNets () |
Write the $NETS section. | |
void | toAllegroPackageProperties () |
Write $A_PROPERTIES section. | |
wxString | formatDevice (wxString aString) |
Convert a string into one safe for a Telesis device name. | |
wxString | formatText (wxString aString) |
Convert a string into Telesis-safe format. | |
wxString | formatPin (const SCH_PIN &aPin) |
Generate a Telesis-compatible pin name from a pin node. | |
wxString | formatFunction (wxString aName, std::vector< SCH_PIN * > aPinList) |
Generate the definition of a function in Telesis format, which consists of multiple declarations (PINORDER, PINSWAP, and FUNCTIONs). | |
wxString | getGroupField (int aGroupIndex, const wxArrayString &aFieldArray, bool aSanitize=true) |
Look up a field for a component group, which may have mismatched case, or the component group may not have the field defined and instead the library entry has to be searched. | |
Static Private Member Functions | |
static wxString | removeTailDigits (wxString aString) |
Remove the str's tailing digits. | |
static unsigned int | extractTailNumber (wxString aString) |
Extract the str's tailing number. | |
Private Attributes | |
FILE * | m_f |
File pointer for netlist file writing operation. | |
wxString | m_exportPath |
Directory to store device files. | |
std::multimap< wxString, wxString > | m_packageProperties |
std::multimap< int, std::pair< SCH_SYMBOL *, SCH_SHEET_PATH > > | m_componentGroups |
Store the component group. | |
std::list< std::pair< SCH_SYMBOL *, SCH_SHEET_PATH > > | m_orderedSymbolsSheetpath |
Store the ordered symbols with sheetpath. | |
std::multimap< wxString, NET_NODE > | m_netNameNodes |
Store the NET_NODE with the net name. | |
Generate a netlist compatible with Allegro.
Definition at line 34 of file netlist_exporter_allegro.h.
|
inline |
Definition at line 37 of file netlist_exporter_allegro.h.
|
static |
Compare two SCH_PIN* variables.
aPin1 | |
aPin2 |
Definition at line 127 of file netlist_exporter_allegro.cpp.
References SCH_PIN::GetShownNumber(), and StrNumCmp().
Referenced by formatFunction(), and toAllegroPackages().
|
static |
Compare two wxString variables.
aRefText1 | |
aRefText2 |
Definition at line 115 of file netlist_exporter_allegro.cpp.
References extractTailNumber(), and removeTailDigits().
Referenced by CompareSymbolSheetpath(), NETLIST_EXPORTER_ALLEGRO::NET_NODE::operator<(), and toAllegroPackageProperties().
|
static |
Compare two std::pair<SCH_SYMBOL*, SCH_SHEET_PATH> variables.
aItem1 | comparing object 1 |
aItem2 | comparing object 2 |
Definition at line 98 of file netlist_exporter_allegro.cpp.
References CompareSymbolRef().
Referenced by toAllegroPackages().
|
protectedinherited |
Find a symbol from the DrawList and builds its pin list.
This list is sorted by pin number. The symbol is the next actual symbol after aSymbol. Power symbols and virtual symbols that have their reference designators starting with '#' are skipped. if aKeepUnconnectedPins = false, unconnected pins will be removed from list but usually we need all pins in netlists.
Definition at line 128 of file netlist_exporter_base.cpp.
References SCHEMATIC_IFACE::ConnectionGraph(), NETLIST_EXPORTER_BASE::eraseDuplicatePins(), NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol(), CONNECTION_GRAPH::FindSubgraphByName(), CONNECTION_SUBGRAPH::GetItems(), SCH_SYMBOL::GetLibSymbolRef(), CONNECTION_SUBGRAPH::GetNoConnect(), SCH_SYMBOL::GetPins(), SCH_SYMBOL::GetRef(), SCH_SYMBOL::IsPower(), NETLIST_EXPORTER_BASE::m_libParts, NETLIST_EXPORTER_BASE::m_schematic, and pin.
Referenced by NETLIST_EXPORTER_SPICE::ReadSchematicAndLibraries(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().
|
protectedinherited |
Erase duplicate pins.
(This is a list of pins found in the whole schematic, for a single symbol.) These duplicate pins were put in list because some pins (power pins...) are found more than once when in "multiple symbols per package" symbols. For instance, a 74ls00 has 4 symbols, and therefore the VCC pin and GND pin appears 4 times in the list. Note: this list MUST be sorted by pin number (.m_PinNum member value) Also set the m_Flag member of "removed" NETLIST_OBJECT pin item to 1
Definition at line 201 of file netlist_exporter_base.cpp.
Referenced by NETLIST_EXPORTER_BASE::CreatePinList().
|
private |
Definition at line 134 of file netlist_exporter_allegro.cpp.
References UNIQUE_STRINGS::Clear(), SCHEMATIC_IFACE::ConnectionGraph(), NETLIST_EXPORTER_BASE::findNextSymbol(), SYMBOL::GetExcludedFromBoard(), SCH_SYMBOL::GetLibPins(), CONNECTION_GRAPH::GetNetMap(), SCH_ITEM::GetParentSymbol(), SYMBOL::GetRef(), SCH_SYMBOL::GetRef(), SCH_SHEET_PATH::GetSheet(), SCH_PIN::GetShownNumber(), SCHEMATIC_IFACE::Hierarchy(), NETLIST_EXPORTER_BASE::m_libParts, m_netNameNodes, m_orderedSymbolsSheetpath, m_packageProperties, NETLIST_EXPORTER_ALLEGRO::NET_NODE::m_Pin, NETLIST_EXPORTER_BASE::m_referencesAlreadyFound, NETLIST_EXPORTER_BASE::m_schematic, NETLIST_EXPORTER_ALLEGRO::NET_NODE::m_Sheet, EDA_ITEM::m_Uuid, pin, alg::remove_duplicates(), SCH_NO_CONNECT_T, SCH_PIN_T, SCH_SYMBOL_T, SCHEMATIC_IFACE::SetCurrentSheet(), and StrNumCmp().
Referenced by WriteNetlist().
|
staticprivate |
Extract the str's tailing number.
aString |
Definition at line 765 of file netlist_exporter_allegro.cpp.
Referenced by CompareSymbolRef().
|
protectedinherited |
Find all units for symbols with multiple symbols per package.
Search the entire design for all units of aSymbol based on matching reference designator, and for each unit, add all its pins to the sorted pin list. if aKeepUnconnectedPins = false, unconnected pins will be removed from list but usually we need all pins in netlists.
Definition at line 234 of file netlist_exporter_base.cpp.
References SCHEMATIC_IFACE::ConnectionGraph(), CONNECTION_GRAPH::FindSubgraphByName(), CONNECTION_SUBGRAPH::GetItems(), CONNECTION_SUBGRAPH::GetNoConnect(), SCH_SYMBOL::GetPins(), SCH_SYMBOL::GetRef(), SCHEMATIC_IFACE::Hierarchy(), NETLIST_EXPORTER_BASE::m_schematic, pin, and SCH_SYMBOL_T.
Referenced by NETLIST_EXPORTER_BASE::CreatePinList().
|
protectedinherited |
Check if the given symbol should be processed for netlisting.
Prevent processing multi-unit symbols more than once, etc.
aItem | is a symbol to check |
aSheetPath | is the sheet to check the symbol for |
Definition at line 82 of file netlist_exporter_base.cpp.
References SCH_SCREEN::GetLibSymbols(), SCH_SYMBOL::GetRef(), SCH_SYMBOL::GetSchSymbolLibraryName(), LIB_SYMBOL::GetUnitCount(), SCH_SHEET_PATH::LastScreen(), UNIQUE_STRINGS::Lookup(), NETLIST_EXPORTER_BASE::m_libParts, NETLIST_EXPORTER_BASE::m_referencesAlreadyFound, SCH_SYMBOL_T, and EDA_ITEM::Type().
Referenced by extractComponentsInfo(), NETLIST_EXPORTER_XML::makeSymbols(), NETLIST_EXPORTER_SPICE::ReadSchematicAndLibraries(), NETLIST_EXPORTER_CADSTAR::WriteNetlist(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), and NETLIST_EXPORTER_PADS::WriteNetlist().
|
private |
Convert a string into one safe for a Telesis device name.
These are all lowercase and have a more restricted set of characters.
aString | wxString to be formatted. |
Definition at line 673 of file netlist_exporter_allegro.cpp.
Referenced by toAllegroPackages().
|
private |
Generate the definition of a function in Telesis format, which consists of multiple declarations (PINORDER, PINSWAP, and FUNCTIONs).
aName | |
aPinList |
Definition at line 584 of file netlist_exporter_allegro.cpp.
References CompareLibPin(), formatPin(), pin, and TO_UTF8.
Referenced by toAllegroPackages().
|
private |
Generate a Telesis-compatible pin name from a pin node.
( Telesis requires all pin names to be unique, and doesn't have separate fields for pin number and pin name/function, so we combine them together to make a unique name that still describes its function if you check pin info.
aPin |
Definition at line 576 of file netlist_exporter_allegro.cpp.
References SCH_PIN::GetName(), and SCH_PIN::GetNumber().
Referenced by formatFunction().
|
private |
Convert a string into Telesis-safe format.
Unsupported characters are replaced with ?'s, and the string is quoted if necessary.
aString |
Definition at line 557 of file netlist_exporter_allegro.cpp.
Referenced by getGroupField(), toAllegroNets(), and toAllegroPackageProperties().
|
private |
Look up a field for a component group, which may have mismatched case, or the component group may not have the field defined and instead the library entry has to be searched.
Returns None if no fields exist.
aGroupIndex | the component group index to query |
aFieldArray | one or more (equivalent) fields to query, in the order specified. first field that exists is returned. |
aSanitize | if true (default), will format/escape the field for Telesis output |
Definition at line 621 of file netlist_exporter_allegro.cpp.
References SCH_SYMBOL::FindField(), formatText(), SCH_SYMBOL::GetLibSymbolRef(), and m_componentGroups.
Referenced by toAllegroPackages().
|
staticinherited |
Build up a string that describes a command line for executing a child process.
The input and output file names along with any options to the executable are all possibly in the returned string.
aFormatString | holds:
|
aNetlistFile | is the name of the input file for the external program, that is a intermediate netlist file in xml format. |
aFinalFile | is the name of the output file that the user expects. |
aProjectDirectory | is used for P replacement, it should omit the trailing '/'. |
Supported formatting sequences and their meaning:
Definition at line 46 of file netlist_exporter_base.cpp.
Referenced by SCH_EDIT_FRAME::WriteNetListFile().
|
staticprivate |
Remove the str's tailing digits.
aString |
Definition at line 753 of file netlist_exporter_allegro.cpp.
Referenced by CompareSymbolRef(), and toAllegroPackages().
|
private |
Write the $NETS section.
Definition at line 716 of file netlist_exporter_allegro.cpp.
References formatText(), m_f, m_netNameNodes, and TO_UTF8.
Referenced by WriteNetlist().
|
private |
Write $A_PROPERTIES section.
Definition at line 681 of file netlist_exporter_allegro.cpp.
References CompareSymbolRef(), formatText(), m_f, m_packageProperties, and TO_UTF8.
Referenced by WriteNetlist().
|
private |
Write the $PACKAGES section.
Definition at line 295 of file netlist_exporter_allegro.cpp.
References _, CompareLibPin(), CompareSymbolSheetpath(), DisplayError(), formatDevice(), formatFunction(), SCH_SYMBOL::GetFootprintFieldText(), getGroupField(), SCH_SYMBOL::GetLibSymbolRef(), SCH_SYMBOL::GetValue(), m_componentGroups, m_exportPath, m_f, m_orderedSymbolsSheetpath, removeTailDigits(), and TO_UTF8.
Referenced by WriteNetlist().
|
overridevirtual |
Write netlist to aOutFileName.
Generate the Allegro netlist format supported by Allegro.
Reimplemented from NETLIST_EXPORTER_BASE.
Definition at line 39 of file netlist_exporter_allegro.cpp.
References _, extractComponentsInfo(), SCHEMATIC_IFACE::GetFileName(), GetISO8601CurrentDateTime(), m_componentGroups, m_exportPath, m_f, m_netNameNodes, m_orderedSymbolsSheetpath, m_packageProperties, NETLIST_EXPORTER_BASE::m_schematic, REPORTER::Report(), RPT_SEVERITY_ERROR, TO_UTF8, toAllegroNets(), toAllegroPackageProperties(), and toAllegroPackages().
|
private |
Store the component group.
Definition at line 221 of file netlist_exporter_allegro.h.
Referenced by getGroupField(), toAllegroPackages(), and WriteNetlist().
|
private |
Directory to store device files.
Definition at line 217 of file netlist_exporter_allegro.h.
Referenced by toAllegroPackages(), and WriteNetlist().
|
private |
File pointer for netlist file writing operation.
Definition at line 216 of file netlist_exporter_allegro.h.
Referenced by toAllegroNets(), toAllegroPackageProperties(), toAllegroPackages(), and WriteNetlist().
|
protectedinherited |
unique library symbols used. LIB_SYMBOL items are sorted by names
Definition at line 192 of file netlist_exporter_base.h.
Referenced by NETLIST_EXPORTER_BASE::CreatePinList(), extractComponentsInfo(), NETLIST_EXPORTER_BASE::findNextSymbol(), NETLIST_EXPORTER_XML::makeLibParts(), NETLIST_EXPORTER_XML::makeSymbols(), and NETLIST_EXPORTER_SPICE::ReadSchematicAndLibraries().
|
private |
Store the NET_NODE with the net name.
Definition at line 225 of file netlist_exporter_allegro.h.
Referenced by extractComponentsInfo(), toAllegroNets(), and WriteNetlist().
|
private |
Store the ordered symbols with sheetpath.
Definition at line 224 of file netlist_exporter_allegro.h.
Referenced by extractComponentsInfo(), toAllegroPackages(), and WriteNetlist().
|
private |
Definition at line 218 of file netlist_exporter_allegro.h.
Referenced by extractComponentsInfo(), toAllegroPackageProperties(), and WriteNetlist().
|
protectedinherited |
Used for "multiple symbols per package" symbols to avoid processing a lib symbol more than once.
Definition at line 189 of file netlist_exporter_base.h.
Referenced by extractComponentsInfo(), NETLIST_EXPORTER_BASE::findNextSymbol(), NETLIST_EXPORTER_XML::makeSymbols(), NETLIST_EXPORTER_SPICE::ReadSchematicAndLibraries(), NETLIST_EXPORTER_CADSTAR::WriteNetlist(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), and NETLIST_EXPORTER_PADS::WriteNetlist().
|
protectedinherited |
The schematic we're generating a netlist for.
Definition at line 195 of file netlist_exporter_base.h.
Referenced by NETLIST_EXPORTER_SPICE::BuildSheetList(), NETLIST_EXPORTER_BASE::CreatePinList(), extractComponentsInfo(), NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol(), NETLIST_EXPORTER_XML::makeDesignHeader(), NETLIST_EXPORTER_XML::makeLibraries(), NETLIST_EXPORTER_XML::makeListOfNets(), NETLIST_EXPORTER_XML::makeSymbols(), NETLIST_EXPORTER_SPICE::readModel(), NETLIST_EXPORTER_SPICE_MODEL::WriteHead(), NETLIST_EXPORTER_SPICE::writeInclude(), NETLIST_EXPORTER_CADSTAR::writeListOfNets(), NETLIST_EXPORTER_PADS::writeListOfNets(), WriteNetlist(), NETLIST_EXPORTER_CADSTAR::WriteNetlist(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), and NETLIST_EXPORTER_PADS::WriteNetlist().