forked from yellekelyk/PyVerilog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCell.py
33 lines (25 loc) · 877 Bytes
/
Cell.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from Generic import *
from ordereddict import OrderedDict
import Pin
class Cell(Generic):
"Defines an instantiated Cell"
def __init__(self, attrs):
Generic.__init__(self, attrs)
self.__submodname = self.get("submodname")
# to be linked
self.__pins = OrderedDict()
self.__submod = None
pins = property(lambda self: self.__pins)
submodname = property(lambda self: self.__submodname)
submod = property(lambda self: self.__submod)
def new_pin(self, pinAttr):
pinAttr["cell"] = self
pinAttr["module"] = self.module
# create new pin here
pin = Pin.Pin(pinAttr)
self.__pins[pin.name] = pin
return pin
def linkMod(self, mod):
if self.__submod != None:
print "Warning: " + self.name + " multiply linked"
self.__submod = mod