044 Decoupling Library Method
044-decoupling-library-method.mc names each decoupling capacitor inline and wires it between its rail and ground. These two constructions create distinct ceramic capacitors while applying the same rail-to-ground connection pattern:
text
V5V - CAP.MLCC C_5V(100nF, 10V) - GND
V3V3 - CAP.MLCC C_3V3(100nF, 10V) - GNDCAP.MLCC(100nF, 10V) is the ceramic-capacitor library type with capacitance and voltage arguments. C_5V belongs only to the 5 V rail and C_3V3 belongs only to the 3.3 V rail; both share GND. This demonstrates that a named inline construction carries its own designator into the netlist while the infix expression wires both of its pins at once.
bash
eval "$(../mcc/scripts/mcc-slot.sh)"
MCC_SYSTEM_ROOT="$(cd .. && pwd)" "$MCC_BIN" --local parse 04-functions-and-reuse/044-decoupling-library-method.mc --lib mcode --pass1 --pass2
MCC_SYSTEM_ROOT="$(cd .. && pwd)" "$MCC_BIN" --local parse 04-functions-and-reuse/044-decoupling-library-method.mc --lib mcode --viz -o 04-functions-and-reuse/044-decoupling-library-method.htmlSource
text
// Example: Decoupling Library Method
// Goal: Name each decoupling capacitor inline and wire it between its rail and GND.
// Language focus: named inline construction.
module main
{
io GND
io V3V3
io V5V
DC.SRC PWR_5V(5V, 100mA)
DC.SRC PWR_3V3(3.3V, 100mA)
PWR_5V.1 -> V5V
PWR_5V.2 -> GND
PWR_3V3.1 -> V3V3
PWR_3V3.2 -> GND
// Each named inline construction creates a distinct capacitor between its rail and GND.
V5V - CAP.MLCC C_5V(100nF, 10V) - GND
V3V3 - CAP.MLCC C_3V3(100nF, 10V) - GND
}