new testbench
diff --git a/xschem/attenuator/basic-invert.sch b/xschem/attenuator/basic-invert.sch
index 5afc19d..10289c3 100644
--- a/xschem/attenuator/basic-invert.sch
+++ b/xschem/attenuator/basic-invert.sch
@@ -50,3 +50,17 @@
 C {ipin.sym} 170 -70 3 0 {name=pnd lab=gnd}
 C {ipin.sym} 170 -290 1 0 {name=pdd lab=vdd}
 C {opin.sym} 260 -180 0 0 {name=put lab=out}
+C {code.sym} 320 -230 0 0 {name=sT_MODELS
+only_toplevel=true
+format="tcleval( @value )"
+value="** manual skywater pdks install (with patches applied)
+* .lib \\\\$::SKYWATER_MODELS\\\\/models/sky130.lib.spice tt\\
+*** remove the /models/
+
+** opencircuitdesign pdks install
+.lib /Volumes/WORK_DRIVE/open_pdks/sky130/custom/models/sky130.lib.spice tt
+
+.param mc_mm_switch=0
+.param mc_pr_switch=0
+"
+spice_ignore=false}
diff --git a/xschem/attenuator/dsa.sch b/xschem/attenuator/dsa.sch
index f8a43fb..e640a21 100644
--- a/xschem/attenuator/dsa.sch
+++ b/xschem/attenuator/dsa.sch
@@ -55,14 +55,15 @@
 N 920 -110 920 -70 { lab=vdd}
 N 1240 -110 1240 -70 { lab=vdd}
 N 200 -70 1240 -70 { lab=vdd}
-C {code.sym} -130 -330 0 0 {name=sT_MODELS
+C {code.sym} 30 -380 0 0 {name=sT_MODELS
 only_toplevel=true
 format="tcleval( @value )"
 value="** manual skywater pdks install (with patches applied)
-* .lib \\\\$::SKYWATER_MODELS\\\\/models/sky130.lib.spice tt
+* .lib \\\\$::SKYWATER_MODELS\\\\/models/sky130.lib.spice tt\\
+*** remove the /models/
 
 ** opencircuitdesign pdks install
-.lib \\\\$::SKYWATER_MODELS\\\\/sky130.lib.spice tt
+.lib /Volumes/WORK_DRIVE/open_pdks/sky130/custom/models/sky130.lib.spice tt
 
 .param mc_mm_switch=0
 .param mc_pr_switch=0
diff --git a/xschem/attenuator/gate-switch.sch b/xschem/attenuator/gate-switch.sch
index 0641bb7..dada8e3 100644
--- a/xschem/attenuator/gate-switch.sch
+++ b/xschem/attenuator/gate-switch.sch
@@ -51,3 +51,17 @@
 C {opin.sym} 400 -210 0 0 {name=put lab=out}
 C {ipin.sym} 255 -100 3 0 {name=pntrl1 lab=cntrl1}
 C {ipin.sym} 255 -325 1 0 {name=pntrl2 lab=cntrl2}
+C {code.sym} 480 -140 0 0 {name=sT_MODELS
+only_toplevel=true
+format="tcleval( @value )"
+value="** manual skywater pdks install (with patches applied)
+* .lib \\\\$::SKYWATER_MODELS\\\\/models/sky130.lib.spice tt\\
+*** remove the /models/
+
+** opencircuitdesign pdks install
+.lib /Volumes/WORK_DRIVE/open_pdks/sky130/custom/models/sky130.lib.spice tt
+
+.param mc_mm_switch=0
+.param mc_pr_switch=0
+"
+spice_ignore=false}
diff --git a/xschem/attenuator/transgate-full.sch b/xschem/attenuator/transgate-full.sch
index 57b3c1f..4afa181 100644
--- a/xschem/attenuator/transgate-full.sch
+++ b/xschem/attenuator/transgate-full.sch
@@ -44,19 +44,6 @@
 N 820 -190 860 -190 { lab=vbias}
 N 740 -320 740 -300 { lab=gnd}
 N 850 -190 850 -170 { lab=vbias}
-C {code.sym} 140 -470 0 0 {name=sT_MODELS
-only_toplevel=true
-format="tcleval( @value )"
-value="** manual skywater pdks install (with patches applied)
-* .lib \\\\$::SKYWATER_MODELS\\\\/models/sky130.lib.spice tt
-
-** opencircuitdesign pdks install
-.lib \\\\$::SKYWATER_MODELS\\\\/sky130.lib.spice tt
-
-.param mc_mm_switch=0
-.param mc_pr_switch=0
-"
-spice_ignore=false}
 C {basic-invert.sym} 550 -220 0 0 {name=XI1}
 C {gate-switch.sym} 660 -310 0 0 {name=XTG1}
 C {gate-switch.sym} 660 -50 0 0 {name=XTG2}
@@ -67,3 +54,17 @@
 C {ipin.sym} 850 -170 3 0 {name=pbias lab=vbias}
 C {opin.sym} 1020 -250 0 0 {name=put2 lab=out2}
 C {opin.sym} 1020 -510 0 0 {name=put1 lab=out1}
+C {code.sym} 230 -340 0 0 {name=sT_MODELS
+only_toplevel=true
+format="tcleval( @value )"
+value="** manual skywater pdks install (with patches applied)
+* .lib \\\\$::SKYWATER_MODELS\\\\/models/sky130.lib.spice tt\\
+*** remove the /models/
+
+** opencircuitdesign pdks install
+.lib /Volumes/WORK_DRIVE/open_pdks/sky130/custom/models/sky130.lib.spice tt
+
+.param mc_mm_switch=0
+.param mc_pr_switch=0
+"
+spice_ignore=false}
diff --git a/xschem/compiled.sch b/xschem/compiled.sch
index b5b55d9..1eb3bc5 100644
--- a/xschem/compiled.sch
+++ b/xschem/compiled.sch
@@ -21,31 +21,19 @@
 lab=GND}
 N 1620 -650 1640 -650 {
 lab=#net4}
-N 1380 -620 1400 -620 {
+N 460 -650 480 -650 {
 lab=#net5}
-N 1380 -620 1380 -560 {
+N 480 -670 480 -650 {
 lab=#net5}
-N 1380 -680 1400 -680 {
-lab=#net6}
-N 1380 -740 1380 -680 {
-lab=#net6}
-N 1270 -740 1380 -740 {
-lab=#net6}
-N 1270 -560 1380 -560 {
+N 480 -650 480 -630 {
 lab=#net5}
-N 1310 -650 1330 -650 {
+N 480 -740 480 -730 {
+lab=#net6}
+N 480 -570 480 -560 {
 lab=#net7}
-N 1330 -670 1330 -650 {
+N 480 -560 480 -540 {
 lab=#net7}
-N 1330 -650 1330 -630 {
-lab=#net7}
-N 1330 -740 1330 -730 {
-lab=#net6}
-N 1330 -570 1330 -560 {
-lab=#net5}
-N 1330 -560 1330 -540 {
-lab=#net5}
-N 1330 -760 1330 -740 {
+N 480 -760 480 -740 {
 lab=#net6}
 N 1620 -670 1640 -670 {
 lab=#net8}
@@ -59,22 +47,16 @@
 lab=#net9}
 N 1640 -600 1790 -600 {
 lab=#net9}
-N 1190 -740 1210 -740 {
-lab=#net10}
-N 1190 -560 1210 -560 {
-lab=#net11}
 N 1160 -740 1190 -740 {
 lab=#net10}
-N 1160 -560 1190 -560 {
-lab=#net11}
 N 860 -660 860 -640 {
-lab=#net12}
+lab=#net11}
 N 980 -660 980 -640 {
-lab=#net13}
+lab=#net12}
 N 740 -660 740 -640 {
-lab=#net14}
+lab=#net13}
 N 620 -660 620 -640 {
-lab=#net15}
+lab=#net14}
 N 1840 -660 1860 -660 {
 lab=#net8}
 N 1840 -640 1860 -640 {
@@ -92,43 +74,55 @@
 N 1780 -600 1780 -520 {
 lab=#net9}
 N 2050 -650 2080 -650 {
-lab=#net16}
+lab=#net15}
 N 2080 -650 2080 -630 {
-lab=#net16}
+lab=#net15}
 N 2080 -650 2120 -650 {
-lab=#net16}
+lab=#net15}
 N 2140 -650 2140 -630 {
-lab=#net16}
+lab=#net15}
 N 2120 -650 2140 -650 {
-lab=#net16}
+lab=#net15}
 N 2080 -570 2080 -550 {
 lab=GND}
 N 2140 -570 2140 -550 {
 lab=GND}
 N 2140 -650 2180 -650 {
-lab=#net16}
-N 580 -660 620 -660 {
 lab=#net15}
+N 580 -660 620 -660 {
+lab=#net14}
 N 740 -680 740 -660 {
-lab=#net14}
+lab=#net13}
 N 580 -680 740 -680 {
-lab=#net14}
+lab=#net13}
 N 860 -640 860 -630 {
-lab=#net12}
+lab=#net11}
 N 610 -630 860 -630 {
-lab=#net12}
+lab=#net11}
 N 610 -640 610 -630 {
-lab=#net12}
+lab=#net11}
 N 580 -640 610 -640 {
-lab=#net12}
+lab=#net11}
 N 580 -620 980 -620 {
-lab=#net13}
+lab=#net12}
 N 980 -640 980 -620 {
-lab=#net13}
-N 460 -740 560 -740 {
+lab=#net12}
+N 530 -740 560 -740 {
+lab=#net6}
+N 530 -560 560 -560 {
+lab=#net7}
+N 380 -740 390 -740 {
+lab=#net16}
+N 380 -560 400 -560 {
 lab=#net17}
-N 460 -560 560 -560 {
-lab=#net18}
+N 470 -560 530 -560 {
+lab=#net7}
+N 460 -560 470 -560 {
+lab=#net7}
+N 460 -740 530 -740 {
+lab=#net6}
+N 390 -740 400 -740 {
+lab=#net16}
 C {/Volumes/WORK_DRIVE/caravel_automatic_gain_control/xschem/lownoiseamplifier/csfd-abstract.sym} 1320 -540 0 0 {name=XLNA1}
 C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 1490 -540 0 0 {name=l1 lab=GND}
 C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 1490 -790 2 0 {name=V1 value="1.8"}
@@ -152,40 +146,29 @@
 m=1}
 C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 1730 -650 3 0 {name=V2 value="1.8"}
 C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 1760 -650 3 0 {name=l5 lab=GND}
-C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 1280 -650 1 0 {name=V3 value="1.8"}
-C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 1250 -650 1 0 {name=l6 lab=GND}
-C {res.sym} 1330 -700 2 0 {name=R4
+C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 430 -650 1 0 {name=V3 value="1.8"}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 400 -650 1 0 {name=l6 lab=GND}
+C {res.sym} 480 -700 2 0 {name=R4
 value=800
 footprint=1206
 device=resistor
 m=1}
-C {res.sym} 1330 -600 0 0 {name=R5
+C {res.sym} 480 -600 0 0 {name=R5
 value=800
 footprint=1206
 device=resistor
 m=1}
-C {res.sym} 1330 -790 2 0 {name=R6
+C {res.sym} 480 -790 2 0 {name=R6
 value=1k
 footprint=1206
 device=resistor
 m=1}
-C {res.sym} 1330 -510 0 0 {name=R7
+C {res.sym} 480 -510 0 0 {name=R7
 value=1k
 footprint=1206
 device=resistor
 m=1}
-C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 1330 -820 2 0 {name=l7 lab=GND}
-C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 1330 -480 0 0 {name=l8 lab=GND}
-C {capa.sym} 1240 -740 3 0 {name=C1
-m=1
-value=500u
-footprint=1206
-device="ceramic capacitor"}
-C {capa.sym} 1240 -560 3 0 {name=C2
-m=1
-value=500u
-footprint=1206
-device="ceramic capacitor"}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 480 -820 2 0 {name=l7 lab=GND}
 C {/Volumes/WORK_DRIVE/caravel_automatic_gain_control/xschem/attenuator/dsa.sym} 420 -320 0 0 {name=XDSA1}
 C {/Volumes/WORK_DRIVE/caravel_automatic_gain_control/xschem/attenuator/dsa.sym} 420 -980 2 1 {name=XDSA2}
 C {/Volumes/WORK_DRIVE/caravel_automatic_gain_control/xschem/powerdetector/balaced-pd.sym} 1810 -550 0 0 {name=X1}
@@ -216,7 +199,18 @@
 C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 920 -880 2 0 {name=V9 value="1.4"}
 C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 920 -450 0 0 {name=V10 value="1.4"}
 C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 920 -420 0 0 {name=V11 value="1.4"}
-C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 430 -740 1 0 {name=V12 value="SIN(0.2 0.2 40000 0 0 180)"}
-C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 400 -740 1 0 {name=V13 value="1.4"}
-C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 430 -560 1 0 {name=V14 value="SIN(0.2 0.2 40000)"}
-C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 400 -560 1 0 {name=V15 value="1.4"}
+C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 350 -740 1 0 {name=V12 value="SIN(0.2 0.2 40000 0 0 180)"}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 320 -740 1 0 {name=V13 value="1.4"}
+C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 350 -560 1 0 {name=V14 value="SIN(0.2 0.2 40000)"}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 320 -560 1 0 {name=V15 value="1.4"}
+C {capa.sym} 430 -740 3 0 {name=C4
+m=1
+value=500u
+footprint=1206
+device="ceramic capacitor"}
+C {capa.sym} 430 -560 3 0 {name=C1
+m=1
+value=500u
+footprint=1206
+device="ceramic capacitor"}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 480 -480 0 0 {name=l18 lab=GND}
diff --git a/xschem/misc/DSA_testbench.sch b/xschem/misc/DSA_testbench.sch
new file mode 100644
index 0000000..0164bd9
--- /dev/null
+++ b/xschem/misc/DSA_testbench.sch
@@ -0,0 +1,168 @@
+v {xschem version=3.0.0 file_version=1.2 }
+G {}
+K {}
+V {}
+S {}
+E {}
+N 400 -370 420 -370 {
+lab=#net1}
+N 420 -390 420 -370 {
+lab=#net1}
+N 420 -370 420 -350 {
+lab=#net1}
+N 420 -460 420 -450 {
+lab=#net2}
+N 420 -290 420 -280 {
+lab=#net3}
+N 420 -280 420 -260 {
+lab=#net3}
+N 420 -480 420 -460 {
+lab=#net2}
+N 1100 -460 1130 -460 {
+lab=#net4}
+N 800 -380 800 -360 {
+lab=c3}
+N 920 -380 920 -360 {
+lab=c4}
+N 680 -380 680 -360 {
+lab=c1}
+N 560 -380 560 -360 {
+lab=c2}
+N 520 -380 560 -380 {
+lab=c2}
+N 680 -400 680 -380 {
+lab=c1}
+N 520 -400 680 -400 {
+lab=c1}
+N 800 -360 800 -350 {
+lab=c3}
+N 550 -350 800 -350 {
+lab=c3}
+N 550 -360 550 -350 {
+lab=c3}
+N 520 -360 550 -360 {
+lab=c3}
+N 520 -340 920 -340 {
+lab=c4}
+N 920 -360 920 -340 {
+lab=c4}
+N 470 -460 500 -460 {
+lab=#net2}
+N 470 -280 500 -280 {
+lab=#net3}
+N 320 -460 330 -460 {
+lab=#net5}
+N 320 -280 340 -280 {
+lab=#net6}
+N 410 -280 470 -280 {
+lab=#net3}
+N 400 -280 410 -280 {
+lab=#net3}
+N 400 -460 470 -460 {
+lab=#net2}
+N 330 -460 340 -460 {
+lab=#net5}
+N 1100 -280 1130 -280 {
+lab=#net7}
+N 1130 -480 1130 -470 {
+lab=#net4}
+N 1130 -470 1130 -460 {
+lab=#net4}
+N 1130 -460 1180 -460 {
+lab=#net4}
+N 1130 -270 1130 -260 {
+lab=#net7}
+N 1130 -280 1130 -270 {
+lab=#net7}
+N 1130 -200 1130 -180 {
+lab=#net8}
+N 1130 -560 1130 -540 {
+lab=#net9}
+N 1130 -280 1180 -280 {
+lab=#net7}
+C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 370 -370 1 0 {name=V3 value="1.8"}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 340 -370 1 0 {name=l6 lab=GND}
+C {res.sym} 420 -420 2 0 {name=R4
+value=800
+footprint=1206
+device=resistor
+m=1}
+C {res.sym} 420 -320 0 0 {name=R5
+value=800
+footprint=1206
+device=resistor
+m=1}
+C {res.sym} 420 -510 2 0 {name=R6
+value=1k
+footprint=1206
+device=resistor
+m=1}
+C {res.sym} 420 -230 0 0 {name=R7
+value=1k
+footprint=1206
+device=resistor
+m=1}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 420 -540 2 0 {name=l7 lab=GND}
+C {/Volumes/WORK_DRIVE/caravel_automatic_gain_control/xschem/attenuator/dsa.sym} 360 -40 0 0 {name=XDSA1}
+C {/Volumes/WORK_DRIVE/caravel_automatic_gain_control/xschem/attenuator/dsa.sym} 360 -700 2 1 {name=XDSA2}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 740 -200 0 0 {name=l14 lab=GND}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 740 -540 2 0 {name=l15 lab=GND}
+C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 800 -570 2 0 {name=V6 value="1.8"}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 800 -600 2 0 {name=l16 lab=GND}
+C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 800 -170 0 1 {name=V7 value="1.8"}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 800 -140 0 1 {name=l17 lab=GND}
+C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 860 -570 2 0 {name=V8 value="1.4"}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 860 -600 2 0 {name=V9 value="1.4"}
+C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 860 -170 0 0 {name=V10 value="1.4"}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 860 -140 0 0 {name=V11 value="1.4"}
+C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 290 -460 1 0 {name=V12 value="SIN(0.2 0.2 40000 0 0 180)"}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 260 -460 1 0 {name=V13 value="1.4"}
+C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 290 -280 1 0 {name=V14 value="SIN(0.2 0.2 40000)"}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 260 -280 1 0 {name=V15 value="1.4"}
+C {capa.sym} 370 -460 3 0 {name=C4
+m=1
+value=500u
+footprint=1206
+device="ceramic capacitor"}
+C {capa.sym} 370 -280 3 0 {name=C1
+m=1
+value=500u
+footprint=1206
+device="ceramic capacitor"}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 420 -200 0 0 {name=l18 lab=GND}
+C {res.sym} 1130 -510 2 0 {name=R1
+value=1k
+footprint=1206
+device=resistor
+m=1}
+C {res.sym} 1130 -230 0 0 {name=R2
+value=1k
+footprint=1206
+device=resistor
+m=1}
+C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 1130 -150 0 1 {name=V1 value="1.8"}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 1130 -120 0 1 {name=l1 lab=GND}
+C {/Users/ryanwans/xschem/xschem_library/devices/vsource.sym} 1130 -590 2 1 {name=V2 value="1.8"}
+C {/Users/ryanwans/xschem/xschem_library/devices/gnd.sym} 1130 -620 2 1 {name=l2 lab=GND}
+C {code.sym} 30 -510 0 0 {name=NGSPICE only_toplevel=false value="
+.trans 0.00001s 0.00001s
+.save all
+"}
+C {ipin.sym} 520 -400 0 0 {name=c1 lab=c1}
+C {ipin.sym} 520 -380 0 0 {name=c2 lab=c2}
+C {ipin.sym} 520 -360 0 0 {name=c3 lab=c3}
+C {ipin.sym} 520 -340 0 0 {name=c4 lab=c4}
+C {code.sym} 40 -310 0 0 {name=sT_MODELS
+only_toplevel=true
+format="tcleval( @value )"
+value="** manual skywater pdks install (with patches applied)
+* .lib \\\\$::SKYWATER_MODELS\\\\/models/sky130.lib.spice tt\\
+*** remove the /models/
+
+** opencircuitdesign pdks install
+.lib /Volumes/WORK_DRIVE/open_pdks/sky130/custom/models/sky130.lib.spice tt
+
+.param mc_mm_switch=0
+.param mc_pr_switch=0
+"
+spice_ignore=false}
diff --git a/xschem/powerdetector/._transgate-full.sch b/xschem/powerdetector/._transgate-full.sch
new file mode 100644
index 0000000..6dd15e9
--- /dev/null
+++ b/xschem/powerdetector/._transgate-full.sch
Binary files differ
diff --git a/xschem/powerdetector/._transgate-full.spice b/xschem/powerdetector/._transgate-full.spice
new file mode 100644
index 0000000..6dd15e9
--- /dev/null
+++ b/xschem/powerdetector/._transgate-full.spice
Binary files differ
diff --git a/xschem/powerdetector/._transgate-full.sym b/xschem/powerdetector/._transgate-full.sym
new file mode 100644
index 0000000..6dd15e9
--- /dev/null
+++ b/xschem/powerdetector/._transgate-full.sym
Binary files differ
diff --git a/xschem/powerdetector/transgate-full.sch b/xschem/powerdetector/transgate-full.sch
new file mode 100644
index 0000000..57b3c1f
--- /dev/null
+++ b/xschem/powerdetector/transgate-full.sch
@@ -0,0 +1,69 @@
+v {xschem version=3.0.0 file_version=1.2 }
+G {}
+K {}
+V {}
+S {}
+E {}
+N 890 -140 890 -120 { lab=cntrl}
+N 890 -380 890 -360 { lab=#net1}
+N 610 -120 630 -120 { lab=cntrl}
+N 610 -380 610 -120 { lab=cntrl}
+N 740 -250 790 -250 { lab=in}
+N 820 -120 890 -120 { lab=cntrl}
+N 720 -250 740 -250 { lab=in}
+N 630 -120 820 -120 { lab=cntrl}
+N 590 -380 610 -380 { lab=cntrl}
+N 890 -400 890 -380 { lab=#net1}
+N 890 -640 890 -620 { lab=cntrl}
+N 610 -640 890 -640 { lab=cntrl}
+N 610 -640 610 -380 { lab=cntrl}
+N 460 -250 720 -250 { lab=in}
+N 460 -510 790 -510 { lab=in}
+N 460 -510 460 -250 { lab=in}
+N 400 -380 460 -380 { lab=in}
+N 610 -380 650 -380 { lab=cntrl}
+N 780 -380 890 -380 { lab=#net1}
+N 790 -510 820 -510 { lab=in}
+N 890 -460 890 -400 { lab=#net1}
+N 890 -620 890 -570 { lab=cntrl}
+N 890 -570 890 -560 { lab=cntrl}
+N 960 -510 1020 -510 { lab=out1}
+N 790 -250 820 -250 { lab=in}
+N 890 -310 890 -300 { lab=#net1}
+N 890 -360 890 -310 { lab=#net1}
+N 890 -200 890 -140 { lab=cntrl}
+N 960 -250 1020 -250 { lab=out2}
+N 710 -440 710 -420 { lab=vdd}
+N 810 -470 820 -470 { lab=gnd}
+N 810 -470 810 -210 { lab=gnd}
+N 810 -210 820 -210 { lab=gnd}
+N 710 -340 710 -320 { lab=gnd}
+N 710 -320 810 -320 { lab=gnd}
+N 820 -450 860 -450 { lab=vbias}
+N 860 -450 860 -190 { lab=vbias}
+N 820 -190 860 -190 { lab=vbias}
+N 740 -320 740 -300 { lab=gnd}
+N 850 -190 850 -170 { lab=vbias}
+C {code.sym} 140 -470 0 0 {name=sT_MODELS
+only_toplevel=true
+format="tcleval( @value )"
+value="** manual skywater pdks install (with patches applied)
+* .lib \\\\$::SKYWATER_MODELS\\\\/models/sky130.lib.spice tt
+
+** opencircuitdesign pdks install
+.lib \\\\$::SKYWATER_MODELS\\\\/sky130.lib.spice tt
+
+.param mc_mm_switch=0
+.param mc_pr_switch=0
+"
+spice_ignore=false}
+C {basic-invert.sym} 550 -220 0 0 {name=XI1}
+C {gate-switch.sym} 660 -310 0 0 {name=XTG1}
+C {gate-switch.sym} 660 -50 0 0 {name=XTG2}
+C {ipin.sym} 590 -380 0 0 {name=pntrl lab=cntrl}
+C {ipin.sym} 710 -440 1 0 {name=pdd lab=vdd}
+C {ipin.sym} 400 -380 0 0 {name=pn lab=in}
+C {ipin.sym} 740 -300 3 0 {name=pnd lab=gnd}
+C {ipin.sym} 850 -170 3 0 {name=pbias lab=vbias}
+C {opin.sym} 1020 -250 0 0 {name=put2 lab=out2}
+C {opin.sym} 1020 -510 0 0 {name=put1 lab=out1}
diff --git a/xschem/powerdetector/transgate-full.spice b/xschem/powerdetector/transgate-full.spice
new file mode 100644
index 0000000..ab0b8ba
--- /dev/null
+++ b/xschem/powerdetector/transgate-full.spice
@@ -0,0 +1,70 @@
+**.subckt transgate-full cntrl vdd in gnd vbias out2 out1
+*.ipin cntrl
+*.ipin vdd
+*.ipin in
+*.ipin gnd
+*.ipin vbias
+*.opin out2
+*.opin out1
+XI1 vdd gnd net1 cntrl basic-invert
+XTG1 in out1 gnd vbias net1 cntrl gate-switch
+XTG2 in out2 gnd vbias cntrl net1 gate-switch
+**** begin user architecture code
+ ** manual skywater pdks install (with patches applied)
+* .lib /ef/tech/SW.2/sky130A/libs.tech/ngspice/models/sky130.lib.spice tt
+
+** opencircuitdesign pdks install
+.lib /ef/tech/SW.2/sky130A/libs.tech/ngspice/sky130.lib.spice tt
+
+.param mc_mm_switch=0
+.param mc_pr_switch=0
+
+
+
+.tran 0.001s 0.1s
+.control
+  plot v(output)
+.endc
+.save all
+
+
+**** end user architecture code
+**.ends
+
+* expanding   symbol:  basic-invert.sym # of pins=4
+* sym_path: /home/u5921_ryanwan/design/FB1/xschem/basic-invert.sym
+* sch_path: /home/u5921_ryanwan/design/FB1/xschem/basic-invert.sch
+.subckt basic-invert  vdd gnd out in
+*.ipin in
+*.ipin gnd
+*.ipin vdd
+*.opin out
+XM1 out in gnd gnd sky130_fd_pr__nfet_01v8 L=0.15 W=1 nf=1 ad='int((nf+1)/2) * W/nf * 0.29' as='int((nf+2)/2) * W/nf * 0.29'
++ pd='2*int((nf+1)/2) * (W/nf + 0.29)' ps='2*int((nf+2)/2) * (W/nf + 0.29)' nrd='0.29 / W' nrs='0.29 / W'
++ sa=0 sb=0 sd=0 mult=1 m=1 
+XM2 out in vdd vdd sky130_fd_pr__pfet_01v8 L=0.15 W=1 nf=1 ad='int((nf+1)/2) * W/nf * 0.29' as='int((nf+2)/2) * W/nf * 0.29'
++ pd='2*int((nf+1)/2) * (W/nf + 0.29)' ps='2*int((nf+2)/2) * (W/nf + 0.29)' nrd='0.29 / W' nrs='0.29 / W'
++ sa=0 sb=0 sd=0 mult=1 m=1 
+.ends
+
+
+* expanding   symbol:  gate-switch.sym # of pins=6
+* sym_path: /home/u5921_ryanwan/design/FB1/xschem/gate-switch.sym
+* sch_path: /home/u5921_ryanwan/design/FB1/xschem/gate-switch.sch
+.subckt gate-switch  in out gnd vbias cntrl2 cntrl1
+*.ipin in
+*.ipin vbias
+*.ipin gnd
+*.opin out
+*.ipin cntrl1
+*.ipin cntrl2
+XM5 in cntrl2 out vbias sky130_fd_pr__pfet_01v8 L=0.15 W=1 nf=1 ad='int((nf+1)/2) * W/nf * 0.29' as='int((nf+2)/2) * W/nf * 0.29'
++ pd='2*int((nf+1)/2) * (W/nf + 0.29)' ps='2*int((nf+2)/2) * (W/nf + 0.29)' nrd='0.29 / W' nrs='0.29 / W'
++ sa=0 sb=0 sd=0 mult=1 m=1 
+XM6 out cntrl1 in gnd sky130_fd_pr__nfet_01v8 L=0.15 W=1 nf=1 ad='int((nf+1)/2) * W/nf * 0.29' as='int((nf+2)/2) * W/nf * 0.29'
++ pd='2*int((nf+1)/2) * (W/nf + 0.29)' ps='2*int((nf+2)/2) * (W/nf + 0.29)' nrd='0.29 / W' nrs='0.29 / W'
++ sa=0 sb=0 sd=0 mult=1 m=1 
+.ends
+
+** flattened .save nodes
+.end
diff --git a/xschem/powerdetector/transgate-full.sym b/xschem/powerdetector/transgate-full.sym
new file mode 100644
index 0000000..a1d3650
--- /dev/null
+++ b/xschem/powerdetector/transgate-full.sym
@@ -0,0 +1,46 @@
+v {xschem version=2.9.9 file_version=1.2 }
+G {}
+K {type=subcircuit
+format="@name @pinlist @symname"
+template="name=XDTG1"}
+V {}
+S {}
+E {}
+L 4 220 -220 260 -220 {}
+L 4 300 -240 340 -240 {}
+L 4 300 -200 340 -200 {}
+L 4 220 -260 330 -260 {}
+L 4 340 -260 340 -180 {}
+L 4 220 -180 330 -180 {}
+L 4 220 -260 220 -180 {}
+L 4 200 -220 220 -220 {}
+L 4 340 -240 360 -240 {}
+L 4 340 -200 360 -200 {}
+L 4 330 -260 340 -260 {}
+L 4 330 -180 340 -180 {}
+L 4 260 -220 290 -200 {}
+L 4 280 -280 280 -260 {}
+L 4 240 -180 240 -160 {}
+L 4 280 -180 280 -160 {}
+L 4 320 -180 320 -160 {}
+B 4 297.5 -242.5 302.5 -237.5 {}
+B 4 297.5 -202.5 302.5 -197.5 {}
+B 5 197.5 -222.5 202.5 -217.5 {name=in
+dir=in}
+B 5 277.5 -282.5 282.5 -277.5 {name=cntrl
+dir=in}
+B 5 237.5 -162.5 242.5 -157.5 {name=vdd
+dir=in}
+B 5 277.5 -162.5 282.5 -157.5 {name=vbias
+dir=in}
+B 5 317.5 -162.5 322.5 -157.5 {name=gnd
+dir=in}
+B 5 357.5 -202.5 362.5 -197.5 {name=out2
+dir=out}
+B 5 357.5 -242.5 362.5 -237.5 {name=out1
+dir=out}
+T {@name} 225 -255 0 0 0.2 0.2 {}
+T {GND} 322.5 -195 1 0 0.1 0.1 {}
+T {VDD} 242.5 -195 1 0 0.1 0.1 {}
+T {VBIAS} 282.5 -197.5 1 0 0.1 0.1 {}
+T {CTRL} 287.5 -252.5 2 0 0.1 0.1 {}