Skip to content

Commit a33569c

Browse files
authored
Merge branch 'master' into correspondance-tables
2 parents b3cc3fa + 2ab8e6a commit a33569c

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

component_sketch.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,6 +2015,10 @@ def draw_chip(self, x_distance, y_distance, scale=1, width=-1, direction=HORIZON
20152015
dim["chipWidth"] = kwargs.get("chipWidth", dim["chipWidth"])
20162016
dim["label"] = kwargs.get("label", dim["label"])
20172017
dim["internalFunc"] = kwargs.get("internalFunc", None)
2018+
dim["pwr"] = kwargs.get("pwr", None)
2019+
2020+
logic_function_name = kwargs.get("logicFunctionName", None)
2021+
20182022
cover_open = kwargs.get("open", NO)
20192023
chip_id = kwargs.get("id", None)
20202024
tags = kwargs.get("tags", [])
@@ -2052,6 +2056,7 @@ def draw_chip(self, x_distance, y_distance, scale=1, width=-1, direction=HORIZON
20522056
params["label"] = label
20532057
params["type"] = chip_type
20542058
params["btnMenu"] = [1, 1, 0]
2059+
params["pwr"] = dim["pwr"]
20552060
num_pins_per_side = dim["pinCount"] // 2
20562061
tag_base = "base" + chip_id
20572062
tag_menu = "menu" + chip_id

object_model/circuit_object_model.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
XnorGate,
3333
XorGate,
3434
)
35-
from .circuit_util_elements import ConnectionPointID, FunctionRepresentation
35+
from .circuit_util_elements import ConnectionPointID, FunctionRepresentation, Pin
3636

3737

3838
@dataclass
@@ -82,6 +82,8 @@ def __init__(
8282
description: str | None = None,
8383
pkg: Package | None = None,
8484
functions: list[ChipFunction] | None = None,
85+
vcc: Pin | None = None,
86+
gnd: Pin | None = None,
8587
position: ConnectionPointID | None = None,
8688
model: Chip | None = None,
8789
):
@@ -102,6 +104,8 @@ def __init__(
102104
and description is not None
103105
and pkg is not None
104106
and functions is not None
107+
and vcc is not None
108+
and gnd is not None
105109
and model is None
106110
):
107111
self.chip_type = chip_type
@@ -110,6 +114,8 @@ def __init__(
110114
self.pin_count: int = pkg.pin_count
111115
self.chip_width: float = pkg.chip_width
112116
self.functions: list[ChipFunction] = functions
117+
self.vcc = vcc
118+
self.gnd = gnd
113119
if position is not None:
114120
for fn in self.functions:
115121
fn.calculate_pin_pos(position, 1, self.pin_count)
@@ -123,6 +129,8 @@ def __init__(
123129
self.pin_count = model.pin_count
124130
self.chip_width = model.chip_width
125131
self.functions = model.functions
132+
self.vcc = model.vcc
133+
self.gnd = model.gnd
126134
else:
127135
raise ValueError("Invalid parameters provided.")
128136

@@ -237,6 +245,8 @@ def from_json(json_data: dict, package_dict: dict[str, Package] | None = None):
237245
json_data["description"],
238246
package_dict[json_data["package"]],
239247
functions,
248+
Pin(json_data["vcc_pin"], None),
249+
Pin(json_data["gnd_pin"], None),
240250
)
241251

242252
raise ValueError("The package does not exist in the Components/Packages directory.")
@@ -254,6 +264,7 @@ def to_generic_dict(self) -> dict[str, Any]:
254264
"packageName": self.package_name,
255265
"pinCount": self.pin_count,
256266
"chipWidth": self.chip_width,
267+
"pwr": [(self.vcc.pin_num, "+"), (self.gnd.pin_num, "-")],
257268
}
258269

259270
if self.functions:

0 commit comments

Comments
 (0)