Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | #A component of the add-ports script, used to split an EDIF file |
2 | #somewhere in its interface list |
||
3 | |||
4 | BEGIN { |
||
5 | s = 0; |
||
6 | }; |
||
7 | |||
8 | #Look for a cell declaration |
||
9 | # for EDIF with the cellname on the next line there will be only one word |
||
10 | |||
11 | /\(cell/ { |
||
12 | if ( length($1)==5 && s==0 ) { |
||
13 | if ( NF==1 ) { |
||
14 | s = 6 |
||
15 | } |
||
16 | else if(($2 ~ ent) && (length($2)==length(ent)) ) { |
||
17 | s = 1; |
||
18 | printf("got entity %s\n",ent) |
||
19 | } |
||
20 | } |
||
21 | } |
||
22 | |||
23 | |||
24 | /\(interface/ { |
||
25 | if (s == 1) { |
||
26 | print ("(interface ") > out1; |
||
27 | printf ("in interface of %s\n",ent); |
||
28 | for (i = 2; i<=NF; i++) { |
||
29 | printf ("%s ",$i) > out2 |
||
30 | }; |
||
31 | printf ("\n") > out2; |
||
32 | #flag to 2 to show we have done the first section |
||
33 | s= 2 |
||
34 | } |
||
35 | } |
||
36 | |||
37 | #any reserved ports already added are dropped by setting the flag to 4 |
||
38 | #so they are not printed, both rsv00001z and RSV00020z style names |
||
39 | /[rR][sS][vV][0-9]+[zZ]/ { s = 4 } |
||
40 | |||
41 | |||
42 | # we are expecting an entity-name |
||
43 | //{ if(s<2) { print > out1 } |
||
44 | else if (s==2 || s==4 ) { s = 3 } |
||
45 | else if (s==3) { print > out2 } |
||
46 | else if (s==6) { print > out1 ;s= 5 } |
||
47 | else if (s==5) { |
||
48 | print > out1; |
||
49 | # need protection against strings containing "(" |
||
50 | if ((NF >= 1) && substr($1,1,1) !~ "\(" && ent ~ $1) { |
||
51 | s = 1; |
||
52 | printf("got entity %s\n",ent) |
||
53 | } |
||
54 | else { |
||
55 | s = 0 |
||
56 | } |
||
57 | } |
||
58 | } |