Merge branch 'master' of ssh://libre-riscv.org:922/soclayout
[soclayout.git] / experiments9 / loadc4m.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 import sys
5 import os.path
6 import Cfg
7 import Hurricane
8 from Hurricane import DbU, DataBase, UpdateSession, Library, Cell
9 import Viewer
10 import CRL
11 from helpers.io import ErrorMessage, WarningMessage
12 from helpers.overlay import UpdateSession
13 from plugins.alpha.macro.macro import Macro
14 from CRL import Gds
15
16 from helpers import l, u, n
17 from Hurricane import DbU
18 from Hurricane import DataBase
19 from Hurricane import Technology
20
21 import common
22
23 def create_gds():
24
25 tech = DataBase.getDB().getTechnology()
26 if tech:
27 print WarningMessage( 'cmos.technology: Technology already exists, "%s"' % tech.getName() )
28 else:
29 tech = Technology.create( DataBase.getDB(), 'c4mgds' )
30
31 # Table guessed from the GDSII layouts of the cells.
32 # FreePDK45/osu_soc/lib/source/gds/*.gds
33 #
34 # Format of an entry in the table:
35 # (Symbolic_Name, CIF_Name, GDSII_Number)
36 gdsLayersTable = \
37 ( ("pWell" , "CWN" , 2, 0)
38 , ("nWell" , "CWP" , 1, 0)
39 , ("active" , "CAA" , 5, 0)
40 , ("pImplant", "CSP" , 8, 0)
41 , ("nImplant", "CSN" , 7, 0)
42 , ("poly" , "CPG" , 15, 0)
43 , ("cut0" , "CCC" , 16, 0)
44 , ("metal1" , "CM1" , 18, 0) # guessing
45 , ("cut1" , "CV1" , 22, 0)
46 , ("metal2" , "CM2" , 23, 0)
47 , ("cut2" , "CV2" , 24, 0)
48 , ("metal3" , "CM3" , 25, 0)
49 , ("cut3" , "CV3" , 26, 0)
50 , ("metal4" , "CM4" , 27, 0)
51 , ("cut4" , "CV4" , 28, 0)
52 , ("metal5" , "CM5" , 29, 0)
53 , ("cut5" , "CV5" , 30, 0)
54 , ("metal6" , "CM6" , 31, 0)
55 , ("cut6" , "CV6" , 32, 0)
56 , ("metal7" , "CM7" , 33, 0)
57 , ("cut7" , "CV7" , 34, 0)
58 , ("metal8" , "CM8" , 35, 0)
59 , ("cut8" , "CV8" , 36, 0)
60 , ("metal9" , "CM9" , 37, 0)
61 , ("cut9" , "CV9" , 38, 0)
62 , ("metal10" , "CM10" , 150, 0) # errr block? somewhere?
63 )
64
65
66 common.loadGdsLayers( gdsLayersTable )
67
68 def scriptMain ( **kw ):
69 create_gds()
70 editor = None
71 if kw.has_key('editor') and kw['editor']:
72 editor = kw['editor']
73 with UpdateSession():
74 rootLibrary = DataBase.getDB().getRootLibrary()
75 gdsLibrary = rootLibrary.getLibrary('gds')
76 if not gdsLibrary:
77 gdsLibrary = Library.create(rootLibrary, "GDS")
78 Gds.load( gdsLibrary, "C4MLogo.gds")
79 c4m = gdsLibrary.getCell( 'C4MLogo' )
80 print ("c4m", c4m)
81 if editor: editor.setCell( c4m )
82 return c4m
83
84 if __name__ == '__main__':
85 #from coriolis2 import settings
86 scriptMain()