Revert "Merge branch 'fix_isosub' into 'main'"

This reverts merge request !1
diff --git a/mag/user_analog_project_wrapper.mag b/mag/user_analog_project_wrapper.mag
index c3952cf..1ed5d85 100644
--- a/mag/user_analog_project_wrapper.mag
+++ b/mag/user_analog_project_wrapper.mag
@@ -1,154 +1,11 @@
 magic
 tech sky130B
-magscale 1 2
-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
-<< metal1 >>
-rect 141506 696318 582623 696394
-rect 141697 696214 582502 696290
-rect 141858 696110 582381 696186
-rect 142041 696005 582263 696081
-rect 561180 686400 561428 686442
-rect 561180 686254 561216 686400
-rect 561378 686254 561428 686400
-rect 561180 686250 561428 686254
-rect 561180 686190 562138 686250
-rect 558090 686104 561685 686105
-rect 557756 686051 561685 686104
-rect 557756 684830 557940 686051
-rect 561180 685910 561428 685952
-rect 561180 685764 561216 685910
-rect 561378 685764 561428 685910
-rect 561631 685932 561685 686051
-rect 561631 685878 562119 685932
-rect 561180 685760 561428 685764
-rect 561630 685790 562120 685850
-rect 561630 685760 561690 685790
-rect 561180 685700 561690 685760
-rect 560901 685478 562115 685532
-rect 326566 684824 557940 684830
-rect 326566 684652 326572 684824
-rect 326878 684652 557940 684824
-rect 326566 684646 557940 684652
-rect 224866 683795 226828 683796
-rect 560907 683795 560961 685478
-rect 224866 683790 560962 683795
-rect 224866 683618 224872 683790
-rect 225178 683618 560962 683790
-rect 224866 683613 560962 683618
-rect 224866 683612 226828 683613
-rect 51438 666500 51708 666507
-rect 51438 666332 51446 666500
-rect 51700 666332 51708 666500
-rect 43033 663602 50280 663611
-rect 43033 663434 43042 663602
-rect 43190 663434 50280 663602
-rect 43033 663425 50280 663434
-rect 50094 661154 50280 663425
-rect 51438 661176 51708 666332
-rect 53452 663594 56384 663602
-rect 53452 663434 56256 663594
-rect 56376 663434 56384 663594
-rect 53452 663426 56384 663434
-rect 51830 661200 52004 661224
-rect 53452 661220 53628 663426
-rect 51830 661166 51858 661200
-rect 51976 661166 52004 661200
-rect 51830 660998 52004 661166
-rect 51839 657600 52002 660998
-rect 51839 657502 51858 657600
-rect 51982 657502 52002 657600
-rect 51839 657487 52002 657502
-rect 582187 657401 582263 696005
-rect 582305 657401 582381 696110
-rect 582426 657401 582502 696214
-rect 582547 657401 582623 696318
-rect 2534 514428 3363 514438
-rect 2534 514418 2544 514428
-rect 2411 513766 2544 514418
-rect 3353 514418 3363 514428
-rect 3353 513766 3418 514418
-rect 2411 506084 3418 513766
-rect 2412 167769 3417 506084
-rect 252807 427783 253013 427822
-rect 252747 427676 253013 427783
-rect 252807 425753 253013 427676
-rect 250978 425744 253013 425753
-rect 250978 425412 250988 425744
-rect 251371 425412 253013 425744
-rect 250978 425403 253013 425412
-rect 531967 283922 533119 283942
-rect 531967 283849 531987 283922
-rect 530832 283729 531987 283849
-rect 531966 283615 531987 283729
-rect 533099 283615 533119 283922
-rect 531966 283596 533119 283615
-rect 531967 283594 533119 283596
-rect 530983 283508 531063 283518
-rect 530983 283448 530993 283508
-rect 531053 283448 531063 283508
-rect 530983 283438 531063 283448
-rect 530543 283195 530615 283201
-rect 530543 283136 530549 283195
-rect 530610 283136 530615 283195
-rect 530543 283129 530615 283136
-rect 531965 283024 533029 283148
-rect 530627 282920 533029 283024
-rect 537781 283011 537855 283023
-rect 537781 282957 537790 283011
-rect 537844 282957 537855 283011
-rect 537781 282948 537855 282957
-rect 531965 282904 533029 282920
-rect 531965 282730 531975 282904
-rect 533000 282853 533029 282904
-rect 533000 282730 533030 282853
-rect 531965 282727 533030 282730
-rect 531965 282725 533029 282727
-rect 2412 167613 10290 167769
-rect 2412 167602 3417 167613
-rect 8165 167172 9117 167182
-rect 8165 167095 8175 167172
-rect 8252 167095 9117 167172
-rect 8165 167085 9117 167095
-rect 13844 167048 13917 167058
-rect 13844 166995 13854 167048
-rect 13907 166995 13917 167048
-rect 13844 166985 13917 166995
-<< via1 >>
-rect 561216 686254 561378 686400
-rect 561216 685764 561378 685910
-rect 326572 684652 326878 684824
-rect 224872 683618 225178 683790
-rect 51446 666332 51700 666500
-rect 43042 663434 43190 663602
-rect 56256 663434 56376 663594
-rect 51858 657502 51982 657600
-rect 2544 513766 3353 514428
-rect 250988 425412 251371 425744
-rect 531987 283615 533099 283922
-rect 537783 283728 537836 283780
-rect 530993 283495 531053 283508
-rect 530993 283461 531009 283495
-rect 531009 283461 531043 283495
-rect 531043 283461 531053 283495
-rect 530993 283448 531053 283461
-rect 530549 283136 530610 283195
-rect 537790 283003 537844 283011
-rect 537790 282968 537801 283003
-rect 537801 282968 537835 283003
-rect 537835 282968 537844 283003
-rect 537790 282957 537844 282968
-rect 531975 282730 533000 282904
-rect 13846 167762 13899 167815
-rect 8175 167095 8252 167172
-rect 13854 166995 13907 167048
+timestamp 1632839657
+<< checkpaint >>
+rect -680 351370 292680 352680
+rect -680 630 630 351370
+rect 291370 630 292680 351370
+rect -680 -680 292680 630
 << metal2 >>
 rect 262 -400 318 240
 rect 853 -400 909 240
@@ -844,34 +701,10 @@
 rect 159497 351150 161997 352400
 rect 164647 351150 167147 352400
 << comment >>
-rect -100 704000 584100 704100
-rect -100 0 0 704000
-rect 584000 0 584100 704000
-rect -100 -100 584100 0
-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
+rect -50 352000 292050 352050
+rect -50 0 0 352000
+rect 292000 0 292050 352000
+rect -50 -50 292050 0
 << labels >>
 flabel metal3 s 291760 134615 292400 134671 0 FreeSans 560 0 0 0 gpio_analog[0]
 port 0 nsew signal bidirectional
diff --git a/netgen/run_lvs_wrapper_xschem.sh b/netgen/run_lvs_wrapper_xschem.sh
index 2cea6d9..12e5a92 100755
--- a/netgen/run_lvs_wrapper_xschem.sh
+++ b/netgen/run_lvs_wrapper_xschem.sh
@@ -20,4 +20,3 @@
 #
 #--------------------------------------------------------------------------------
 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 95f280e..6e1cdab 100644
--- a/xschem/hv_tgate.sym
+++ b/xschem/hv_tgate.sym
@@ -23,21 +23,19 @@
 L 4 -40 40 0 20 {}
 L 4 -0 -50 -0 -20 {}
 L 4 -0 30 -0 50 {}
-L 4 20 60 20 80 {}
-L 4 20 -80 20 -60 {}
-L 4 20 -60 20 -30 {}
-L 4 20 30 20 60 {}
+L 4 30 60 30 80 {}
+L 4 30 -80 30 -60 {}
 B 5 -2.5 47.5 2.5 52.5 {name=S_NOT dir=in }
-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 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 -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} 25 56 0 0 0.2 0.2 {}
-T {VHVPWR} 25 -74 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 {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 b83aff9..7ba95f1 100644
--- a/xschem/user_analog_project_wrapper.sch
+++ b/xschem/user_analog_project_wrapper.sch
@@ -41,28 +41,24 @@
 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]}
@@ -119,6 +115,13 @@
 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]}
@@ -130,10 +133,3 @@
 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]}