fixed lvs with isosub
diff --git a/mag/user_analog_project_wrapper.mag b/mag/user_analog_project_wrapper.mag
index 37b7717..caf6b51 100644
--- a/mag/user_analog_project_wrapper.mag
+++ b/mag/user_analog_project_wrapper.mag
@@ -1,7 +1,12 @@
 magic
 tech sky130B
 magscale 1 2
-timestamp 1656946276
+timestamp 1658026393
+<< isosubstrate >>
+rect 561944 685278 563182 686544
+rect 45862 658032 59282 663848
+rect 527324 282602 540920 284554
+rect 8524 166320 17014 168312
 << viali >>
 rect 531009 283461 531043 283495
 rect 537801 282968 537835 283003
@@ -1362,30 +1367,30 @@
 rect -100 0 0 704000
 rect 584000 0 584100 704000
 rect -100 -100 584100 0
-use sky130_sc_ams__ota_1  sky130_sc_ams__ota_1_1
-timestamp 1654715540
-transform 1 0 9447 0 1 167134
-box -398 -153 6394 687
-use sky130_sc_ams__ota_1  sky130_sc_ams__ota_1_0
-timestamp 1654715540
-transform 1 0 533383 0 1 283100
-box -398 -153 6394 687
-use hv_tgate  hv_tgate_0
-timestamp 1648694146
-transform 1 0 230448 0 1 427446
-box -5090 -470 22390 1062
-use FG_pfet  FG_pfet_0
-timestamp 1654453464
-transform 1 0 52313 0 1 660624
-box -2563 -40 1390 600
-use C4  C4_0
-timestamp 1654715540
-transform 1 0 530809 0 1 283177
-box -3132 -258 1273 678
 use 1T1R_2x2  1T1R_2x2_0
 timestamp 1647533459
 transform 1 0 562058 0 1 685450
 box 0 0 864 800
+use C4  C4_0
+timestamp 1654715540
+transform 1 0 530809 0 1 283177
+box -3132 -258 1273 678
+use FG_pfet  FG_pfet_0
+timestamp 1654453464
+transform 1 0 52313 0 1 660624
+box -2563 -40 1390 600
+use hv_tgate  hv_tgate_0
+timestamp 1648694146
+transform 1 0 230448 0 1 427446
+box -5090 -470 22390 1062
+use sky130_sc_ams__ota_1  sky130_sc_ams__ota_1_0
+timestamp 1654715540
+transform 1 0 533383 0 1 283100
+box -398 -153 6394 687
+use sky130_sc_ams__ota_1  sky130_sc_ams__ota_1_1
+timestamp 1654715540
+transform 1 0 9447 0 1 167134
+box -398 -153 6394 687
 << labels >>
 flabel metal3 s 582300 677984 584800 682984 0 FreeSans 1120 0 0 0 io_analog[0]
 port 36 nsew signal bidirectional
diff --git a/netgen/run_lvs_wrapper_xschem.sh b/netgen/run_lvs_wrapper_xschem.sh
index 12e5a92..2cea6d9 100755
--- a/netgen/run_lvs_wrapper_xschem.sh
+++ b/netgen/run_lvs_wrapper_xschem.sh
@@ -20,3 +20,4 @@
 #
 #--------------------------------------------------------------------------------
 netgen -batch lvs "../mag/user_analog_project_wrapper.spice user_analog_project_wrapper" "../xschem/top.spice user_analog_project_wrapper" sky130B_setup.tcl comp.out
+echo "Circuit 1 is the netlist extracted from magic, Circuit 2 is the netlist extracted from xschem"
diff --git a/xschem/hv_tgate.sym b/xschem/hv_tgate.sym
index 6e1cdab..95f280e 100644
--- a/xschem/hv_tgate.sym
+++ b/xschem/hv_tgate.sym
@@ -23,19 +23,21 @@
 L 4 -40 40 0 20 {}
 L 4 -0 -50 -0 -20 {}
 L 4 -0 30 -0 50 {}
-L 4 30 60 30 80 {}
-L 4 30 -80 30 -60 {}
+L 4 20 60 20 80 {}
+L 4 20 -80 20 -60 {}
+L 4 20 -60 20 -30 {}
+L 4 20 30 20 60 {}
 B 5 -2.5 47.5 2.5 52.5 {name=S_NOT dir=in }
-B 5 27.5 77.5 32.5 82.5 {name=VGND dir=inout}
-B 5 27.5 -82.5 32.5 -77.5 {name=VHVPWR dir=inout}
+B 5 17.5 77.5 22.5 82.5 {name=VGND dir=inout}
+B 5 17.5 -82.5 22.5 -77.5 {name=VHVPWR dir=inout}
 B 5 -62.5 -2.5 -57.5 2.5 {name=A dir=inout}
 B 5 57.5 -2.5 62.5 2.5 {name=B dir=inout }
 B 5 -2.5 -52.5 2.5 -47.5 {name=S dir=in }
 A 4 0.3125 24.4375 4.448489912318562 94.02826366648515 351.9434726670297 {}
 T {@name} 45 -32 0 0 0.2 0.2 {}
 T {S_NOT} -35 36 0 0 0.2 0.2 {}
-T {VGND} 15 46 0 0 0.2 0.2 {}
-T {VHVPWR} 15 -54 0 0 0.2 0.2 {}
+T {VGND} 25 56 0 0 0.2 0.2 {}
+T {VHVPWR} 25 -74 0 0 0.2 0.2 {}
 T {A} -55 -14 0 0 0.2 0.2 {}
 T {B} 65 -14 0 1 0.2 0.2 {}
 T {S} -15 -44 0 0 0.2 0.2 {}
diff --git a/xschem/user_analog_project_wrapper.sch b/xschem/user_analog_project_wrapper.sch
index 7ba95f1..b83aff9 100644
--- a/xschem/user_analog_project_wrapper.sch
+++ b/xschem/user_analog_project_wrapper.sch
@@ -41,24 +41,28 @@
 lab=#net1}
 N 910 -979 1000 -979 {
 lab=gpio_noesd[0]}
-N 357 -497 357 -452 { lab=#net2}
-N 222 -372 267 -372 { lab=gpio_analog[11]}
-N 327 -452 327 -422 { lab=gpio_analog[9]}
-N 387 -372 437 -372 { lab=gpio_analog[12]}
 N 480 -1020 845 -1020 {
 lab=#net1}
 N 845 -1020 910 -1020 {
 lab=#net1}
 N 910 -1020 910 -1019 {
 lab=#net1}
-N 357 -292 357 -226 {
-lab=#net3}
-N 327 -322 327 -291 {
-lab=gpio_analog[10]}
 N 1090 -319 1090 -259 {
 lab=vssd2}
 N 1090 -539 1090 -439 {
 lab=vccd2}
+N 490 -380 560 -380 {
+lab=gpio_analog[9]}
+N 430 -330 430 -260 {
+lab=gpio_analog[10]}
+N 450 -300 450 -210 {
+lab=vssa1}
+N 450 -500 450 -460 {
+lab=vdda1}
+N 430 -500 430 -430 {
+lab=gpio_analog[9]}
+N 320 -380 370 -380 {
+lab=gpio_analog[11]}
 C {devices/lab_pin.sym} -430 -540 2 0 {name=l1 lab=io_analog[1]}
 C {devices/lab_pin.sym} -510 -540 0 0 {name=l2 lab=io_analog[0]}
 C {devices/lab_pin.sym} -580 -380 0 0 {name=l3 lab=io_analog[4]}
@@ -115,13 +119,6 @@
 C {devices/lab_pin.sym} 1230 -999 2 0 {name=l28 sig_type=std_logic lab=gpio_noesd[0]}
 C {sky130_sc_ams__ota_1.sym} 1080 -999 0 0 {name=x3}
 C {devices/lab_pin.sym} 1090 -879 0 0 {name=l17 sig_type=std_logic lab=vssd1}
-C {hv_tgate.sym} 327 -372 0 0 {name=x8}
-C {devices/lab_pin.sym} 357.1199999999999 -497.6099999999999 3 1 {name=l49 lab=vdda1}
-C {devices/lab_pin.sym} 357.3599999999999 -226.63 0 1 {name=l50 lab=vssa1}
-C {devices/lab_pin.sym} 222 -372 0 0 {name=l51 sig_type=std_logic lab=gpio_analog[11]}
-C {devices/lab_pin.sym} 327 -452 1 0 {name=l52 sig_type=std_logic lab=gpio_analog[9]}
-C {devices/lab_pin.sym} 327 -292 3 0 {name=l53 sig_type=std_logic lab=gpio_analog[10]}
-C {devices/lab_pin.sym} 437 -372 2 0 {name=l54 sig_type=std_logic lab=gpio_analog[12]}
 C {devices/lab_pin.sym} 1090 -1159 0 0 {name=l55 sig_type=std_logic lab=vccd1
 }
 C {devices/lab_pin.sym} 120 -980 0 0 {name=l8 sig_type=std_logic lab=io_analog[6]}
@@ -133,3 +130,10 @@
 C {devices/lab_pin.sym} 1000 -399 0 0 {name=l12 sig_type=std_logic lab=gpio_noesd[13]}
 C {devices/lab_pin.sym} 1000 -359 0 0 {name=l13 sig_type=std_logic lab=gpio_noesd[14]}
 C {devices/lab_pin.sym} 1160 -379 0 1 {name=l14 sig_type=std_logic lab=gpio_noesd[15]}
+C {devices/lab_pin.sym} 450 -210 2 0 {name=l15 lab=vssa1}
+C {hv_tgate.sym} 430 -380 0 0 {name=x6}
+C {devices/lab_pin.sym} 430 -260 3 0 {name=l18 lab=gpio_analog[10]}
+C {devices/lab_pin.sym} 320 -380 0 0 {name=l26 lab=gpio_analog[11]}
+C {devices/lab_pin.sym} 430 -500 1 0 {name=l29 lab=gpio_analog[9]}
+C {devices/lab_pin.sym} 450 -500 2 0 {name=l30 lab=vdda1}
+C {devices/lab_pin.sym} 560 -380 2 0 {name=l16 lab=gpio_analog[12]}