-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathlbr-connect-dev-pins-at.ulp
41 lines (39 loc) · 1.04 KB
/
lbr-connect-dev-pins-at.ulp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#usage "en: <qt>This ULP connects all pins in a device, suffixed with an ampersand and number, to the associated pad.<br> "
"<p>"
string Version = "1.0";
string cmd;
int cntConnect = 0;
if (library) {
string file;
library(L) {
if (deviceset) {
deviceset(DEV) {
DEV.devices(D) {
cntConnect = 0;
D.gates(G) {
G.symbol.pins(P) {
int pos;
string s, pin, pad;
if ((pos = strchr(P.name, '@')) < 0)
pos = strchr(P.name, '$');
if (pos > 0) {
pad = strsub(P.name, 0, pos);
pin = strsub(P.name, pos+1);
sprintf(s, "CONNECT %s.%s %s;\n", G.name, P.name, pin);
cmd += s;
++cntConnect;
}
}
}
}
}
if (!cntConnect) {
dlgMessageBox("No pins suffixed with @{padnum} found", "OK");
exit(0);
}
}
exit(cmd);
}
}
else
dlgMessageBox("Start this ULP in a LBR (Device)", "OK");