[SKiDL BUG] `netlist_to_skidl` requires top sheet

Aperta
#246 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python
Ambito
cli

Direzione di ricerca

Start by running netlist_to_skidl -i simple.net -o simple_out with the supplied fixture and compare the generated main.py and r2.py. Trace the netlist_to_skidl parsing entry point and the handling of top-sheet components and nets, then verify that R1, R3, and top-level connections appear in the generated output alongside the existing hierarchical r2 subcircuit. A regression test should run this fixture and assert both top-level parts and nets.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

In development branch the new logic for netlist_to_skidl will not properly parse parts or nets on the top sheet. So you must have the top sheet just be documentation and other schematic sheets. However, this logic works well for complex hierarchical sheets so we should leave it in for now.

Example of erroneous behavior:

Terminal command:

netlist_to_skidl -i simple.net -o simple_out

netlist file simple.net:

(export (version "E")
  (design
    (source "/Users/shanemattner/Desktop/skidl/simple/simple.kicad_sch")
    (date "2025-02-03T19:07:40-0800")
    (tool "Eeschema 8.0.8")
    (sheet (number "1") (name "/") (tstamps "/")
      (title_block
        (title)
        (company)
        (rev)
        (date)
        (source "simple.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 ""))))
    (sheet (number "2") (name "/r2/") (tstamps "/f0106cc7-bcaf-4eae-80a7-294f7e8ff323/")
      (title_block
        (title)
        (company)
        (rev)
        (date)
        (source "r2.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 "R1")
      (value "R")
      (description "Resistor")
      (fields
        (field (name "Footprint"))
        (field (name "Datasheet"))
        (field (name "Description") "Resistor"))
      (libsource (lib "Device") (part "R") (description "Resistor"))
      (property (name "Sheetname") (value "Root"))
      (property (name "Sheetfile") (value "simple.kicad_sch"))
      (property (name "ki_keywords") (value "R res resistor"))
      (property (name "ki_fp_filters") (value "R_*"))
      (sheetpath (names "/") (tstamps "/"))
      (tstamps "b877a166-ca19-4ecc-a7fb-fdc585ad6315"))
    (comp (ref "R3")
      (value "R")
      (description "Resistor")
      (fields
        (field (name "Footprint"))
        (field (name "Datasheet"))
        (field (name "Description") "Resistor"))
      (libsource (lib "Device") (part "R") (description "Resistor"))
      (property (name "Sheetname") (value "Root"))
      (property (name "Sheetfile") (value "simple.kicad_sch"))
      (property (name "ki_keywords") (value "R res resistor"))
      (property (name "ki_fp_filters") (value "R_*"))
      (sheetpath (names "/") (tstamps "/"))
      (tstamps "f52ce8ae-1b07-4abf-b779-2b61cb5c82e0"))
    (comp (ref "R2")
      (value "R")
      (description "Resistor")
      (fields
        (field (name "Footprint"))
        (field (name "Datasheet"))
        (field (name "Description") "Resistor"))
      (libsource (lib "Device") (part "R") (description "Resistor"))
      (property (name "Sheetname") (value "r2"))
      (property (name "Sheetfile") (value "r2.kicad_sch"))
      (property (name "ki_keywords") (value "R res resistor"))
      (property (name "ki_fp_filters") (value "R_*"))
      (sheetpath (names "/r2/") (tstamps "/f0106cc7-bcaf-4eae-80a7-294f7e8ff323/"))
      (tstamps "8d8ce9d4-7aee-497b-9789-d162dd2ef370")))
  (libparts
    (libpart (lib "Device") (part "R")
      (description "Resistor")
      (docs "~")
      (footprints
        (fp "R_*"))
      (fields
        (field (name "Reference") "R")
        (field (name "Value") "R")
        (field (name "Footprint"))
        (field (name "Datasheet") "~")
        (field (name "Description") "Resistor"))
      (pins
        (pin (num "1") (name "") (type "passive"))
        (pin (num "2") (name "") (type "passive")))))
  (libraries
    (library (logical "Device")
      (uri "/Applications/KiCad/KiCad.app/Contents/SharedSupport/symbols//Device.kicad_sym")))
  (nets
    (net (code "1") (name "+3V3")
      (node (ref "R1") (pin "1") (pintype "passive")))
    (net (code "2") (name "/r2/pwr_in")
      (node (ref "R1") (pin "2") (pintype "passive"))
      (node (ref "R2") (pin "1") (pintype "passive"))
      (node (ref "R3") (pin "1") (pintype "passive")))
    (net (code "3") (name "GND")
      (node (ref "R2") (pin "2") (pintype "passive"))
      (node (ref "R3") (pin "2") (pintype "passive")))))

main.py output:

# -*- coding: utf-8 -*-
from skidl import *
from r2 import r2


def main():
    # Create global nets

    # Create subcircuits
    r2()

if __name__ == "__main__":
    main()
    generate_netlist()

r2.py output:

# -*- coding: utf-8 -*-
from skidl import *

@subcircuit
def r2():
    # Local nets
    r2_pwr_in = Net('/r2/pwr_in')
    GND = Net('GND')

    # Components
    R2 = Part('Device', 'R', value='R', ref='R2', fields={'Sheetname': 'r2', 'Sheetfile': 'r2.kicad_sch', 'ki_keywords': 'R res resistor', 'ki_fp_filters': 'R_*'})


    # Connections
    r2_pwr_in += R2['1']
    GND += R2['2']
    return

Lingua principale
Python
Stelle
1.7k
Fork
184
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di devbisme/skidl

Tutte le issue di devbisme/skidl

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.