Power Symbols: automatically fix mismatched legacy symbols, add tests

Has netlist generation test for legacy power symbols, and test for
fixing legacy mismatched power symbol text fields and invisible pin names.
This commit is contained in:
Mike Williams 2023-02-20 12:55:02 -05:00
parent 5995e0e516
commit 959a19a461
23 changed files with 1271 additions and 3 deletions

View File

@ -93,6 +93,10 @@ static std::unique_ptr<SCHEMATIC> readSchematicFromFile( const std::string& aFil
// Restore all of the loaded symbol instances from the root sheet screen.
sheets.UpdateSymbolInstanceData( schematic->RootScreen()->GetSymbolInstances() );
if( schematic->RootScreen()->GetFileFormatVersionAtLoad() < 20230221 )
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
screen->FixLegacyPowerSymbolMismatches();
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
screen->MigrateSimModels();
@ -581,4 +585,4 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
int IFACE::HandleJob( JOB* aJob )
{
return m_jobHandler->RunJob( aJob );
}
}

View File

@ -146,6 +146,9 @@ SCHEMATIC* EESCHEMA_HELPERS::LoadSchematic( wxString& aFileName, SCH_IO_MGR::SCH
sheetList.UpdateSheetInstanceData( schematic->RootScreen()->GetSheetInstances());
if( schematic->RootScreen()->GetFileFormatVersionAtLoad() < 20230221 )
screens.FixLegacyPowerSymbolMismatches();
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
screen->MigrateSimModels();
@ -172,4 +175,4 @@ SCHEMATIC* EESCHEMA_HELPERS::LoadSchematic( wxString& aFileName, SCH_IO_MGR::SCH
return schematic;
}
}

View File

@ -432,6 +432,9 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// to the s-expression format.
schematic.ReplaceDuplicateTimeStamps();
for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
screen->FixLegacyPowerSymbolMismatches();
// Allow the schematic to be saved to new file format without making any edits.
OnModify();
}
@ -456,6 +459,10 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
if( Schematic().RootScreen()->GetFileFormatVersionAtLoad() < 20221110 )
sheetList.UpdateSheetInstanceData( Schematic().RootScreen()->GetSheetInstances());
if( Schematic().RootScreen()->GetFileFormatVersionAtLoad() < 20230221 )
for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
screen->FixLegacyPowerSymbolMismatches();
for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
screen->MigrateSimModels();
}

View File

@ -94,4 +94,5 @@
//#define SEXPR_SCHEMATIC_FILE_VERSION 20221110 // Move sheet instance data to sheet definition.
//#define SEXPR_SCHEMATIC_FILE_VERSION 20221126 // Remove value and footprint from instance data.
//#define SEXPR_SCHEMATIC_FILE_VERSION 20221206 // Simulation model fields V6 -> V7
#define SEXPR_SCHEMATIC_FILE_VERSION 20230121 // SCH_MARKER specific sheet path serialisation
//#define SEXPR_SCHEMATIC_FILE_VERSION 20230121 // SCH_MARKER specific sheet path serialisation
#define SEXPR_SCHEMATIC_FILE_VERSION 20230221 // Modern power symbols (editable value = net)

View File

@ -1576,6 +1576,26 @@ void SCH_SCREEN::SetLegacySymbolInstanceData()
}
void SCH_SCREEN::FixLegacyPowerSymbolMismatches()
{
for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) )
{
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
// Fix pre-8.0 legacy power symbols with invisible pins
// that have mismatched pin names and value fields
if( symbol->GetLibSymbolRef()
&& symbol->GetLibSymbolRef()->IsPower()
&& symbol->GetAllLibPins().size() > 0
&& symbol->GetAllLibPins()[0]->IsGlobalPower()
&& !symbol->GetAllLibPins()[0]->IsVisible() )
{
symbol->SetValueFieldText( symbol->GetAllLibPins()[0]->GetName() );
}
}
}
size_t SCH_SCREEN::getLibSymbolNameMatches( const SCH_SYMBOL& aSymbol,
std::vector<wxString>& aMatches )
{
@ -2002,6 +2022,13 @@ void SCH_SCREENS::SetLegacySymbolInstanceData()
}
void SCH_SCREENS::FixLegacyPowerSymbolMismatches()
{
for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
screen->FixLegacyPowerSymbolMismatches();
}
void SCH_SCREEN::MigrateSimModels()
{
LOCALE_IO toggle;

View File

@ -532,6 +532,12 @@ public:
*/
void SetLegacySymbolInstanceData();
/**
* Fix legacy power symbols that have mismatched value text fields
* and invisible power pin names.
*/
void FixLegacyPowerSymbolMismatches();
/**
* Check all symbol default instance to see if they are not set yet.
*/
@ -782,6 +788,12 @@ public:
*/
void SetLegacySymbolInstanceData();
/**
* Fix legacy power symbols that have mismatched value text fields
* and invisible power pin names.
*/
void FixLegacyPowerSymbolMismatches();
private:
void addScreenToList( SCH_SCREEN* aScreen, SCH_SHEET* aSheet );
void buildScreenList( SCH_SHEET* aSheet);

View File

@ -0,0 +1,2 @@
(kicad_pcb (version 20211014) (generator pcbnew)
)

View File

@ -0,0 +1,326 @@
{
"board": {
"design_settings": {
"defaults": {
"board_outline_line_width": 0.1,
"copper_line_width": 0.2,
"copper_text_size_h": 1.5,
"copper_text_size_v": 1.5,
"copper_text_thickness": 0.3,
"other_line_width": 0.15,
"silk_line_width": 0.15,
"silk_text_size_h": 1.0,
"silk_text_size_v": 1.0,
"silk_text_thickness": 0.15
},
"diff_pair_dimensions": [],
"drc_exclusions": [],
"rules": {
"min_copper_edge_clearance": 0.0,
"solder_mask_clearance": 0.0,
"solder_mask_min_width": 0.0
},
"track_widths": [],
"via_dimensions": []
},
"layer_presets": []
},
"boards": [],
"cvpcb": {
"equivalence_files": []
},
"erc": {
"erc_exclusions": [],
"meta": {
"version": 0
},
"pin_map": [
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
1,
2
],
[
0,
1,
0,
0,
0,
0,
1,
1,
2,
1,
1,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2
],
[
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
2
],
[
0,
0,
0,
1,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
1,
2,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
0,
2,
1,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
],
"rule_severities": {
"bus_definition_conflict": "error",
"bus_entry_needed": "error",
"bus_label_syntax": "error",
"bus_to_bus_conflict": "error",
"bus_to_net_conflict": "error",
"different_unit_footprint": "error",
"different_unit_net": "error",
"duplicate_reference": "error",
"duplicate_sheet_names": "error",
"extra_units": "error",
"global_label_dangling": "warning",
"hier_label_mismatch": "error",
"label_dangling": "error",
"lib_symbol_issues": "warning",
"multiple_net_names": "warning",
"net_not_bus_member": "warning",
"no_connect_connected": "warning",
"no_connect_dangling": "warning",
"pin_not_connected": "error",
"pin_not_driven": "error",
"pin_to_pin": "warning",
"power_pin_not_driven": "error",
"similar_labels": "warning",
"unannotated": "error",
"unit_value_mismatch": "error",
"unresolved_variable": "error",
"wire_dangling": "error"
}
},
"libraries": {
"pinned_footprint_libs": [],
"pinned_symbol_libs": []
},
"meta": {
"filename": "legacy_power.kicad_pro",
"version": 1
},
"net_settings": {
"classes": [
{
"bus_width": 12.0,
"clearance": 0.2,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2,
"line_style": 0,
"microvia_diameter": 0.3,
"microvia_drill": 0.1,
"name": "Default",
"pcb_color": "rgba(0, 0, 0, 0.000)",
"schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 0.25,
"via_diameter": 0.8,
"via_drill": 0.4,
"wire_width": 6.0
}
],
"meta": {
"version": 2
},
"net_colors": null
},
"pcbnew": {
"last_paths": {
"gencad": "",
"idf": "",
"netlist": "",
"specctra_dsn": "",
"step": "",
"vrml": ""
},
"page_layout_descr_file": ""
},
"schematic": {
"annotate_start_num": 0,
"drawing": {
"default_line_thickness": 6.0,
"default_text_size": 50.0,
"field_names": [],
"intersheets_ref_own_page": false,
"intersheets_ref_prefix": "",
"intersheets_ref_short": false,
"intersheets_ref_show": false,
"intersheets_ref_suffix": "",
"junction_size_choice": 3,
"label_size_ratio": 0.375,
"pin_symbol_size": 25.0,
"text_offset_ratio": 0.15
},
"legacy_lib_dir": "",
"legacy_lib_list": [],
"meta": {
"version": 1
},
"net_format_name": "KiCad",
"ngspice": {
"fix_include_paths": true,
"fix_passive_vals": false,
"meta": {
"version": 0
},
"model_mode": 0,
"workbook_filename": ""
},
"page_layout_descr_file": "",
"plot_directory": "",
"spice_adjust_passive_values": false,
"spice_external_command": "spice \"%I\"",
"subpart_first_id": 65,
"subpart_id_separator": 0
},
"sheets": [
[
"c57b0c1c-467a-41e5-ac2b-67db44aab898",
""
]
],
"text_variables": {}
}

View File

@ -0,0 +1,436 @@
(kicad_sch (version 20211123) (generator eeschema)
(uuid c57b0c1c-467a-41e5-ac2b-67db44aab898)
(paper "A4")
(lib_symbols
(symbol "+3.3V_1" (power) (pin_names (offset 0)) (in_bom yes) (on_board yes)
(property "Reference" "#PWR?" (id 0) (at 0 -3.81 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "+3.3V_1" (id 1) (at 0 3.556 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "global power" (id 4) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Power symbol creates a global label with name \"+3.3V\"" (id 5) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "+3.3V_1_0_1"
(polyline
(pts
(xy -0.762 1.27)
(xy 0 2.54)
)
(stroke (width 0) (type default) (color 0 0 0 0))
(fill (type none))
)
(polyline
(pts
(xy 0 0)
(xy 0 2.54)
)
(stroke (width 0) (type default) (color 0 0 0 0))
(fill (type none))
)
(polyline
(pts
(xy 0 2.54)
(xy 0.762 1.27)
)
(stroke (width 0) (type default) (color 0 0 0 0))
(fill (type none))
)
)
(symbol "+3.3V_1_1_1"
(pin power_in line (at 0 0 90) (length 0) hide
(name "VCC" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
)
)
(symbol "74xGxx:74AHC1G00" (pin_names (offset 1.016)) (in_bom yes) (on_board yes)
(property "Reference" "U" (id 0) (at -2.54 3.81 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "74AHC1G00" (id 1) (at 0 -3.81 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "http://www.ti.com/lit/sg/scyt129e/scyt129e.pdf" (id 3) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "Single Gate NAND LVC CMOS" (id 4) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Single NAND Gate, Low-Voltage CMOS" (id 5) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_fp_filters" "SOT* SG-*" (id 6) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "74AHC1G00_0_1"
(arc (start 0 -2.54) (mid 2.54 0) (end 0 2.54)
(stroke (width 0.254) (type default) (color 0 0 0 0))
(fill (type none))
)
(polyline
(pts
(xy 0 -2.54)
(xy -3.81 -2.54)
(xy -3.81 2.54)
(xy 0 2.54)
)
(stroke (width 0.254) (type default) (color 0 0 0 0))
(fill (type none))
)
)
(symbol "74AHC1G00_1_1"
(pin input line (at -7.62 1.27 0) (length 3.81)
(name "~" (effects (font (size 1.016 1.016))))
(number "1" (effects (font (size 1.016 1.016))))
)
(pin input line (at -7.62 -1.27 0) (length 3.81)
(name "~" (effects (font (size 1.016 1.016))))
(number "2" (effects (font (size 1.016 1.016))))
)
(pin power_in line (at 0 -2.54 270) (length 0) hide
(name "GND" (effects (font (size 1.016 1.016))))
(number "3" (effects (font (size 1.016 1.016))))
)
(pin output inverted (at 6.35 0 180) (length 3.81)
(name "~" (effects (font (size 1.016 1.016))))
(number "4" (effects (font (size 1.016 1.016))))
)
(pin power_in line (at 0 2.54 90) (length 0) hide
(name "VCC" (effects (font (size 1.016 1.016))))
(number "5" (effects (font (size 1.016 1.016))))
)
)
)
(symbol "Device:LED" (pin_numbers hide) (pin_names (offset 1.016) hide) (in_bom yes) (on_board yes)
(property "Reference" "D" (id 0) (at 0 2.54 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "LED" (id 1) (at 0 -2.54 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "LED diode" (id 4) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Light emitting diode" (id 5) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_fp_filters" "LED* LED_SMD:* LED_THT:*" (id 6) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "LED_0_1"
(polyline
(pts
(xy -1.27 -1.27)
(xy -1.27 1.27)
)
(stroke (width 0.254) (type default) (color 0 0 0 0))
(fill (type none))
)
(polyline
(pts
(xy -1.27 0)
(xy 1.27 0)
)
(stroke (width 0) (type default) (color 0 0 0 0))
(fill (type none))
)
(polyline
(pts
(xy 1.27 -1.27)
(xy 1.27 1.27)
(xy -1.27 0)
(xy 1.27 -1.27)
)
(stroke (width 0.254) (type default) (color 0 0 0 0))
(fill (type none))
)
(polyline
(pts
(xy -3.048 -0.762)
(xy -4.572 -2.286)
(xy -3.81 -2.286)
(xy -4.572 -2.286)
(xy -4.572 -1.524)
)
(stroke (width 0) (type default) (color 0 0 0 0))
(fill (type none))
)
(polyline
(pts
(xy -1.778 -0.762)
(xy -3.302 -2.286)
(xy -2.54 -2.286)
(xy -3.302 -2.286)
(xy -3.302 -1.524)
)
(stroke (width 0) (type default) (color 0 0 0 0))
(fill (type none))
)
)
(symbol "LED_1_1"
(pin passive line (at -3.81 0 0) (length 2.54)
(name "K" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
(pin passive line (at 3.81 0 180) (length 2.54)
(name "A" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27))))
)
)
)
(symbol "power:+3.3V" (power) (pin_names (offset 0)) (in_bom yes) (on_board yes)
(property "Reference" "#PWR" (id 0) (at 0 -3.81 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "+3.3V" (id 1) (at 0 3.556 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "global power" (id 4) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Power symbol creates a global label with name \"+3.3V\"" (id 5) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "+3.3V_0_1"
(polyline
(pts
(xy -0.762 1.27)
(xy 0 2.54)
)
(stroke (width 0) (type default) (color 0 0 0 0))
(fill (type none))
)
(polyline
(pts
(xy 0 0)
(xy 0 2.54)
)
(stroke (width 0) (type default) (color 0 0 0 0))
(fill (type none))
)
(polyline
(pts
(xy 0 2.54)
(xy 0.762 1.27)
)
(stroke (width 0) (type default) (color 0 0 0 0))
(fill (type none))
)
)
(symbol "+3.3V_1_1"
(pin power_in line (at 0 0 90) (length 0) hide
(name "+3.3V" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
)
)
(symbol "power:GND" (power) (pin_names (offset 0)) (in_bom yes) (on_board yes)
(property "Reference" "#PWR" (id 0) (at 0 -6.35 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 0 -3.81 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "global power" (id 4) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Power symbol creates a global label with name \"GND\" , ground" (id 5) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "GND_0_1"
(polyline
(pts
(xy 0 0)
(xy 0 -1.27)
(xy 1.27 -1.27)
(xy 0 -2.54)
(xy -1.27 -1.27)
(xy 0 -1.27)
)
(stroke (width 0) (type default) (color 0 0 0 0))
(fill (type none))
)
)
(symbol "GND_1_1"
(pin power_in line (at 0 0 270) (length 0) hide
(name "GND" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
)
)
)
(wire (pts (xy 106.68 85.09) (xy 121.92 85.09))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 4da620fe-e840-464d-84c2-0534153c10c5)
)
(wire (pts (xy 114.3 76.2) (xy 114.3 82.55))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 66c9dd15-0161-44da-b09d-9959dfb4135c)
)
(wire (pts (xy 135.89 83.82) (xy 138.43 83.82))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 8df5180e-da1b-433b-8d83-93cf79c8ee03)
)
(wire (pts (xy 114.3 82.55) (xy 121.92 82.55))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid d194b087-36c6-4bbe-b3a2-7d2614265bb9)
)
(wire (pts (xy 106.68 76.2) (xy 106.68 85.09))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid de291e2d-9c4d-431d-9f0b-0a95619127e8)
)
(wire (pts (xy 146.05 83.82) (xy 146.05 92.71))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid ea4bce34-3f98-4ba7-9e01-06f7904e5f9a)
)
(text "Actually VCC, see hidden pin." (at 118.11 73.66 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid 1c811b4e-664e-409b-877b-311422b34685)
)
(text "Has hidden global power connections to VCC and GND."
(at 125.73 78.74 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid 321b0365-f429-47a4-80ce-92c064ec9ad3)
)
(symbol (lib_name "+3.3V_1") (lib_id "power:+3.3V") (at 114.3 76.2 0) (unit 1)
(in_bom yes) (on_board yes)
(uuid 1bf214b1-6ac9-4694-be83-f308ad0a37fa)
(property "Reference" "#PWR01002" (id 0) (at 114.3 80.01 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "+3.3V" (id 1) (at 114.3 72.644 0))
(property "Footprint" "" (id 2) (at 114.3 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 114.3 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid c1f73126-4beb-479f-8fef-2b499269661b))
)
(symbol (lib_id "74xGxx:74AHC1G00") (at 129.54 83.82 0) (unit 1)
(in_bom yes) (on_board yes)
(uuid 801334a8-b16d-4581-b41c-57060138b236)
(property "Reference" "U1001" (id 0) (at 127 80.01 0))
(property "Value" "74AHC1G00" (id 1) (at 129.54 87.63 0))
(property "Footprint" "" (id 2) (at 129.54 83.82 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "http://www.ti.com/lit/sg/scyt129e/scyt129e.pdf" (id 3) (at 129.54 83.82 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid c161b5fd-c0a7-443a-9f17-248d8d6c2cb6))
(pin "2" (uuid 913474bc-9666-4184-b0e4-052ab65fd047))
(pin "3" (uuid 1cefec23-03bd-4270-8b5f-c169319c6377))
(pin "4" (uuid 56a80b5e-d0ca-4b6c-ad08-87c330624bf8))
(pin "5" (uuid 2b6bb02f-ee70-493c-b725-e7e0c01e84c9))
)
(symbol (lib_id "power:GND") (at 146.05 92.71 0) (unit 1)
(in_bom yes) (on_board yes)
(uuid ac2f871a-42f2-48ee-931a-84e6d47f5587)
(property "Reference" "#PWR01003" (id 0) (at 146.05 99.06 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 146.05 96.52 0))
(property "Footprint" "" (id 2) (at 146.05 92.71 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 146.05 92.71 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid aba3f728-59c8-4328-879c-0fcdac4cd8f3))
)
(symbol (lib_id "Device:LED") (at 142.24 83.82 180) (unit 1)
(in_bom yes) (on_board yes)
(uuid e3eceee5-b863-4693-8411-20a6d0dcce37)
(property "Reference" "D1001" (id 0) (at 142.24 86.36 0))
(property "Value" "LED" (id 1) (at 142.24 81.28 0))
(property "Footprint" "" (id 2) (at 142.24 83.82 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 142.24 83.82 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid c76efb27-9268-4a26-bf34-cba6ea2986e1))
(pin "2" (uuid ead09f93-db4b-4da4-883a-d43777becfb5))
)
(symbol (lib_id "power:+3.3V") (at 106.68 76.2 0) (unit 1)
(in_bom yes) (on_board yes)
(uuid e5f27bfb-b54d-4584-a941-e20e21a3cd13)
(property "Reference" "#PWR01001" (id 0) (at 106.68 80.01 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "+3.3V" (id 1) (at 106.68 72.644 0))
(property "Footprint" "" (id 2) (at 106.68 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 106.68 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid b87d1674-f1cc-40ff-9348-0a0395b8edcf))
)
(sheet_instances
(path "/" (page "1"))
)
(symbol_instances
(path "/e5f27bfb-b54d-4584-a941-e20e21a3cd13"
(reference "#PWR01001") (unit 1) (value "+3.3V") (footprint "")
)
(path "/1bf214b1-6ac9-4694-be83-f308ad0a37fa"
(reference "#PWR01002") (unit 1) (value "+3.3V") (footprint "")
)
(path "/ac2f871a-42f2-48ee-931a-84e6d47f5587"
(reference "#PWR01003") (unit 1) (value "GND") (footprint "")
)
(path "/e3eceee5-b863-4693-8411-20a6d0dcce37"
(reference "D1001") (unit 1) (value "LED") (footprint "")
)
(path "/801334a8-b16d-4581-b41c-57060138b236"
(reference "U1001") (unit 1) (value "74AHC1G00") (footprint "")
)
)
)

View File

@ -0,0 +1,85 @@
(export (version "E")
(design
(source "/home/mike/Projects/src/kicad/qa/data/eeschema/netlists/legacy_power/legacy_power.kicad_sch")
(date "Mon 20 Feb 2023 10:37:01 AM EST")
(tool "Eeschema 6.0.10-86aedd382b~118~ubuntu22.10.1")
(sheet (number "1") (name "/") (tstamps "/")
(title_block
(title)
(company)
(rev)
(date)
(source "legacy_power.kicad_sch")
(comment (number "1") (value ""))
(comment (number "2") (value ""))
(comment (number "3") (value ""))
(comment (number "4") (value ""))
(comment (number "5") (value ""))
(comment (number "6") (value ""))
(comment (number "7") (value ""))
(comment (number "8") (value ""))
(comment (number "9") (value "")))))
(components
(comp (ref "D1001")
(value "LED")
(libsource (lib "Device") (part "LED") (description "Light emitting diode"))
(property (name "Sheetname") (value ""))
(property (name "Sheetfile") (value "legacy_power.kicad_sch"))
(sheetpath (names "/") (tstamps "/"))
(tstamps "e3eceee5-b863-4693-8411-20a6d0dcce37"))
(comp (ref "U1001")
(value "74AHC1G00")
(datasheet "http://www.ti.com/lit/sg/scyt129e/scyt129e.pdf")
(libsource (lib "74xGxx") (part "74AHC1G00") (description "Single NAND Gate, Low-Voltage CMOS"))
(property (name "Sheetname") (value ""))
(property (name "Sheetfile") (value "legacy_power.kicad_sch"))
(sheetpath (names "/") (tstamps "/"))
(tstamps "801334a8-b16d-4581-b41c-57060138b236")))
(libparts
(libpart (lib "74xGxx") (part "74AHC1G00")
(description "Single NAND Gate, Low-Voltage CMOS")
(docs "http://www.ti.com/lit/sg/scyt129e/scyt129e.pdf")
(footprints
(fp "SOT*")
(fp "SG-*"))
(fields
(field (name "Reference") "U")
(field (name "Value") "74AHC1G00")
(field (name "Datasheet") "http://www.ti.com/lit/sg/scyt129e/scyt129e.pdf"))
(pins
(pin (num "1") (name "") (type "input"))
(pin (num "2") (name "") (type "input"))
(pin (num "3") (name "GND") (type "power_in"))
(pin (num "4") (name "") (type "output"))
(pin (num "5") (name "VCC") (type "power_in"))))
(libpart (lib "Device") (part "LED")
(description "Light emitting diode")
(docs "~")
(footprints
(fp "LED*")
(fp "LED_SMD:*")
(fp "LED_THT:*"))
(fields
(field (name "Reference") "D")
(field (name "Value") "LED")
(field (name "Datasheet") "~"))
(pins
(pin (num "1") (name "K") (type "passive"))
(pin (num "2") (name "A") (type "passive")))))
(libraries
(library (logical "74xGxx")
(uri "/usr/share/kicad/symbols//74xGxx.kicad_sym"))
(library (logical "Device")
(uri "/usr/share/kicad/symbols//Device.kicad_sym")))
(nets
(net (code "1") (name "+3.3V")
(node (ref "U1001") (pin "2") (pintype "input")))
(net (code "2") (name "GND")
(node (ref "D1001") (pin "1") (pinfunction "K") (pintype "passive"))
(node (ref "U1001") (pin "3") (pinfunction "GND") (pintype "power_in")))
(net (code "3") (name "Net-(D1001-Pad2)")
(node (ref "D1001") (pin "2") (pinfunction "A") (pintype "passive"))
(node (ref "U1001") (pin "4") (pintype "output")))
(net (code "4") (name "VCC")
(node (ref "U1001") (pin "1") (pintype "input"))
(node (ref "U1001") (pin "5") (pinfunction "VCC") (pintype "power_in")))))

View File

@ -0,0 +1,3 @@
EESchema-DOCLIB Version 2.0
#
#End Doc Library

View File

@ -0,0 +1,51 @@
EESchema-LIBRARY Version 2.3
#encoding utf-8
#
# +3V3
#
DEF +3V3 #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "+3V3" 0 140 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
ALIAS +3.3V
DRAW
P 2 0 1 0 -30 50 0 100 N
P 2 0 1 0 0 0 0 100 N
P 2 0 1 0 0 100 30 50 N
X VCC 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# GND
#
DEF GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -250 50 H I C CNN
F1 "GND" 0 -150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
X GND 1 0 0 0 D 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# R
#
DEF R R 0 0 N Y 1 F N
F0 "R" 80 0 50 V V C CNN
F1 "R" 0 0 50 V V C CNN
F2 "" -70 0 50 V I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
R_*
R_*
$ENDFPLIST
DRAW
S -40 -100 40 100 0 1 10 N
X ~ 1 0 150 50 D 50 50 1 1 P
X ~ 2 0 -150 50 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
#End Library

View File

@ -0,0 +1 @@
(kicad_pcb (version 4) (host kicad "dummy file") )

View File

@ -0,0 +1,48 @@
(export (version D)
(design
(source Z:/legacy_power4/legacy_power4.sch)
(date "2/22/2023 9:37:06 AM")
(tool "Eeschema 4.0.7")
(sheet (number 1) (name /) (tstamps /)
(title_block
(title)
(company)
(rev)
(date)
(source legacy_power4.sch)
(comment (number 1) (value ""))
(comment (number 2) (value ""))
(comment (number 3) (value ""))
(comment (number 4) (value "")))))
(components
(comp (ref R1)
(value R)
(libsource (lib symbols) (part R))
(sheetpath (names /) (tstamps /))
(tstamp 63F628CC))
(comp (ref R2)
(value R)
(libsource (lib symbols) (part R))
(sheetpath (names /) (tstamps /))
(tstamp 63F6292B)))
(libparts
(libpart (lib symbols) (part R)
(footprints
(fp R_*)
(fp R_*))
(fields
(field (name Reference) R)
(field (name Value) R))
(pins
(pin (num 1) (name ~) (type passive))
(pin (num 2) (name ~) (type passive)))))
(libraries
(library (logical symbols)
(uri Z:\legacy_power4\symbols.lib)))
(nets
(net (code 1) (name VCC)
(node (ref R1) (pin 1))
(node (ref R2) (pin 1)))
(net (code 2) (name GND)
(node (ref R1) (pin 2))
(node (ref R2) (pin 2)))))

View File

@ -0,0 +1,32 @@
update=2/22/2023 9:36:23 AM
version=1
last_client=kicad
[pcbnew]
version=1
LastNetListRead=
UseCmpFile=1
PadDrill=0.600000000000
PadDrillOvalY=0.600000000000
PadSizeH=1.500000000000
PadSizeV=1.500000000000
PcbTextSizeV=1.500000000000
PcbTextSizeH=1.500000000000
PcbTextThickness=0.300000000000
ModuleTextSizeV=1.000000000000
ModuleTextSizeH=1.000000000000
ModuleTextSizeThickness=0.150000000000
SolderMaskClearance=0.000000000000
SolderMaskMinWidth=0.000000000000
DrawSegmentWidth=0.200000000000
BoardOutlineThickness=0.100000000000
ModuleOutlineThickness=0.150000000000
[cvpcb]
version=1
NetIExt=net
[general]
version=1
[eeschema]
version=1
LibDir=
[eeschema/libraries]
LibName1=symbols

View File

@ -0,0 +1,86 @@
EESchema Schematic File Version 2
LIBS:symbols
LIBS:legacy_power4-cache
EELAYER 25 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title ""
Date ""
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
Text Notes 2850 1650 0 60 ~ 0
Actually VCC, see hidden pin.
$Comp
L +3.3V #PWR01
U 1 1 63F628AD
P 3100 1900
F 0 "#PWR01" H 3100 1750 50 0001 C CNN
F 1 "+3.3V" H 3100 2040 50 0000 C CNN
F 2 "" H 3100 1900 50 0001 C CNN
F 3 "" H 3100 1900 50 0001 C CNN
1 3100 1900
1 0 0 -1
$EndComp
$Comp
L +3.3V #PWR02
U 1 1 63F628BF
P 3450 1900
F 0 "#PWR02" H 3450 1750 50 0001 C CNN
F 1 "+3.3V" H 3450 2040 50 0000 C CNN
F 2 "" H 3450 1900 50 0001 C CNN
F 3 "" H 3450 1900 50 0001 C CNN
1 3450 1900
1 0 0 -1
$EndComp
$Comp
L R R1
U 1 1 63F628CC
P 3100 2050
F 0 "R1" V 3180 2050 50 0000 C CNN
F 1 "R" V 3100 2050 50 0000 C CNN
F 2 "" V 3030 2050 50 0001 C CNN
F 3 "" H 3100 2050 50 0001 C CNN
1 3100 2050
1 0 0 -1
$EndComp
$Comp
L R R2
U 1 1 63F6292B
P 3450 2050
F 0 "R2" V 3530 2050 50 0000 C CNN
F 1 "R" V 3450 2050 50 0000 C CNN
F 2 "" V 3380 2050 50 0001 C CNN
F 3 "" H 3450 2050 50 0001 C CNN
1 3450 2050
1 0 0 -1
$EndComp
$Comp
L GND #PWR03
U 1 1 63F6294F
P 3100 2200
F 0 "#PWR03" H 3100 1950 50 0001 C CNN
F 1 "GND" H 3100 2050 50 0000 C CNN
F 2 "" H 3100 2200 50 0001 C CNN
F 3 "" H 3100 2200 50 0001 C CNN
1 3100 2200
1 0 0 -1
$EndComp
$Comp
L GND #PWR04
U 1 1 63F62967
P 3450 2200
F 0 "#PWR04" H 3450 1950 50 0001 C CNN
F 1 "GND" H 3450 2050 50 0000 C CNN
F 2 "" H 3450 2200 50 0001 C CNN
F 3 "" H 3450 2200 50 0001 C CNN
1 3450 2200
1 0 0 -1
$EndComp
$EndSCHEMATC

View File

@ -0,0 +1,3 @@
EESchema-DOCLIB Version 2.0
#
#End Doc Library

View File

@ -0,0 +1,51 @@
EESchema-LIBRARY Version 2.3
#encoding utf-8
#
# +3V3
#
DEF +3V3 #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "+3V3" 0 140 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
ALIAS +3.3V
DRAW
P 2 0 1 0 -30 50 0 100 N
P 2 0 1 0 0 0 0 100 N
P 2 0 1 0 0 100 30 50 N
X VCC 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# GND
#
DEF GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -250 50 H I C CNN
F1 "GND" 0 -150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
X GND 1 0 0 0 D 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# R
#
DEF R R 0 0 N Y 1 F N
F0 "R" 80 0 50 V V C CNN
F1 "R" 0 0 50 V V C CNN
F2 "" -70 0 50 V I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
R_*
R_*
$ENDFPLIST
DRAW
S -40 -100 40 100 0 1 10 N
X ~ 1 0 150 50 D 50 50 1 1 P
X ~ 2 0 -150 50 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
#End Library

View File

@ -184,6 +184,9 @@ void LoadSchematic( SETTINGS_MANAGER& aSettingsManager, const wxString& aRelPath
sheets.UpdateSymbolInstanceData( aSchematic->RootScreen()->GetSymbolInstances() );
sheets.UpdateSheetInstanceData( aSchematic->RootScreen()->GetSheetInstances() );
if( aSchematic->RootScreen()->GetFileFormatVersionAtLoad() < 20230221 )
screens.FixLegacyPowerSymbolMismatches();
if( aSchematic->RootScreen()->GetFileFormatVersionAtLoad() < 20221206 )
{
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )

View File

@ -78,6 +78,7 @@ set( QA_EESCHEMA_SRCS
test_netlist_exporter_kicad.cpp
test_netlist_exporter_spice.cpp
test_ee_item.cpp
test_legacy_power_symbols.cpp
test_pin_numbers.cpp
test_sch_pin.cpp
test_sch_rtree.cpp

View File

@ -104,6 +104,9 @@ void KI_TEST::SCHEMATIC_TEST_FIXTURE::LoadSchematic( const wxString& aBaseName )
screen->MigrateSimModels();
}
if( m_schematic.RootScreen()->GetFileFormatVersionAtLoad() < 20230221 )
screens.FixLegacyPowerSymbolMismatches();
sheets.AnnotatePowerSymbols();
// NOTE: This is required for multi-unit symbols to be correct

View File

@ -0,0 +1,73 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 KiCad Developers, see AUTHORS.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one at
* http://www.gnu.org/licenses/
*/
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <schematic_utils/schematic_file_util.h>
#include <connection_graph.h>
#include <schematic.h>
#include <sch_screen.h>
#include <settings/settings_manager.h>
#include <locale_io.h>
struct LEGACY_POWER_SYMBOLS_TEST_FIXTURE
{
LEGACY_POWER_SYMBOLS_TEST_FIXTURE() :
m_settingsManager( true /* headless */ )
{ }
void CheckSymbols()
{
for( SCH_ITEM* item : m_schematic->RootScreen()->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
// Fix pre-8.0 legacy power symbols with invisible pins
// that have mismatched pin names and value fields
if( symbol->GetLibSymbolRef()
&& symbol->GetLibSymbolRef()->IsPower()
&& symbol->GetAllLibPins().size() > 0
&& symbol->GetAllLibPins()[0]->IsGlobalPower()
&& !symbol->GetAllLibPins()[0]->IsVisible() )
{
BOOST_CHECK_EQUAL( symbol->GetValueFieldText(true), symbol->GetAllLibPins()[0]->GetName() );
}
}
}
SETTINGS_MANAGER m_settingsManager;
std::unique_ptr<SCHEMATIC> m_schematic;
};
BOOST_FIXTURE_TEST_CASE( LegacyPowerFixup, LEGACY_POWER_SYMBOLS_TEST_FIXTURE )
{
KI_TEST::LoadSchematic( m_settingsManager, "netlists/legacy_power/legacy_power", m_schematic );
CheckSymbols();
}
BOOST_FIXTURE_TEST_CASE( LegacyPower4Fixup, LEGACY_POWER_SYMBOLS_TEST_FIXTURE )
{
KI_TEST::LoadSchematic( m_settingsManager, "netlists/legacy_power/legacy_power", m_schematic );
CheckSymbols();
}

View File

@ -171,4 +171,14 @@ BOOST_AUTO_TEST_CASE( BusEntries )
doNetlistTest( "bus_entries" );
}
BOOST_AUTO_TEST_CASE( LegacyPower )
{
doNetlistTest( "legacy_power" );
}
BOOST_AUTO_TEST_CASE( LegacyPower4 )
{
doNetlistTest( "legacy_power4" );
}
BOOST_AUTO_TEST_SUITE_END()