Skip to content

Commit

Permalink
Remove pandas dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
mole99 committed Jul 10, 2024
1 parent 677bc14 commit a68144c
Show file tree
Hide file tree
Showing 16 changed files with 142 additions and 160 deletions.
30 changes: 14 additions & 16 deletions sky130_tech/tech/sky130/lvs/sky130.lylvs
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,19 @@
<interpreter>dsl</interpreter>
<dsl-interpreter-name>lvs-dsl-xml</dsl-interpreter-name>
<text>
# Copyright 2022 Mabrains
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

# %include sky130.lvs
# Copyright 2022 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# %include sky130.lvs
</text>
</klayout-macro>
3 changes: 1 addition & 2 deletions sky130_tech/tech/sky130/pymacros/sky130_pcells/PcGRing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from sky130_pcells.imported_generators.layers_definiations import *
import pya
import math
import pandas as pd


class pcGRingGenerator(pya.PCellDeclarationHelper):
Expand Down Expand Up @@ -370,4 +369,4 @@ def rectRowCenterToCenter(self, l_rect, pathLen, min_rect_spc, rect_size, grid,
def produce_impl(self):

# call GRing sub fucntion (_GRing)
self._GRing(self.layout,self.cell,self.well,self.hvnwell,self.nwell_hole,self.w,self.l,self.h,self.LmCON,self.RmCON,self.BmCON,self.TmCON,self.covmCON)
self._GRing(self.layout,self.cell,self.well,self.hvnwell,self.nwell_hole,self.w,self.l,self.h,self.LmCON,self.RmCON,self.BmCON,self.TmCON,self.covmCON)
3 changes: 1 addition & 2 deletions sky130_tech/tech/sky130/pymacros/sky130_pcells/PcNmos5d10.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import pya
import math

import pandas as pd

class pcNmos5d10Generator(pya.PCellDeclarationHelper):

Expand Down Expand Up @@ -402,4 +401,4 @@ def _Nmos5d10(self, w, l, sab, gate_contact, gate_contact_num, finger_num, grCov
def produce_impl(self):

# call sub fucntion (__pcNmos5d10)
nmos5d10 = self._Nmos5d10(self.w, self.l, self.sab, self.gate_contact,self.gate_contact_num, self.finger_num,self.grCovmCON,self.sdCovmCON)
nmos5d10 = self._Nmos5d10(self.w, self.l, self.sab, self.gate_contact,self.gate_contact_num, self.finger_num,self.grCovmCON,self.sdCovmCON)
3 changes: 1 addition & 2 deletions sky130_tech/tech/sky130/pymacros/sky130_pcells/PcViaStack.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from sky130_pcells.imported_generators.layers_definiations import *
import pya
import math
import pandas as pd


"""
Expand Down Expand Up @@ -363,4 +362,4 @@ def _PcViaStack(self,layout, cell, width,length,starting_metal,ending_metal,shap
def produce_impl(self):

# generate the layout of pcViaStack subpcell (_PcViaStack)
self._PcViaStack(self.layout, self.cell,self.width,self.length,self.starting_metal,self.ending_metal,shapetrans = pya.DPoint())
self._PcViaStack(self.layout, self.cell,self.width,self.length,self.starting_metal,self.ending_metal,shapetrans = pya.DPoint())
6 changes: 3 additions & 3 deletions sky130_tech/tech/sky130/pymacros/sky130_pcells/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
from sky130_pcells.PcnvtNmos33 import pcnvtNmos33Generator
from sky130_pcells.PcnvtNmos5 import pcnvtNmos5Generator
from sky130_pcells.PcNmos5d10 import pcNmos5d10Generator
from sky130_pcells.nmos18 import NMOS18
from sky130_pcells.pmos18 import PMOS18
#from sky130_pcells.nmos18 import NMOS18
#from sky130_pcells.pmos18 import PMOS18
from sky130_pcells.polyres import PolyRes_gen
from sky130_pcells.inductor import IndGenerator
from sky130_pcells.rectangular_shielding import rectangular_shielding_Generator
Expand All @@ -50,7 +50,7 @@
from sky130_pcells.single_octagon_ind import single_octagon_ind_Generator
from sky130_pcells.new_single_octagon_ind import new_single_octagon_Generator
from sky130_pcells.diff_octagon import diff_octagon_ind_Generator
from sky130_pcells.nmos5d10 import nmos5d10_gen
#from sky130_pcells.nmos5d10 import nmos5d10_gen
from sky130_pcells.pmos5d10 import pmos5d10_gen
from sky130_pcells.mimcap_1 import mimcap_1_gen
from sky130_pcells.mimcap_2 import mimcap_2_gen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from .layers_definiations import *
import pya
import math
import pandas as pd


"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from .layers_definiations import *
import pya
import math
import pandas as pd


"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,54 +20,72 @@
##
########################################################################################################################

import pandas as pd
import pya
import csv
import os

# print(os.system('pwd'))
lay_csv_map = os.path.join(os.path.dirname(os.path.realpath(__file__)),"gds_layers.csv")
lay_df = pd.read_csv(lay_csv_map)
#lay_df = pd.read_csv(lay_csv_map)


layers = []
with open(lay_csv_map, newline='') as csvfile:
reader = csv.reader(csvfile, delimiter=',', quotechar='"')
header = next(reader)

for row in reader:
new_row = {}
for index, entry in enumerate(row):
new_row[header[index]] = row[index]
layers.append(new_row)

def get_layer_id(layer_name, purpose_contains):
for layer in layers:
if layer["Layer name"] == layer_name and purpose_contains in layer["Purpose"]:
return layer["GDS layer:datatype"]
return None

# print(lay_df)
nsdm_lay_str = lay_df.loc[(lay_df["Layer name"] == "nsdm") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
psdm_lay_str = lay_df.loc[(lay_df["Layer name"] == "psdm") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
diff_lay_str = lay_df.loc[(lay_df["Layer name"] == "diff") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
poly_lay_str = lay_df.loc[(lay_df["Layer name"] == "poly") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
licon_lay_str = lay_df.loc[(lay_df["Layer name"] == "licon1") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
npc_lay_str = lay_df.loc[(lay_df["Layer name"] == "npc") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
li_lay_str = lay_df.loc[(lay_df["Layer name"] == "li1") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
mcon_lay_str = lay_df.loc[(lay_df["Layer name"] == "mcon") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
met1_lay_str = lay_df.loc[(lay_df["Layer name"] == "met1") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
tap_lay_str = lay_df.loc[(lay_df["Layer name"] == "tap") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
nwell_lay_str = lay_df.loc[(lay_df["Layer name"] == "nwell") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
dnwell_lay_str = lay_df.loc[(lay_df["Layer name"] == "dnwell") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
via_lay_str = lay_df.loc[(lay_df["Layer name"] == "via") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
met2_lay_str = lay_df.loc[(lay_df["Layer name"] == "met2") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
met3_lay_str = lay_df.loc[(lay_df["Layer name"] == "met3") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
met4_lay_str = lay_df.loc[(lay_df["Layer name"] == "met4") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
met5_lay_str = lay_df.loc[(lay_df["Layer name"] == "met5") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
via2_lay_str = lay_df.loc[(lay_df["Layer name"] == "via2") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
via3_lay_str = lay_df.loc[(lay_df["Layer name"] == "via3") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
via2_lay_str = lay_df.loc[(lay_df["Layer name"] == "via2") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
via3_lay_str = lay_df.loc[(lay_df["Layer name"] == "via3") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
via4_lay_str = lay_df.loc[(lay_df["Layer name"] == "via4") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
urpm_lay_str = lay_df.loc[(lay_df["Layer name"] == "urpm") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
poly_res_lay_str = lay_df.loc[(lay_df["Layer name"] == "poly") & (lay_df["Purpose"].str.contains("resistor")), "GDS layer:datatype"].values[0]
prbndry_lay_str = lay_df.loc[(lay_df["Layer name"] == "prBndry") & (lay_df["Purpose"].str.contains("boundary")), "GDS layer:datatype"].values[0]
poly_label_lay_str = lay_df.loc[(lay_df["Layer name"] == "poly") & (lay_df["Purpose"].str.contains("label")), "GDS layer:datatype"].values[0]
met1_label_lay_str = lay_df.loc[(lay_df["Layer name"] == "met1") & (lay_df["Purpose"].str.contains("label")), "GDS layer:datatype"].values[0]
me1_pin_lay_str = lay_df.loc[(lay_df["Layer name"] == "met1") & (lay_df["Purpose"].str.contains("pin")), "GDS layer:datatype"].values[0]
met2_label_lay_str = lay_df.loc[(lay_df["Layer name"] == "met2") & (lay_df["Purpose"].str.contains("label")), "GDS layer:datatype"].values[0]
met4_label_lay_str = lay_df.loc[(lay_df["Layer name"] == "met4") & (lay_df["Purpose"].str.contains("label")), "GDS layer:datatype"].values[0]
met5_label_lay_str = lay_df.loc[(lay_df["Layer name"] == "met5") & (lay_df["Purpose"].str.contains("label")), "GDS layer:datatype"].values[0]
l_capm_lay_str = lay_df.loc[(lay_df["Layer name"] == "capm") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
l_cap2m_lay_str = lay_df.loc[(lay_df["Layer name"] == "cap2m") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
l_hvntm_lay_str = lay_df.loc[(lay_df["Layer name"] == "hvntm") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
l_hvi_lay_str = lay_df.loc[(lay_df["Layer name"] == "hvi") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
l_lvtn_lay_str = lay_df.loc[(lay_df["Layer name"] == "lvtn") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
l_hvtp_lay_str = lay_df.loc[(lay_df["Layer name"] == "hvtp") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
l_areaid_lvt_lay_str = lay_df.loc[(lay_df["Layer name"] == "areaid.lvt") & (lay_df["Purpose"].str.contains("dentifier")), "GDS layer:datatype"].values[0]
l_areaid_le_lay_str = lay_df.loc[(lay_df["Layer name"] == "areaid.le") & (lay_df["Purpose"].str.contains("dentifier")), "GDS layer:datatype"].values[0]
nsdm_lay_str = get_layer_id("nsdm", "drawing") #lay_df.loc[(lay_df["Layer name"] == "nsdm") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
psdm_lay_str = get_layer_id("psdm", "drawing") #lay_df.loc[(lay_df["Layer name"] == "psdm") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
diff_lay_str = get_layer_id("diff", "drawing") #lay_df.loc[(lay_df["Layer name"] == "diff") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
poly_lay_str = get_layer_id("poly", "drawing") #lay_df.loc[(lay_df["Layer name"] == "poly") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
licon_lay_str = get_layer_id("licon1", "drawing") #lay_df.loc[(lay_df["Layer name"] == "licon1") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
npc_lay_str = get_layer_id("npc", "drawing") #lay_df.loc[(lay_df["Layer name"] == "npc") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
li_lay_str = get_layer_id("li1", "drawing") #lay_df.loc[(lay_df["Layer name"] == "li1") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
mcon_lay_str = get_layer_id("mcon", "drawing") #lay_df.loc[(lay_df["Layer name"] == "mcon") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
met1_lay_str = get_layer_id("met1", "drawing") #lay_df.loc[(lay_df["Layer name"] == "met1") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
tap_lay_str = get_layer_id("tap", "drawing") #lay_df.loc[(lay_df["Layer name"] == "tap") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
nwell_lay_str = get_layer_id("nwell", "drawing") #lay_df.loc[(lay_df["Layer name"] == "nwell") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
dnwell_lay_str = get_layer_id("dnwell", "drawing") #lay_df.loc[(lay_df["Layer name"] == "dnwell") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
via_lay_str = get_layer_id("via", "drawing") #lay_df.loc[(lay_df["Layer name"] == "via") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
met2_lay_str = get_layer_id("met2", "drawing") #lay_df.loc[(lay_df["Layer name"] == "met2") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
met3_lay_str = get_layer_id("met3", "drawing") #lay_df.loc[(lay_df["Layer name"] == "met3") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
met4_lay_str = get_layer_id("met4", "drawing") #lay_df.loc[(lay_df["Layer name"] == "met4") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
met5_lay_str = get_layer_id("met5", "drawing") #lay_df.loc[(lay_df["Layer name"] == "met5") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
via2_lay_str = get_layer_id("via2", "drawing") #lay_df.loc[(lay_df["Layer name"] == "via2") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
via3_lay_str = get_layer_id("via3", "drawing") #lay_df.loc[(lay_df["Layer name"] == "via3") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
via2_lay_str = get_layer_id("via2", "drawing") #lay_df.loc[(lay_df["Layer name"] == "via2") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
via3_lay_str = get_layer_id("via3", "drawing") #lay_df.loc[(lay_df["Layer name"] == "via3") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
via4_lay_str = get_layer_id("via4", "drawing") #lay_df.loc[(lay_df["Layer name"] == "via4") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
urpm_lay_str = get_layer_id("urpm", "drawing") #lay_df.loc[(lay_df["Layer name"] == "urpm") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
poly_res_lay_str = get_layer_id("poly", "resistor") #lay_df.loc[(lay_df["Layer name"] == "poly") & (lay_df["Purpose"].str.contains("resistor")), "GDS layer:datatype"].values[0]
prbndry_lay_str = get_layer_id("prBndry", "boundary") #lay_df.loc[(lay_df["Layer name"] == "prBndry") & (lay_df["Purpose"].str.contains("boundary")), "GDS layer:datatype"].values[0]
poly_label_lay_str = get_layer_id("poly", "label") #lay_df.loc[(lay_df["Layer name"] == "poly") & (lay_df["Purpose"].str.contains("label")), "GDS layer:datatype"].values[0]
met1_label_lay_str = get_layer_id("met1", "label") #lay_df.loc[(lay_df["Layer name"] == "met1") & (lay_df["Purpose"].str.contains("label")), "GDS layer:datatype"].values[0]
me1_pin_lay_str = get_layer_id("met1", "pin") #lay_df.loc[(lay_df["Layer name"] == "met1") & (lay_df["Purpose"].str.contains("pin")), "GDS layer:datatype"].values[0]
met2_label_lay_str = get_layer_id("met2", "label") #lay_df.loc[(lay_df["Layer name"] == "met2") & (lay_df["Purpose"].str.contains("label")), "GDS layer:datatype"].values[0]
met4_label_lay_str = get_layer_id("met4", "label") #lay_df.loc[(lay_df["Layer name"] == "met4") & (lay_df["Purpose"].str.contains("label")), "GDS layer:datatype"].values[0]
met5_label_lay_str = get_layer_id("met5", "label") #lay_df.loc[(lay_df["Layer name"] == "met5") & (lay_df["Purpose"].str.contains("label")), "GDS layer:datatype"].values[0]
l_capm_lay_str = get_layer_id("capm", "drawing") #lay_df.loc[(lay_df["Layer name"] == "capm") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
l_cap2m_lay_str = get_layer_id("cap2m", "drawing") #lay_df.loc[(lay_df["Layer name"] == "cap2m") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
l_hvntm_lay_str = get_layer_id("hvntm", "drawing") #lay_df.loc[(lay_df["Layer name"] == "hvntm") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
l_hvi_lay_str = get_layer_id("hvi", "drawing") #lay_df.loc[(lay_df["Layer name"] == "hvi") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
l_lvtn_lay_str = get_layer_id("lvtn", "drawing") #lay_df.loc[(lay_df["Layer name"] == "lvtn") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
l_hvtp_lay_str = get_layer_id("hvtp", "drawing") #lay_df.loc[(lay_df["Layer name"] == "hvtp") & (lay_df["Purpose"].str.contains("drawing")), "GDS layer:datatype"].values[0]
l_areaid_lvt_lay_str = get_layer_id("areaid.lvt", "dentifier") #lay_df.loc[(lay_df["Layer name"] == "areaid.lvt") & (lay_df["Purpose"].str.contains("dentifier")), "GDS layer:datatype"].values[0]
l_areaid_le_lay_str = get_layer_id("areaid.le", "dentifier") #lay_df.loc[(lay_df["Layer name"] == "areaid.le") & (lay_df["Purpose"].str.contains("dentifier")), "GDS layer:datatype"].values[0]

## Extract Layer GDS Num & Purpose
diff_lay_num = int(diff_lay_str.split(":")[0])
Expand Down
1 change: 0 additions & 1 deletion sky130_tech/tech/sky130/pymacros/sky130_pcells/inductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from .layers_definiations import *
import pya
import math
import pandas as pd


"""
Expand Down
Loading

0 comments on commit a68144c

Please sign in to comment.