Files
diodeinc__pcb/test-workspaces/with-pcb-toml/modules/PowerSupplyModule.zen
Akhil Velagapudi 1636bc18f7 [DIO-300] Add pcb release command (#69)
* Add pcb release command

Intentially spartan in terms of flags/arguments. All that's needed is
the path to the .zen file.

To test:
cargo run -- release crates/pcb/test-workspace/boards/TestBoard.zen

Implemented:
- Workspace root detection (even without pcb.toml)
- Git-based versioning (e.g. tag > commit hash > dirty commit hash)
- Zen source files copied into release dir (release-dir/src)
- Dependencies are vendored into release dir (release-dir/src/vendor)
- Unmatched bom is generated into release dir (release-dir/bom)
- KiCad layout dir is copied into release dir (release-dir/layout)
- Metadata file is generated into release dir (release-dir/metadata.json)
- Generated artifacts are stored in .pcb/ dir (for now) and not uploaded

TODO:
- Upload the release bundle to API server
- Add a --dry-run to generate release bundle but not upload (similar to
  cargo)
- Use the vendor/ dir for dependency resolution for deterministic builds
- Add pcb vendor subcommand, --offline flag for build/layout
- Add more release artifacts (e.g. gerbers, odb, etc.)

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Fix windows compat

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Add support, test-coverage for workspace-relative loads

Assume that pcb.toml is needed for workspace-relative loads

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Use workspace root .pcb dir for staging releases

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

---------

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
2025-08-14 18:46:43 -07:00

39 lines
880 B
Plaintext

"""
Power supply filtering module demonstrating workspace-relative paths.
Uses // path syntax to reference other modules in the workspace.
"""
load("@stdlib:v0.2.2/interfaces.zen", "Ground", "Power")
Resistor = Module("@stdlib:v0.2.2/generics/Resistor.zen")
Capacitor = Module("@stdlib:v0.2.2/generics/Capacitor.zen")
# Configuration
filter_cap_value = config("filter_cap_value", str, default="100nF")
pullup_value = config("pullup_value", str, default="10kOhm")
# IO ports
VCC = io("VCC", Power)
GND = io("GND", Ground)
FILTERED_VCC = io("FILTERED_VCC", Net)
# Power supply filtering
Capacitor(
name="C_FILTER",
value=filter_cap_value,
package="0402",
voltage="16V",
dielectric="X7R",
P1=VCC.NET,
P2=GND.NET,
)
# Pull-up resistor
Resistor(
name="R_PULLUP",
value=pullup_value,
package="0603",
P1=VCC.NET,
P2=FILTERED_VCC,
)