1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-25 23:42:49 +02:00

Catalog listing and enhanced versions of various BOOM items from ben-wpan/bom.

- boom/dist/dk/dk-catq.pl: new - query the Digi-Key catalog for a list of
  items
- boom/dist/dk/dk-db.pl: enhanced - never generate more than 1000 queries
  per wget run (to keep argv from getting too long)
- boom/dist/dk/panasonic-erj.catq, boom/dist/dk/stackpole-rmcf.catq: query
  scripts for dk-catq.pl
- boom/lib/e12.inc: enhanced - added Rxx and Rxxx codes
- boom/manu/panasonic/panasonic.gen: enhanced - added decoding for all ERJ
  series resistors listed at Digi-Key
- boom/manu/stackpole/: (new) part number decoder for RMCF series resistors
This commit is contained in:
Werner Almesberger 2010-10-15 23:58:57 -03:00
parent a1d1182691
commit c1574ce3f6
10 changed files with 532 additions and 0 deletions

27
boom/dist/dk/Makefile vendored Normal file
View File

@ -0,0 +1,27 @@
CACHE = query.data
EQUS = panasonic-erj stackpole-rmcf
.SUFFIXES: .catq .equ
all: db/digi-key.dsc db/digi-key.inv
$(CACHE): db/digi-key.equ
awk '/^#END/ { exit } /^DIGI-KEY / { print $$2 }' $< | \
perl ./dk-db.pl query \
`[ -r $(CACHE) ] && echo '' -i $(CACHE)` >_$@ || \
{ rm -f $@ _$@; exit 1; }
mv _$@ $@
db/digi-key.equ: $(EQUS:%=db/%.equ)
cat $^ >$@ || { rm -rf $@; exit 1; }
db/digi-key.dsc: $(CACHE)
perl ./dk-db.pl dsc $< >$@ || \
{ rm -f $@; exit 1; }
db/digi-key.inv: $(CACHE)
perl ./dk-db.pl inv $< >$@ || \
{ rm -f $@; exit 1; }
.catq.equ:
perl ./dk-catq.pl $< >$@ || { rm -rf $@; exit 1; }

122
boom/dist/dk/dk-catq.pl vendored Executable file
View File

@ -0,0 +1,122 @@
#!/usr/bin/perl
$BASE = "http://search.digikey.com/scripts/DkSearch/dksus.dll";
$QMOD = "stock=1&pbfree=1&rohs=1";
$URL = "$BASE?$QMOD&k=";
$DEBUG = 0;
sub query
{
local @q = ();
open(PIPE, "wget -O - '$_[0]' |") || die "wget: $!";
while (<PIPE>) {
chop;
push(@q, $_);
}
close PIPE;
return @q;
}
# --- Read query specification ------------------------------------------------
$spec = $ARGV[0];
while (<>) {
s/#.*//;
next if /^\s*$/;
chop;
push(@q, $_);
}
$id = shift @q;
$key = shift @q;
$cat = shift @q;
for (@q) {
die "not a field=value pair: \"$_\"" unless /\s*=\s*/;
$f{$`} = $';
}
# --- Select category ---------------------------------------------------------
$url = $URL.$key;
@q = &query($url);
if ($q[1] =~ /<title>Digi-Key</) {
undef $found;
for (@q) {
next unless /Cat=(\d+)[&"].*?>\s*([^,]*?)\s*</;
next if $2 ne $cat;
$found = $1;
last;
}
die "category \"$cat\" not found" unless defined $found;
# --- Get parameter tables ----------------------------------------------------
$url .= "&Cat=$found";
@q = &query($url);
}
for (@q) {
if (/^<th>\s*(.*?)\s*<\/th>/) {
print STDERR "col name \"$1\"\n" if $DEBUG;
push(@col_name, $1);
next;
}
if (/<select .* name=([^ >]+)/) {
$cols++;
$col = $col_name[$cols-1];
die "cols = $cols" unless defined $col;
print STDERR "$col -> \"$1\"\n" if $DEBUG;
$col_field{$col} = $1;
next;
}
next unless /<option value=(\d+)>\s*(.*?)\s*(<.*)?$/;
print STDERR "val{$col}{$2} = \"$1\"\n" if $DEBUG;
$val{$col}{$2} = $1;
}
for (keys %f) {
$field = $col_field{$_};
die "no such field: $_" unless defined $field;
$value = $val{$_}{$f{$_}};
die "no such value: \"$_\"=\"$f{$_}\"" unless defined $value;
$url .= "&$field=$value";
}
# --- Output file header ------------------------------------------------------
print "#EQU\n# Generated from $spec\n# ".`date`."\n";
# --- Get the pages -----------------------------------------------------------
$url =~ s/\?/?Selection\&/; # magic key to the pages
$page = 1;
while (1) {
@q = &query("$url&page=$page");
$more = 0;
for (@q) {
$more = 1 if />Next</;
next unless /-ND">\s*([^>]*-ND)\s*<\/a><\/td><td>\s*(.*?)\s*</;
print "DIGI-KEY $1\t $id $2\n";
}
last unless $more;
$page++;
}

111
boom/dist/dk/dk-db.pl vendored Executable file
View File

@ -0,0 +1,111 @@
#!/usr/bin/perl
sub rows
{
local $s = $_[0];
my @res = ();
while ($s =~ m#.*?<tr>(.*?)</tr>#) {
push(@res, $1);
$s = $';
}
return @res;
}
sub cols
{
local $s = $_[0];
my @res = ();
while ($s =~ m#.*?<td[^>]*>(.*?)</td>#) {
push(@res, $1);
$s = $';
}
return @res;
}
sub flush
{
$cmd = "wget -nv -O - ".join(" ",
map
"http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail\\&name=$_",
@pn);
$q .= `$cmd`;
@pn = ();
}
sub usage
{
print STDERR "usage: $0 (query [-i cache_file] | dsc | inv) [file ...]\n";
exit(1);
}
$mode = shift @ARGV;
&usage unless $mode eq "query" || $mode eq "dsc" || $mode eq "inv";
if ($mode eq "query") {
if ($ARGV[0] eq "-i") {
shift @ARGV;
$name = shift @ARGV;
open(OLD, $name) || die "$name: $!";
$q = join("", <OLD>);
($old = $q) =~ tr/\r\n//d;
close OLD;
}
while (<>) {
chop;
s/#.*//;
next if /^\s*$/;
next if /^\s/;
s/\s.*//;
next if $old =~ m#align=right>Digi-Key Part Number</th><td>$_</td#;
push(@pn, $_);
&flush if @pn > 1000;
}
&flush if 0+@pn;;
print $q;
exit;
}
$q = join("", <>);
$q =~ tr/\r\n//d;
print "#DSC\n" if $mode eq "dsc";
print "#INV\n" if $mode eq "inv";
print "# MACHINE-GENERATED. DO NOT EDIT !\n";
print "# ", `date -u`;
for (split(/<!DOCTYPE HTML/, $q)) {
next unless m#align=right>Digi-Key Part Number</th><td>([^<]+)</td#;
$pn = $1;
$qty = 0;
if (m#align=right>Quantity Available</th><td[^>]*>([0-9,]+)<#) {
($qty = $1) =~ tr/,//d;
}
next unless m#align=right>Description</th><td>(.*?)</td#;
$dsc = $1;
next unless m#<table.*<th>Price Break<(.*?)</table>#;
if ($mode eq "dsc") {
print "DIGI-KEY $pn $dsc\n";
next;
}
print "DIGI-KEY $pn $qty USD";
for (&rows($1)) {
@c = &cols($_);
next unless $c[0] =~ /^[0-9,]+$/;
next unless $c[1] =~ /^[0-9.]+$/;
$c[0] =~ tr/,//d;
$c[1] =~ tr/,//d; # let's hope we don't need this one often :)
$c[1] =~ s/0+$// if $c[1] =~ /\./;
print " $c[0] $c[1]";
}
print "\n";
}

14
boom/dist/dk/panasonic-erj.catq vendored Normal file
View File

@ -0,0 +1,14 @@
#
# File structure:
#
# - manufacturer name as used in BOOM
# - keyword
# - product category
# - zero or more field=value pairs
#
# Comment lines and empty lines are ignored.
#
PANASONIC
erj
Chip Resistor - Surface Mount
Packaging = Cut Tape (CT)

14
boom/dist/dk/stackpole-rmcf.catq vendored Normal file
View File

@ -0,0 +1,14 @@
#
# File structure:
#
# - manufacturer name as used in BOOM
# - keyword
# - product category
# - zero or more field=value pairs
#
# Comment lines and empty lines are ignored.
#
STACKPOLE
rmcf
Chip Resistor - Surface Mount
Packaging = Cut Tape (CT)

46
boom/lib/e12.inc Normal file
View File

@ -0,0 +1,46 @@
# E12 scale
_E12_1=(??)0 -> _E12=${_E12_1:1}
_E12_1=(??)1 -> _E12=${_E12_1:1}0
_E12_1=(?)(?)2 -> _E12=$_E12_1:1.${_E12_1:2}k
_E12_1=(??)3 -> _E12=${_E12_1:1}k
_E12_1=(??)4 -> _E12=${_E12_1:1}0k
_E12_1=(?)(?)5 -> _E12=$_E12_1:1.${_E12_1:2}M
_E12_1=(??)6 -> _E12=${_E12_1:1}M
_E12_1=(??)7 -> _E12=${_E12_1:1}0M
_E12_1=R(??) -> _E12=0.$_E12_1:1
_E12_1=(?)R(?) -> _E12=$_E12_1:1.$_E12_1:2
# E96 scale
_E12_1=(???)0 -> _E12=${_E12_1:1}
_E12_1=(?)(??)1 -> _E12=$_E12_1:1.${_E12_1:2}k
_E12_1=(??)(?)2 -> _E12=$_E12_1:1.${_E12_1:2}k
_E12_1=(???)3 -> _E12=${_E12_1:1}k
_E12_1=(?)(??)4 -> _E12=$_E12_1:1.${_E12_1:2}M
_E12_1=(??)(?)5 -> _E12=$_E12_1:1.${_E12_1:2}M
_E12_1=R(???) -> _E12=0.$_E12_1:1
_E12_1=(?)R(??) -> _E12=$_E12_1:1.$_E12_1:2
_E12_1=(??)R(?) -> _E12=$_E12_1:1.$_E12_1:2
# E12 scale, base multiplier is 10^-12 (pico)
_E12_P=(??)8 -> _E12=${_E12_P:1}0f
_E12_P=(?)(?)9 -> _E12=$_E12_P:1.${_E12_P:2}p
_E12_P=(??)0 -> _E12=${_E12_P:1}p
_E12_P=(??)1 -> _E12=${_E12_P:1}0p
_E12_P=(?)(?)2 -> _E12=$_E12_P:1.${_E12_P:2}n
_E12_P=(??)3 -> _E12=${_E12_P:1}n
_E12_P=(??)4 -> _E12=${_E12_P:1}0n
_E12_P=(?)(?)5 -> _E12=$_E12_P:1.${_E12_P:2}u
_E12_P=(??)6 -> _E12=${_E12_P:1}u
_E12_P=(??)7 -> _E12=${_E12_P:1}0u
_E12_P=(?)R(?) -> _E12=$_E12_P:1.${_E12_P:2}p # strange
# remove leading and trailing zeroes
_E12=0([0-9]*) -> _E12=$_E12:1
_E12=(*.[0-9]*)0([fpnumkM]) -> _E12=$_E12:1$_E12:2
_E12=(*).0([fpnumkM]) -> _E12=$_E12:1$_E12:2
_E12=(*.[0-9]*)0 -> _E12=$_E12:1
_E12=(*).0 -> _E12=$_E12:1

View File

@ -0,0 +1,4 @@
BOOM=PATH=/home/moko/svn.openmoko.org/trunk/eda/boom:../boom:$$PATH boom
panasonic.chr: ../../dist/dk/db/digi-key.equ panasonic.gen
$(BOOM) gen2chr PANASONIC $^ >$@ || { rm -rf $@; exit 1; }

View File

@ -0,0 +1,153 @@
#GEN
# http://industrial.panasonic.com/www-data/pdf/AOA0000/AOA0000CE1.pdf
# http://industrial.panasonic.com/www-data/pdf/AOA0000/AOA0000CE2.pdf
# http://industrial.panasonic.com/www-data/pdf/AOA0000/AOA0000CE3.pdf
# http://industrial.panasonic.com/www-data/pdf/AOA0000/AOA0000CE4.pdf
# http://industrial.panasonic.com/www-data/pdf/AOA0000/AOA0000CE7.pdf
# http://media.digikey.com/pdf/Data Sheets/Panasonic Resistors Thermistors PDFs/ERJ1TYFyyyU, ERJ1TY0R00U.pdf
ERJ* -> T=R {
# http://industrial.panasonic.com/www-data/pdf/AOA0000/AOA0000CE1.pdf
# XGE is special, see below
# K tolerance is undocumented
ERJ-([X1]GN|[X12368]GE|14|12|12Z|1T)(Y|)(J|K|0)([0-9R][0-9R][0-9])* ->
_FP=$REF:1 _TOL=$REF:3 _E12_1=$REF:4
# http://industrial.panasonic.com/www-data/pdf/AOA0000/AOA0000CE2.pdf
ERJ-([1236]R)([HBKE])(D)([0-9R][0-9R][0-9R][0-9])* ->
_FP=$REF:1 _TOL=$REF:3 _E12_1=$REF:4
# 1GE is special, see below
ERJ-([X1]GN|1GE|2RK|3EK|[68]EN|1[42T]N|12S)(F)([0-9R][0-9R][0-9R][0-9])* ->
_FP=$REF:1 _TOL=$REF:2 _E12_1=$REF:3
# http://industrial.panasonic.com/www-data/pdf/AOA0000/AOA0000CE3.pdf
ERJ-([2368]B|[368]R|1[4T]R|12[RZ])(S|Q)([FGJ])([0-9R][0-9R][0-9])* ->
_FP=$REF:1 _FP2=$REF:1 _TOL=$REF:3 _E12_1=$REF:4
ERJ-([2368]BW)([FGJ])([0-9R][0-9R][0-9R][0-9])* ->
_FP=$REF:1 _FP2=$REF:1 _TOL=$REF:2 _E12_1=$REF:3
ERJ-(L0[368]|L1[42DW])(K|U)(F|J)([0-9][0-9][MC])* ->
_FP=$REF:1 _TOL=$REF:3 _LOW_R=$REF:4
# http://industrial.panasonic.com/www-data/pdf/AOA0000/AOA0000CE4.pdf
ERJ-(P0[368]|P14)(D|F)([R0-9][R0-9][R0-9][0-9])* ->
_FP=$REF:1 _TOL=$REF:3 _E12_1=$REF:3
ERJ-(P0[368]|P14)(J)([R0-9][R0-9][0-9])* ->
_FP=$REF:1 _TOL=$REF:3 _E12_1=$REF:3
# http://industrial.panasonic.com/www-data/pdf/AOA0000/AOA0000CE7.pdf
ERJ-(M03)N(F|J)([0-9][0-9M][0-9M])* ->
_FP=$REF:1 _TOL=$REF:2 _LOW_R=$REF:3
ERJ-(M1W)(S|T)(F|J)([0-9][0-9M][0-9M])* ->
_FP=$REF:1 _TOL=$REF:3 _LOW_R=$REF:4
# ERJ1TY0R00U.pdf
ERJ-(1T)(Y)(F)([0-9][0-9][0-9])* ->
_FP=$REF:1 _TOL=$REF:3 _E12_1=$REF:4
# XGE and 1GE are not listed in the part number decoding scheme.
# Assume they're equal to XGN and 1GN, respectively.
_FP=XGE -> _FP=XGN
_FP=1GE -> _FP=1GN
# http://industrial.panasonic.com/www-data/pdf/AOA0000/AOA0000CE1.pdf
_FP=XGN -> FP=01005 P=1/32W V=15V
_FP=1GN -> FP=0201 P=1/20W V=25V
_FP=2GE -> FP=0402 P=1/10W V=50V
_FP=3GE -> FP=0603 P=1/10W V=75V
_FP=6GE -> FP=0805 P=1/8W V=150V
_FP=8GE -> FP=1206 P=1/4W V=200V
_FP=12Z -> FP=2010 P=3/4W V=200V
_FP=14 -> FP=1210 P=1/2W V=200V
_FP=12 -> FP=1812 P=3/4W V=200V
_FP=1T -> FP=2512 P=1W V=200V
# http://industrial.panasonic.com/www-data/pdf/AOA0000/AOA0000CE2.pdf
_FP=1R -> FP=0201 P=1/20W V=15V
_FP=2R -> FP=0402 P=1/16W V=50V
_FP=3R -> FP=0603 P=1/16W V=50V
_FP=6R -> FP=0805 P=1/10W V=150V
_FP=2RK -> FP=0402 P=1/10W V=50V
_FP=3EK -> FP=0603 P=1/10W V=75V
_FP=6EN -> FP=0805 P=1/8W V=150V
_FP=8EN -> FP=1206 P=1/4W V=200V
_FP=14N -> FP=1210 P=1/2W V=200V
_FP=12N -> FP=1812 P=3/4W V=200V
_FP=12S -> FP=2010 P=3/4W V=200V
_FP=1TN -> FP=2512 P=1W V=200V
# http://industrial.panasonic.com/www-data/pdf/AOA0000/AOA0000CE3.pdf
_FP=2B -> FP=0402 P=1/8W
_FP2=3R -> FP=0603 P=1/10W # override regular 3R
_FP=3B -> FP=0603 P=1/5W
_FP2=6R -> FP=0805 P=1/8W # override regular 6R
_FP=6B -> FP=0805 P=1/4W
_FP=8R -> FP=1206 P=1/4W
_FP=8B -> FP=1206 P=1/3W
_FP=14R -> FP=1210 P=1/4W
_FP=14B -> FP=1210 P=1/2W
_FP=12R -> FP=1812 P=1/2W
_FP=12Z -> FP=2010 P=1/2W
_FP=1TR -> FP=2512 P=1W
_FP=2BW -> FP=0402 P=1/8W
_FP=3BW -> FP=0603 P=1/4W
_FP=6BW -> FP=0805 P=1/3W
_FP=8BW -> FP=1206 P=1/2W
_FP=L03 -> FP=0603 P=1/10W
_FP=L06 -> FP=0805 P=1/8W
_FP=L08 -> FP=1206 P=1/4W
_FP=L14 -> FP=1210 P=1/3W
_FP=L12 -> FP=1812 P=1/2W
_FP=L1D -> FP=2010 P=1/2W
_FP=L1W -> FP=2512 P=1W
# http://industrial.panasonic.com/www-data/pdf/AOA0000/AOA0000CE4.pdf
_FP=P03 -> FP=0603 P=1/5W V=150V
_FP=P06 -> FP=0805 P=1/4W V=150V
_FP=P08 -> FP=1206 P=1/3W V=200V
_FP=P12 -> FP=1210 P=1/2W V=200V
# http://industrial.panasonic.com/www-data/pdf/AOA0000/AOA0000CE7.pdf
_FP=M03 -> FP=0603 P=1/4W
_FP=M1W -> FP=2512 P=1W
# L and M series don't use E12
_LOW_R=(?)M(?) -> _E12=$_LOW_R:1.${_LOW_R:2}m
_LOW_R=(??)M -> _E12_1=R0${_LOW_R:1}
_LOW_R=(??)C -> _E12_1=R${_LOW_R:1}
_TOL=D -> TOL=0.5%
_TOL=F -> TOL=1%
_TOL=G -> TOL=2%
_TOL=J -> TOL=5%
_TOL=K -> TOL=10%
}
include ../../lib/e12.inc
T=R -> R=${_E12}R !

View File

@ -0,0 +1,4 @@
BOOM=PATH=/home/moko/svn.openmoko.org/trunk/eda/boom:../boom:$$PATH boom
stackpole.chr: ../../dist/dk/db/digi-key.equ stackpole.gen
$(BOOM) gen2chr STACKPOLE $^ >$@ || { rm -rf $@; exit 1; }

View File

@ -0,0 +1,37 @@
#GEN
# http://www.seielect.com/Catalog/SEI-RMC.pdf
RMCF* -> T=R {
RMCF(????)(?)(?)([0-9R][0-9RKM][0-9RKM])* ->
FP=$REF:1 _TOL=$REF:2 _R=$REF:3
_TOL=F -> TOL=1%
_TOL=J -> TOL=5%
FP=0201 -> P=1/20W V=25V
FP=0402 -> P=1/16W V=50V
FP=0603 -> P=1/10W V=50V
FP=0805 -> P=1/8W V=150V
FP=1206 -> P=1/4W V=200V
FP=1210 -> P=1/3W V=200V
FP=2010 -> P=3/4W V=200V
FP=2512 -> P=1W V=200V
}
# Adjust multipliers
_R=(*)R(*) -> _R=0$_R:1.$_R:2
_R=(*)K(*) -> _R=$_R:1.${_R:2}k
_R=(*)M(*) -> _R=$_R:1.${_R:2}M
# Remove leading and trailing zeroes
_R=0([0-9]*) -> _R=$_R:1
_R=(*.[0-9]*)0([kM]) -> _R=$_R:1$_R:2
_R=(*).0([kM]) -> _R=$_R:1$_R:2
_R=(*.[0-9]*)0 -> _R=$_R:1
_R=(*).0 -> _R=$_R:1
T=R -> R=${_R}R !