Skip to content

Commit

Permalink
cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
ducky64 committed Oct 28, 2024
1 parent 0ea1fed commit 6ab5295
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 21 deletions.
5 changes: 3 additions & 2 deletions edg/electronics_model/CircuitBlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ def footprint(self, refdes: StringLike, footprint: StringLike, pinning: Mapping[


class WrapperFootprintBlock(FootprintBlock):
"""Block that has a footprint and optionally internal contents, but the netlister ignores internal components.
Useful for, for example, a breakout board where the modelling details are provided by the chip circuit itself.
"""Block that has a footprint and optional internal contents, but the netlister ignores internal components.
Useful for, for example, a breakout board where the modelling details are provided by internal chip blocks,
but needs to show up as only a carrier board footprint.
EXPERIMENTAL - API SUBJECT TO CHANGE."""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down
7 changes: 4 additions & 3 deletions edg/electronics_model/NetlistGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Netlist(NamedTuple):
blocks: List[NetBlock]
nets: List[Net]


# The concept of board scopes is footprints associated with a scope (defined as a path) that is a board,
# to support multi-board assemblies and virtual components.
# The default (top-level) board has TransformUtil.Path.empty().
Expand Down Expand Up @@ -77,15 +78,15 @@ def __init__(self, design: CompiledDesign):
def process_blocklike(self, path: TransformUtil.Path, block: Union[edgir.Link, edgir.LinkArray, edgir.HierarchyBlock]) -> None:
# TODO may need rethought to support multi-board assemblies
scope = self.scopes[path] # including footprint and exports, and everything within a link
internal_scope = scope # for link connections within this block, if this is a block
internal_scope = scope # for internal blocks

if isinstance(block, edgir.HierarchyBlock):
if 'fp_is_wrapper' in block.meta.members.node: # wrapper internal blocks ignored
internal_scope = None
for block_pair in block.blocks:
self.scopes[path.append_block(block_pair.name)] = internal_scope
for link_pair in block.links:
self.scopes[path.append_link(link_pair.name)] = internal_scope
for link_pair in block.links: # links considered to be the same scope as self
self.scopes[path.append_link(link_pair.name)] = scope

# generate short paths for children first, for Blocks only
main_internal_blocks: Dict[str, edgir.BlockLike] = {}
Expand Down
2 changes: 1 addition & 1 deletion edg/electronics_model/RefdesRefinementPass.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, design: CompiledDesign):
}

self.block_refdes_list: List[Tuple[TransformUtil.Path, str]] = [] # populated in traversal order
self.refdes_last: Dict[(TransformUtil.Path, str), int] = {} # (scope, prefix) -> num
self.refdes_last: Dict[Tuple[TransformUtil.Path, str], int] = {} # (scope, prefix) -> num

def visit_block(self, context: TransformUtil.TransformContext, block: edgir.BlockTypes) -> None:
scope = self.scopes[context.path]
Expand Down
2 changes: 1 addition & 1 deletion edg/parts/Distance_Vl53l0x.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Vl53l0xConnector(Vl53l0x, WrapperFootprintBlock):
def generate(self):
super().generate()
self.footprint(
'J', 'Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical',
'J', 'Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_Vertical',
{
'1': self.pwr,
'2': self.gnd,
Expand Down
8 changes: 4 additions & 4 deletions examples/PcbBot/PcbBot.net
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@
(tstamps "0296014b"))
(comp (ref "tof.elt[0]")
(value "")
(footprint "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical")
(footprint "Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_Vertical")
(property (name "Sheetname") (value "tof"))
(property (name "Sheetfile") (value "edg.parts.Distance_Vl53l0x.Vl53l0xArray"))
(property (name "edg_path") (value "tof.elt[0]"))
Expand All @@ -475,7 +475,7 @@
(tstamps "081e022e"))
(comp (ref "tof.elt[1]")
(value "")
(footprint "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical")
(footprint "Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_Vertical")
(property (name "Sheetname") (value "tof"))
(property (name "Sheetfile") (value "edg.parts.Distance_Vl53l0x.Vl53l0xArray"))
(property (name "edg_path") (value "tof.elt[1]"))
Expand All @@ -486,7 +486,7 @@
(tstamps "0820022f"))
(comp (ref "tof.elt[2]")
(value "")
(footprint "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical")
(footprint "Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_Vertical")
(property (name "Sheetname") (value "tof"))
(property (name "Sheetfile") (value "edg.parts.Distance_Vl53l0x.Vl53l0xArray"))
(property (name "edg_path") (value "tof.elt[2]"))
Expand All @@ -497,7 +497,7 @@
(tstamps "08220230"))
(comp (ref "tof.elt[3]")
(value "")
(footprint "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical")
(footprint "Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_Vertical")
(property (name "Sheetname") (value "tof"))
(property (name "Sheetfile") (value "edg.parts.Distance_Vl53l0x.Vl53l0xArray"))
(property (name "edg_path") (value "tof.elt[3]"))
Expand Down
8 changes: 4 additions & 4 deletions examples/PcbBot/PcbBot.ref.net
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@
(tstamps "0296014b"))
(comp (ref "J4")
(value "")
(footprint "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical")
(footprint "Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_Vertical")
(property (name "Sheetname") (value "tof"))
(property (name "Sheetfile") (value "edg.parts.Distance_Vl53l0x.Vl53l0xArray"))
(property (name "edg_path") (value "tof.elt[0]"))
Expand All @@ -475,7 +475,7 @@
(tstamps "081e022e"))
(comp (ref "J5")
(value "")
(footprint "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical")
(footprint "Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_Vertical")
(property (name "Sheetname") (value "tof"))
(property (name "Sheetfile") (value "edg.parts.Distance_Vl53l0x.Vl53l0xArray"))
(property (name "edg_path") (value "tof.elt[1]"))
Expand All @@ -486,7 +486,7 @@
(tstamps "0820022f"))
(comp (ref "J6")
(value "")
(footprint "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical")
(footprint "Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_Vertical")
(property (name "Sheetname") (value "tof"))
(property (name "Sheetfile") (value "edg.parts.Distance_Vl53l0x.Vl53l0xArray"))
(property (name "edg_path") (value "tof.elt[2]"))
Expand All @@ -497,7 +497,7 @@
(tstamps "08220230"))
(comp (ref "J7")
(value "")
(footprint "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical")
(footprint "Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_Vertical")
(property (name "Sheetname") (value "tof"))
(property (name "Sheetfile") (value "edg.parts.Distance_Vl53l0x.Vl53l0xArray"))
(property (name "edg_path") (value "tof.elt[3]"))
Expand Down
6 changes: 3 additions & 3 deletions examples/RobotDriver/RobotDriver.net
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@
(tstamps "00640064"))
(comp (ref "tof.elt[0]")
(value "")
(footprint "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical")
(footprint "Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_Vertical")
(property (name "Sheetname") (value "tof"))
(property (name "Sheetfile") (value "edg.parts.Distance_Vl53l0x.Vl53l0xArray"))
(property (name "edg_path") (value "tof.elt[0]"))
Expand All @@ -321,7 +321,7 @@
(tstamps "081e022e"))
(comp (ref "tof.elt[1]")
(value "")
(footprint "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical")
(footprint "Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_Vertical")
(property (name "Sheetname") (value "tof"))
(property (name "Sheetfile") (value "edg.parts.Distance_Vl53l0x.Vl53l0xArray"))
(property (name "edg_path") (value "tof.elt[1]"))
Expand All @@ -332,7 +332,7 @@
(tstamps "0820022f"))
(comp (ref "tof.elt[2]")
(value "")
(footprint "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical")
(footprint "Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_Vertical")
(property (name "Sheetname") (value "tof"))
(property (name "Sheetfile") (value "edg.parts.Distance_Vl53l0x.Vl53l0xArray"))
(property (name "edg_path") (value "tof.elt[2]"))
Expand Down
6 changes: 3 additions & 3 deletions examples/RobotDriver/RobotDriver.ref.net
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@
(tstamps "00640064"))
(comp (ref "J3")
(value "")
(footprint "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical")
(footprint "Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_Vertical")
(property (name "Sheetname") (value "tof"))
(property (name "Sheetfile") (value "edg.parts.Distance_Vl53l0x.Vl53l0xArray"))
(property (name "edg_path") (value "tof.elt[0]"))
Expand All @@ -321,7 +321,7 @@
(tstamps "081e022e"))
(comp (ref "J4")
(value "")
(footprint "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical")
(footprint "Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_Vertical")
(property (name "Sheetname") (value "tof"))
(property (name "Sheetfile") (value "edg.parts.Distance_Vl53l0x.Vl53l0xArray"))
(property (name "edg_path") (value "tof.elt[1]"))
Expand All @@ -332,7 +332,7 @@
(tstamps "0820022f"))
(comp (ref "J5")
(value "")
(footprint "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical")
(footprint "Connector_PinSocket_2.54mm:PinSocket_1x06_P2.54mm_Vertical")
(property (name "Sheetname") (value "tof"))
(property (name "Sheetfile") (value "edg.parts.Distance_Vl53l0x.Vl53l0xArray"))
(property (name "edg_path") (value "tof.elt[2]"))
Expand Down

0 comments on commit 6ab5295

Please sign in to comment.