Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prod 598 remove get connected net #185

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 0 additions & 74 deletions src/design/introspection.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -448,55 +448,6 @@ public defn find-instance-by-ref (r:Ref, cxt:JITXObject = self) -> Maybe<JITXObj

trail-comp?

doc: \<DOC>
Get the net associated with a module or component port

This function must be called from within a `pcb-module` context.

Note that this function will fail to find a net if the passed `pt`
port is not part of a component or module in the local context.
For example, if the design contains:

```stanza
pcb-module wrapper:
port GND
inst C : some-component

; `INT` is defined only in the `wrapper`
; context.
net INT (C.internal-port, ...)

pcb-module top-level:

inst W : wrapper
net GND (W.GND)

; This will work
val n1 = get-connected-net!(W.GND)

; This will not work
val n2 = get-connected-net!(W.C.internal-port)
```

The value for `n1` will be successfully found as the `GND`
net because it is defined within the `pcb-module` context.

The `n2` invocation will fail to find `INT` as the net
for `W.C.internal-port` and return `None()`.

@param pt Port of a component or module in this module context.
@param cxt Optional context to search. The default value is `self`.
@return If a connection is found - this function returns the Net as
a JITXObject. If no connection is found - then None().
<DOC>
public defn get-connected-net (pt:JITXObject, cxt:JITXObject = self) -> Maybe<JITXObject>:
inside pcb-module:
for n in nets(cxt) first :
if connected?([pt, n]):
One(n)
else:
None()

doc: \<DOC>
Get all net statements associated with a module or component port

Expand Down Expand Up @@ -549,31 +500,6 @@ public defn get-connected-nets (pt:JITXObject, cxt:JITXObject = self) -> Tuple<J
else:
None()

doc: \<DOC>
Get the net associated with a module or component port

This function must be called from within a `pcb-module` context.

This function has similar constraints to @{link get-connected-net}.

@param pt Port of a component or module in this module context.
@param cxt Optional context to search. The default value is `self`.
@return A `Net` object as a JITXObject if the port is connected.
@throws ValueError if no net connections are found or if more than one net
connection is found.
<DOC>
public defn get-connected-net! (pt:JITXObject, cxt:JITXObject = self) -> JITXObject:
inside pcb-module:
val n-set = to-tuple $ for n in nets(cxt) filter :
connected?([pt, n])

if length(n-set) == 0:
throw $ ValueError("Invalid Port - No net connection found")
else if length(n-set) > 1 :
throw $ ValueError("Invalid Port - Multiple Nets Associated - Expected Singular Net")

n-set[0]

doc: \<DOC>
Port Info Object

Expand Down
4 changes: 2 additions & 2 deletions src/landpatterns/thermal-vias.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ public defmethod make-thermal-vias (tv:GridThermalVias, pt:PortInfo -- via-net?:
; arrangement so that the target pad is associated with a single port.
val pd-info = get-largest-pad( pad-set(pt) )
val pad-origin = pose(pd-info)

geom(n):
net via-net (n)
geom(via-net):
for pos in grid(grid-def(tv)) do:
val [r, c] = [row(pos), column(pos)]
if active?(tv, r, c):
Expand Down