#!/usr/bin/perl
+# -*- fundamental -*-
use IO::Handle;
-die unless @ARGV==0 || @ARGV==1 && $ARGV[0] eq 'reversers.net-spec';
+die unless @ARGV==1;
+$ARGV[0] =~ m,\b(reversers|detectors)(?:\.net-spec)?$, or die;
+$$1= 1;
-@indiv= qw(icsp_pcq l_gnd led_red led_green);
+@indiv= qw(
+ icsp_pcq
+ l_gnd
+ led_red
+ led_green
+ );
-push @indiv, qw(cdu_enable
+if ($reversers) {
+ push @indiv, qw(
+ cdu_enable
booster_retry
booster_cutout
booster_flag
rs232_fcin
rs232_fcout
);
+ print "INDIV1 26 @indiv\n"; # 25-way D
+ %val = qw(
+ q 5
+ p 17
+ x qmid=
+ );
+} else {
+ push @indiv, qw(
+ spare0
+ analogue
+ rs232_rxin
+ rs232_txout
+ pwmout
+ extint0
+ extint1
+ pt0..10
+ );
+ %val = qw(
+ q 20
+ p 9
+ x q
+ );
+}
print "INDIV0 25 :1%13/2 @indiv\n"; # 26-way ribbon
-print "INDIV1 26 @indiv\n";; # 25-way D
-while (<DATA>) { print; }
+$doing= 1;
+
+while (<DATA>) {
+ if (m/^\^\=(reversers|detectors)\:\s*$/) {
+ $doing= $$1;
+ next;
+ }
+ next unless $doing;
+ s/\^(\w)/ die unless exists $val{$1}; $val{$1}; /ge;
+ print;
+}
die $! if STDOUT->error;
31 l_gnd l_vcc
33 RB0..7
-!type Fat q0..5 qmid0..5 t0..5
-!type Power ptdrain0..17
+!type Fat q0..^q qmid0..^q
+!type Power ptdrain0..^p
+
+# 32-way ribbon
+BUS 32
+ icsp_pdw
+ l_gnd icsp_pdrany
+ l_gnd icsp_pdrall
+ l_gnd clock
+ l_gnd l_vcc mclr
+ l_gnd i2c_clock led_reflow i2c_data led_refhigh
+ rly_gnd rly_v12
+ cdu_gnd cdu_out
+
+CAC05 2 l_gnd l_vcc
+0-1/1 CPIC= 2 l_gnd l_vcc
+
+0-5/4 OC= 16==8
+ :1+2 sensei<..>
+ :2+2 q*&
+ :-1-2 l_gnd*&
+ :-0-2 sense<..>
+
+0-^q/1 BR= 4
+ :1+2 sshort=*2
+ :2 ^x
+ :4 q
+
+0-^q/1 RS= 2
+ sensei= qmid=
+
+AC05 14
+ :8+
+ icsp_pdrall icsp_pdrall_mid icsp_pdrall_mid icsp_pd
+ icsp_pdrany icsp_pd
+ l_vcc
+ :7-
+ l_gnd
+ icsp_pdw_mid icsp_pdw
+ ptgate0 icsp_pd
+ - l_gnd
+
+RPDR 2 icsp_pdrall_mid l_vcc
+RPDWU 2 icsp_pdw_mid l_vcc
+RPDWI 2 icsp_pdw_mid icsp_pd
+RPT0U 2 ptgate0 l_vcc
+
+RPCI 2 icsp_pc icsp_pcq
+RPCL 2 icsp_pc l_gnd
+RPCPT 2 icsp_pc ptgate1
+
+0-^p/1 PTFET= 3 ptgate= ptdrain= cdu_gnd
+0-^p/1 PTD= 2 cdu_out ptdrain=
+2-^p/8 RAP= 16 :1 pt<..> :-0- ptgate<..>
+
+cdu_out Power
+cdu_gnd Power
+
+TS912 8
+ :1 ledmid_red perpicled led_reflow
+ :7- ledmid_green led_refhigh perpicled
+ :4 l_gnd
+ :8 l_vcc
+
+RLG 2 ledmid_green led_green
+RLR 2 ledmid_red led_red
+RLL 2 perpicled l_gnd
+
+^=reversers:
+
+!type Fat t0..5
!PIC-ASSIGN
1 mclr
pt5
21 perpicled
-# 32-way ribbon
-BUS 32
- icsp_pdw
- l_gnd icsp_pdrany
- l_gnd icsp_pdrall
- l_gnd clock
- l_gnd l_vcc mclr
- l_gnd i2c_clock led_reflow i2c_data led_refhigh
- rly_gnd rly_v12
- cdu_gnd cdu_out
-
TERM 14
1 t q
:3+2 t0..5
:10 rly_v12
CULN 2 rly_gnd rly_v12
-CAC05 2 l_gnd l_vcc
-0-1/1 CPIC= 2 l_gnd l_vcc
RAS 9
l_vcc
:2 sense3..0 sense5..4
- perpicled
-0-5/4 OC= 16==8
- :1+2 sensei<..>
- :2+2 q*&
- :-1-2 l_gnd*&
- :-0-2 sense<..>
-
-
-0-5/1 RS= 2
- sensei= qmid=
-
-AC05 14
- :8+
- icsp_pdrall icsp_pdrall_mid icsp_pdrall_mid icsp_pd
- icsp_pdrany icsp_pd
- l_vcc
- :7-
- l_gnd
- icsp_pdw_mid icsp_pdw
- ptgate0 icsp_pd
- - l_gnd
-
-RPDR 2 icsp_pdrall_mid l_vcc
-RPDWU 2 icsp_pdw_mid l_vcc
-RPDWI 2 icsp_pdw_mid icsp_pd
-RPT0U 2 ptgate0 l_vcc
-
-RPCI 2 icsp_pc icsp_pcq
-RPCL 2 icsp_pc l_gnd
-RPCPT 2 icsp_pc ptgate1
-
-0-17/1 PTFET= 3 ptgate= ptdrain= cdu_gnd
-0-17/1 PTD= 2 cdu_out ptdrain=
-2-17/8 RAP= 16 :1 pt<..> :-0- ptgate<..>
-
-cdu_out Power
-cdu_gnd Power
-
POINTS 25
:1 ptdrain1..17
:25 ptdrain0
-TS912 8
- :1 ledmid_red perpicled led_reflow
- :7- ledmid_green led_refhigh perpicled
- :4 l_gnd
- :8 l_vcc
-
-RLG 2 ledmid_green led_green
-RLR 2 ledmid_red led_red
-RLL 2 perpicled l_gnd
-
0-5/1 RLY= 16
:1 rly_v12
:4 q=
:13 t=
:16 rlydrv=
-0-5/1 BR= 4
- :1+2 sshort=*2
- :2 qmid=
- :4 q
+^=detectors:
+
+RAS 9
+ l_vcc
+ :2 sense3..0 sense5..4
+ - perpicled
+
+!PIC-ASSIGN
+ 1 mclr
+ pt4,analogue
+ pt5,spare0
+ sense0..6
+ l_vcc l_gnd clock
+ sense7..10
+ i2c_clock
+ sense11..12
+ :40-
+ pt0,icsp_pd
+ pt1,icsp_pc
+ pt2
+ sense20..18
+ pt6,extint1
+ pt7,extint0
+ l_vcc
+ l_gnd
+ sense17..15
+ pt3,pwmout
+ pt8,rs232_rxin
+ pt9,rs232_txout
+ sense14
+ i2c_data
+ sense13
+ 21 perpicled
+
+TERM 22
+ q q0..20