design_add_circuit_block
Adds a canonical circuit block to a DesignPlan with automatic refdes allocation and net wiring, replacing manual pin-by-pin boilerplate.
Instructions
Fold a canonical circuit block into a DesignPlan in one call.
Authoring boilerplate sub-circuits pin-by-pin in plan JSON is slow
and error-prone (a decoupling network is N caps, 2N pins, and two
net merges that must line up). This emits the canonical topology
of a common block and wires it into plan_json -- allocating
unique refdes, tying every pin to the right net, and tagging
power/ground and roles -- then returns the augmented plan plus an
inline re-validation so the next authoring step starts from a known
state.
It is naming-agnostic: it owns the wiring pattern, never the
part choice. YOU supply every part identity in params
(lib_ref/value/footprint/mpn/datasheet_url),
picked semantically from the live inventory snapshot. Pass computed
values from design_compute_component_value where relevant.
Blocks and their required params (all also accept pins to
override default pin names, refdes_prefix, sheet):
decouplingpower_net, ground_net, lib_ref [, count, value, footprint] -- N bypass caps.pullupsignal_net, rail_net, lib_ref [, value].pulldownsignal_net, ground_net, lib_ref [, value].series_resistornet_a, net_b, lib_ref [, value].voltage_dividerrail_net, ground_net, lib_ref_top, lib_ref_bottom [, value_top, value_bottom, output_net] -- fresh midpoint net.rc_lowpassinput_net, ground_net, lib_ref_r, lib_ref_c [, value_r, value_c, output_net].rc_highpassinput_net, ground_net, lib_ref_r, lib_ref_c [, value_r, value_c, output_net] -- series C + shunt R (AC coupling).led_indicatoranode_net, cathode_net, lib_ref_r, lib_ref_led [, value_r, mid_net].crystalxin_net, xout_net, ground_net, lib_ref, cap_lib_ref [, value, cap_value] -- crystal + a matched pair of load caps (one shared cap_value keeps the legs equal).pi_filterinput_net, ground_net, lib_ref_l, lib_ref_c [, value_l, value_c, output_net] -- shunt C, series L/ferrite, shunt C.mosfet_low_sidecontrol_net, load_net, ground_net, lib_ref_r, lib_ref_fet [, value_r_gate, value_r_pulldown, pulldown, fet_pins] -- gate series R + gate pull-down + FET switching a load low-side.mosfet_high_sidecontrol_net, load_net, rail_net, lib_ref_r, lib_ref_fet [, value_r_gate, value_r_pullup, pullup, fet_pins] -- gate series R + gate pull-up + PMOS switching a load high-side (source at the rail).
Call design_list_circuit_blocks for the full per-block
parameter contract.
Net endpoints the block does NOT own (a pullup's signal, an RC input, a divider rail) should already exist in the plan; the block only creates the nets it fully populates. If you point a block at a net that ends up with a single pin, the inline ERC reports it as a floating net for you to complete.
Args: plan_json: the DesignPlan as a JSON string or dict. block: block name (see the list above). params: block parameters (see per-block requirements above).
Returns:
{ok, plan, added: {refdes, nets, extended_nets}, notes, validation} where plan is the augmented DesignPlan dict
ready for the next design_add_circuit_block or
design_execute_plan, and validation is the same payload
design_validate_plan returns. ok is False on a bad
block name / missing param / schema error, with errors.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| block | Yes | ||
| params | Yes | ||
| plan_json | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||