Date:2010-09-12 05:17:18 (9 years 8 days ago)
Author:Werner Almesberger
Commit:1a5d9f5a1e1ed02cc887498bd4a1f9223d029ff7
Message:bom/: automatic BOM generation (work in progress)

- bom/Makefile: run and control the BOM generation system
- bom/atrf.equ: project-specific equivalences
- bom/atrf.inv: "inventory" of parts implemented as PCB features
- bom/atrf.sub: substitution rules
- bom/avx.gen, bom/johanson.gen, bom/tdk.gen, bom/yageo-cap.gen: part number
translators for capacitors
Files: bom/Makefile (1 diff)
bom/atrf.equ (1 diff)
bom/atrf.inv (1 diff)
bom/atrf.sub (1 diff)
bom/avx.gen (1 diff)
bom/johanson.gen (1 diff)
bom/tdk.gen (1 diff)
bom/yageo-cap.gen (1 diff)

Change Details

bom/Makefile
1BOOM=PATH=/home/moko/svn.openmoko.org/trunk/eda/boom:../boom:$$PATH boom
2
3KITS=1
4
5EQU=atrf.equ dk/digi-key.equ
6INV=dk/digi-key.inv
7CHR=avx.chr tdk.chr yageo-cap.chr
8
9
10.PHONY: all again show-atusd spotless
11
12all: atusd.ord
13
14again:
15        $(MAKE) spotless
16        $(MAKE) all
17
18atusd.ord: atusd.par $(INV) $(EQU)
19        $(BOOM) part2order $(KITS) $(INV) $(EQU) atusd.par >$@ || \
20          { rm -rf $@; exit 1; }
21
22atusd.par: $(EQU) $(INV) $(CHR) ../atusd/atusd.lst atrf.sub
23        $(BOOM) bom2part $(EQU) $(INV) $(CHR) \
24          ../atusd/atusd.lst atrf.sub \
25          >$@ || { rm -rf $@; exit 1; }
26
27avx.chr: dk/digi-key.equ avx.gen
28        $(BOOM) gen2chr AVX dk/digi-key.equ avx.gen >$@ || \
29          { rm -f $@; exit 1; }
30
31tdk.chr: dk/digi-key.equ tdk.gen
32        $(BOOM) gen2chr TDK dk/digi-key.equ tdk.gen >$@ || \
33          { rm -f $@; exit 1; }
34
35yageo-cap.chr: dk/digi-key.equ yageo-cap.gen
36        $(BOOM) gen2chr YAGEO dk/digi-key.equ yageo-cap.gen >$@ || \
37          { rm -f $@; exit 1; }
38
39dk/digi-key.inv:
40        $(MAKE) -C dk digi-key.inv
41
42SHOW_PRETTY = (echo '\#ORD'; grep '^$(2) ' $(1).ord ; ) | \
43        $(BOOM) prettyord - $(3) | \
44          sed 's/^... //' | \
45          awk '{ s += $$(NF); if ($$(NF)+0) n++; print; } \
46          END { print "$(4)", s, "items:", n }'
47
48show-atusd: atusd.ord dk/digi-key.dsc
49        $(call SHOW_PRETTY,atusd,DIGI-KEY,dk/digi-key.dsc,USD)
50
51spotless:
52        $(MAKE) -C dk spotless
53        rm -f atusd.par atusd.ord
54        rm -f avx.chr tdk.chr yageo-cap.chr
bom/atrf.equ
1#EQU
2
3ATMEL AT86RF230 ATMEL AT86RF230-ZU
bom/atrf.inv
1#INV
2
3# Pseudo-inventory for PCB features.
4
5ATRF meander 999999 USD 1 0
6ATRF uSD-Card 999999 USD 1 0
7ATRF PAD_60x60 999999 USD 1 0
bom/atrf.sub
1#SUB
2
3# Taked from gta02-core. Left in the hacks, since we may use similar components
4# in the future.
5
6-> T=unknown
7
8R[0-9P]* { # also handle RP...
9    -> T=R
10    VAL=$R -> R=$VAL
11# -> TOL=5%
12    FN=$% -> TOL=$FN
13}
14
15RP[0-9]* {
16    -> T=RA
17    RP220[123] -> ARRAY=4
18    # the other parameters have already been taken care of by R*
19}
20
21C[0-9]* {
22    -> T=C
23    VAL=$F -> C=$VAL
24    FN=*V -> V=>=$FN
25}
26
27L[0-9]* {
28    -> T=L
29    VAL=$H -> L=$VAL
30    FN=*A -> I=>=$FN
31}
32
33B[0-9]* {
34    -> T=FILTER M=BEAD
35    VAL=$R -> R=$VAL
36    FN=*A -> I=$FN
37    FN=*R -> Rdc=$FN
38    FN=0.45R -> Rdc=450mR # hack
39}
40
41D[0-9]* {
42    -> T=D
43    VAL=*F { # heuristic to detect TVS
44    -> M=TVS
45    VAL=*F -> C=<=$VAL
46    FN=(*V)ac -> Vac=$FN:1
47    FN=(*V)dc -> Vdc=$FN:1
48
49    #
50    # Hack: some companies specify the class of varistors with Vdc = 9 V
51    # as Vac = 6.5 V while others use Vac = 7 V. Sometimes, Vac is even
52    # omitted entirely.
53    #
54    # Here, we work around the issue that Karmax use Vac = 6.5 V,
55    # Cooper/Bussmann use Vac = 7V if at all, and out schematics specify
56    # Vac = 6.5 V.
57    #
58    Vac=6.5V {
59        -> Vac=
60        -> Vdc=9V
61    }
62    }
63}
64
65
66FP=meander -> VAL=meander
67FP=uSD-Card -> VAL=uSD-Card
bom/avx.gen
1#GEN
2
3# http://www.avx.com/docs/Catalogs/ccog.pdf
4
5C* -> T=C {
6    (????)(?)(???)([0-9][0-9][0-9])(?)(?)* ->
7        FP=$REF:1 _V=$REF:2 M=$REF:3 _E12_P=$REF:4 _TOL=$REF:5
8
9    M=C0G -> M=NP0 # normalize
10
11    _TOL=B -> TOL=0.10pF
12    _TOL=C -> TOL=0.25pF
13    _TOL=D -> TOL=0.5pF
14    _TOL=F -> TOL=1%
15    _TOL=J -> TOL=5%
16    _TOL=K -> TOL=10%
17    _TOL=M -> TOL=20%
18    _TOL=Z -> TOL=80/20%
19
20    _V=6 -> V=6.3V
21    _V=Z -> V=10V
22    _V=Y -> V=16V
23    _V=3 -> V=25V
24    _V=5 -> V=50V
25    _V=1 -> V=100V
26    _V=2 -> V=200V
27    _V=7 -> V=500V
28}
29
30# E12 scale, base multiplier is 10^-12 (pico)
31
32_E12_P=(??)8 -> _E12=${_E12_P:1}0f
33_E12_P=(?)(?)9 -> _E12=$_E12_P:1.${_E12_P:2}p
34_E12_P=(??)0 -> _E12=${_E12_P:1}p
35_E12_P=(??)1 -> _E12=${_E12_P:1}0p
36_E12_P=(?)(?)2 -> _E12=$_E12_P:1.${_E12_P:2}n
37_E12_P=(??)3 -> _E12=${_E12_P:1}n
38_E12_P=(??)4 -> _E12=${_E12_P:1}0n
39_E12_P=(?)(?)5 -> _E12=$_E12_P:1.${_E12_P:2}u
40_E12_P=(??)6 -> _E12=${_E12_P:1}u
41_E12_P=(??)7 -> _E12=${_E12_P:1}0u
42
43# remove trailing zeroes
44
45_E12=(*).0([fpnu]) -> _E12=$_E12:1$_E12:2
46_E12=(*).0 -> _E12=$_E12:1
47
48T=C -> C=${_E12}F !
bom/johanson.gen
1#GEN
2
3# http://www.johansontechnology.com/images/stories/rfcaps/mlhqcaps/jti_high-q-mlcc_2008-11.pdf
4
5C* -> T=C {
6    (???)([RS][0-9][0-9])(?)([0-9][0-9][0-9])(?)* ->
7    _V=$REF:1 _FP=$REF:2 _M=$REF:3 _E12=$REF:4 _TOL=$REF:5
8
9    _V=6R3 -> V=6.3V
10    _V=160 -> V=16V
11    _V=250 -> V=25V
12    _V=500 -> V=50V
13    _V=251 -> V=250V
14    _V=501 -> V=500V
15    _V=102 -> V=1000V
16    _V=152 -> V=1500V
17    _V=202 -> V=2000V
18    _V=252 -> V=2500V
19
20    _M=S -> M=NP0/RF
21    _M=L -> M=NP0/RF
22    _M=E -> M=NP0/RF
23    _M=W -> M=X7R/RF
24
25    _TOL=A -> TOL=0.05pF
26    _TOL=B -> TOL=0.10pF
27    _TOL=C -> TOL=0.25pF
28    _TOL=D -> TOL=0.5pF
29    _TOL=F -> TOL=1%
30    _TOL=G -> TOL=2%
31    _TOL=J -> TOL=5%
32    _TOL=K -> TOL=10%
33
34    _V=6 -> V=6.3V
35    _V=Z -> V=10V
36    _V=Y -> V=16V
37    _V=3 -> V=25V
38    _V=5 -> V=50V
39    _V=1 -> V=100V
40    _V=2 -> V=200V
41    _V=7 -> V=500V
42}
43
44# E12 scale, base multiplier is 10^-12 (pico)
45
46_E12_P=(??)8 -> _E12=${_E12_P:1}0f
47_E12_P=(?)(?)9 -> _E12=$_E12_P:1.${_E12_P:2}p
48_E12_P=(??)0 -> _E12=${_E12_P:1}p
49_E12_P=(??)1 -> _E12=${_E12_P:1}0p
50_E12_P=(?)(?)2 -> _E12=$_E12_P:1.${_E12_P:2}n
51_E12_P=(??)3 -> _E12=${_E12_P:1}n
52_E12_P=(??)4 -> _E12=${_E12_P:1}0n
53_E12_P=(?)(?)5 -> _E12=$_E12_P:1.${_E12_P:2}u
54_E12_P=(??)6 -> _E12=${_E12_P:1}u
55_E12_P=(??)7 -> _E12=${_E12_P:1}0u
56
57# remove trailing zeroes
58
59_E12=(*).0([fpnu]) -> _E12=$_E12:1$_E12:2
60_E12=(*).0 -> _E12=$_E12:1
61
62T=C -> C=${_E12}F !
bom/tdk.gen
1#GEN
2
3# http://www.tdk.co.jp/tefe02/e412_c.pdf
4
5C* -> T=C {
6    C(????)(???)(??)([0-9][0-9R][0-9])(?)(?)* ->
7        _FP=$REF:1 M=$REF:2 _V=$REF:3 _E12_P=$REF:4 _TOL=$REF:5
8
9    M=C0G -> M=NP0 # normalize
10
11    _FP=0603 -> FP=0201
12    _FP=1005 -> FP=0402
13    _FP=1608 -> FP=0603
14    _FP=2012 -> FP=0805
15    _FP=3216 -> FP=1206
16    _FP=3225 -> FP=1210
17    _FP=4532 -> FP=1812
18    _FP=5750 -> FP=2220
19
20    _TOL=C -> TOL=0.25pF
21    _TOL=D -> TOL=0.5pF
22    _TOL=J -> TOL=5%
23    _TOL=K -> TOL=10%
24    _TOL=M -> TOL=20%
25    _TOL=Z -> TOL=80/20%
26
27    _V=0G -> V=4V
28    _V=0J -> V=6.3V
29    _V=1A -> V=10V
30    _V=1C -> V=16V
31    _V=1E -> V=25V
32    _V=1H -> V=50V
33}
34
35# E12 scale, base multiplier is 10^-12 (pico)
36
37_E12_P=(??)8 -> _E12=${_E12_P:1}0f
38_E12_P=(?)(?)9 -> _E12=$_E12_P:1.${_E12_P:2}p
39_E12_P=(??)0 -> _E12=${_E12_P:1}p
40_E12_P=(??)1 -> _E12=${_E12_P:1}0p
41_E12_P=(?)(?)2 -> _E12=$_E12_P:1.${_E12_P:2}n
42_E12_P=(??)3 -> _E12=${_E12_P:1}n
43_E12_P=(??)4 -> _E12=${_E12_P:1}0n
44_E12_P=(?)(?)5 -> _E12=$_E12_P:1.${_E12_P:2}u
45_E12_P=(??)6 -> _E12=${_E12_P:1}u
46_E12_P=(??)7 -> _E12=${_E12_P:1}0u
47_E12_P=(?)R(?) -> _E12=$_E12_P:1.${_E12_P:2}p # strange
48
49# remove trailing zeroes
50
51_E12=(*).0([fpnu]) -> _E12=$_E12:1$_E12:2
52_E12=(*).0 -> _E12=$_E12:1
53
54T=C -> C=${_E12}F !
bom/yageo-cap.gen
1#GEN
2
3# http://www.yageo.com/pdf/yageo/NP0_16V-to-100V_6.pdf
4
5CC* -> T=C {
6    CC(????)(?)?NP0(?)BN([0-9][0-9R][0-9]) ->
7        FP=$REF:1 _TOL=$REF:2 _V=$REF:3 _E12_P=$REF:4
8
9    M=NP0
10
11    _TOL=B -> TOL=0.1pF
12    _TOL=C -> TOL=0.25pF
13    _TOL=D -> TOL=0.5pF
14    _TOL=F -> TOL=1%
15    _TOL=G -> TOL=2%
16    _TOL=J -> TOL=5%
17
18    _V=7 -> V=16V
19    _V=8 -> V=25V
20    _V=9 -> V=50V
21    _V=0 -> V=100V
22}
23
24# E12 scale, base multiplier is 10^-12 (pico)
25
26_E12_P=(??)8 -> _E12=${_E12_P:1}0f
27_E12_P=(?)(?)9 -> _E12=$_E12_P:1.${_E12_P:2}p
28_E12_P=(??)0 -> _E12=${_E12_P:1}p
29_E12_P=(??)1 -> _E12=${_E12_P:1}0p
30_E12_P=(?)(?)2 -> _E12=$_E12_P:1.${_E12_P:2}n
31_E12_P=(??)3 -> _E12=${_E12_P:1}n
32_E12_P=(??)4 -> _E12=${_E12_P:1}0n
33_E12_P=(?)(?)5 -> _E12=$_E12_P:1.${_E12_P:2}u
34_E12_P=(??)6 -> _E12=${_E12_P:1}u
35_E12_P=(??)7 -> _E12=${_E12_P:1}0u
36_E12_P=(?)R(?) -> _E12=$_E12_P:1.${_E12_P:2}p # strange
37
38# remove trailing zeroes
39
40_E12=(*).0([fpnu]) -> _E12=$_E12:1$_E12:2
41_E12=(*).0 -> _E12=$_E12:1
42
43T=C -> C=${_E12}F !

Archive Download the corresponding diff file



interactive