Closed ceremcem closed 3 years ago
Following circuit script:
# Description: Quadruple TIA-422 transmitter # depends: SOIC16 # Value: "{{variant}}" or "{{package}}" provides class AM26C31x extends Footprint create: (data) -> variants = "16pin": J: "CDIP" N: "PDIP" NS: "SO" W: "CFP" D: "SOIC" DB: "SSOP" PW: "TSSOP" "20pin": FK: "LCCC" labels = "16pin": 1: "1a" # input 2: "1y" # output 3: "1z" # inverted output 4: "g" # active high enable 5: "2z" 6: "2y" 7: "2a" 8: "gnd" 9: "3a" 10: "3y" 11: "3z" 12: "n_g" # active low enable 13: "4z" 14: "4y" 15: "4a" 16: "vcc" footprint = variants["16pin"][@value] or variants["20pin"][@value] parent = data.parent or this switch footprint | "SOIC" => x = new SOIC16 { parent, labels: labels["16pin"] } @iface = x.iface |_ => throw new Error "Unimplemented variant (#{@value}) in #{@@@name}" AM26C31x_circuit = (config) -> # provides this (value) -> # value: # variant: AM26C31x variant iface: "c1.1a,c1.1y,c1.1z,c1.g,c1.2z, c1.2y,c1.2a,c1.3a,c1.3y,c1.3z,c1.n_g, c1.4z,c1.4y,c1.4a" netlist: "vcc": "c1.vcc c2.a" "gnd": "c1.gnd c2.c" bom: AM26C31x: "#{value.variant}": "c1" C1206: "100nF": "c2" if __main__ example = (config) -> (value) -> iface: "+3.3V GND A1 B1" schemas: AM26C31D_std: AM26C31x_circuit()({variant: "D"}) bom: AM26C31D_std: "t1" netlist: "+3.3V": "c1.vcc" standard new Schema do name: "example" data: example!!
Throws the expected error:
Unused pads: t1.c1.1a,t1.c1.1y,t1.c1.1z,t1.c1.g,t1.c1.2z,t1.c1.2y,t1.c1.2a,t1.c1.3a,t1.c1.3y,t1.c1.3z,t1.c1.n_g,t1.c1.4z,t1.c1.4y,t1.c1.4a,GND,A1,B1
However, the sub-circuit's iface should be directly used: t1.c1.1a should be t1.1a.
iface
t1.c1.1a
t1.1a
Needs test case.
Following circuit script:
Throws the expected error:
However, the sub-circuit's
iface
should be directly used:t1.c1.1a
should bet1.1a
.