mirror of https://github.com/openXC7/prjxray.git
Fix some comments.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
This commit is contained in:
parent
3838a643cf
commit
cf84dfe2fd
|
|
@ -0,0 +1,65 @@
|
|||
""" Math models are used to represent abstract operations for the timing models.
|
||||
This is useful for creating excel workbooks that can update dynamically, or
|
||||
generating a model with symbolic constants to be backsolved.
|
||||
"""
|
||||
|
||||
|
||||
class ExcelMathModel(object):
|
||||
""" Math model used for outputting to an dyanmic Excel sheet. """
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def sum(self, elems):
|
||||
sum_val = '(' + ' + '.join(elems) + ')'
|
||||
if sum_val == '()':
|
||||
return '0'
|
||||
else:
|
||||
return sum_val
|
||||
|
||||
def product(self, elems):
|
||||
sum_val = '(' + ' * '.join(elems) + ')'
|
||||
if sum_val == '()':
|
||||
return '1'
|
||||
else:
|
||||
return sum_val
|
||||
|
||||
def plus(self, a, b):
|
||||
return self.sum((a, b))
|
||||
|
||||
def divide(self, a, b):
|
||||
return '({}/{})'.format(a, b)
|
||||
|
||||
def multiply(self, a, b):
|
||||
return '({}*{})'.format(a, b)
|
||||
|
||||
def eval(self, elem):
|
||||
return '=' + elem
|
||||
|
||||
|
||||
def PythonMathModel(object):
|
||||
""" Math model used for outputting values equalated immediately. """
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def sum(self, elems):
|
||||
return sum(elems)
|
||||
|
||||
def product(self, elems):
|
||||
v = 1.0
|
||||
for elem in elems:
|
||||
v *= elem
|
||||
return v
|
||||
|
||||
def divide(self, a, b):
|
||||
return a / b
|
||||
|
||||
def plus(self, a, b):
|
||||
return a + b
|
||||
|
||||
def multiply(self, a, b):
|
||||
return a * b
|
||||
|
||||
def eval(self, elem):
|
||||
return elem
|
||||
|
|
@ -8,7 +8,7 @@ TileDbs = namedtuple(
|
|||
'TileDbs', 'segbits block_ram_segbits ppips mask tile_type')
|
||||
|
||||
|
||||
class OutpinTiming(namedtuple('OutpinTiming', 'delays drive_resistance')):
|
||||
class OutPinTiming(namedtuple('OutPinTiming', 'delays drive_resistance')):
|
||||
""" Timing for site output pins.
|
||||
|
||||
Attributes
|
||||
|
|
@ -22,7 +22,7 @@ class OutpinTiming(namedtuple('OutpinTiming', 'delays drive_resistance')):
|
|||
pass
|
||||
|
||||
|
||||
class InpinTiming(namedtuple('InpinTiming', 'delays capacitance')):
|
||||
class InPinTiming(namedtuple('InPinTiming', 'delays capacitance')):
|
||||
""" Timing for site input pins.
|
||||
|
||||
Attributes
|
||||
|
|
@ -125,7 +125,7 @@ class SitePin(namedtuple('SitePin', 'name wire timing')):
|
|||
all sites of the same type.
|
||||
wire : str
|
||||
Wire name within the tile. This name is site instance specific.
|
||||
timing : Either InpinTiming or OutpinTiming
|
||||
timing : Either InPinTiming or OutPinTiming
|
||||
Timing of site pin. May be None if database lacks timing information.
|
||||
|
||||
"""
|
||||
|
|
@ -177,13 +177,13 @@ def get_pip_timing(pip_timing_json):
|
|||
|
||||
|
||||
def get_site_pin_timing(site_pin_info):
|
||||
""" Convert site_pin_info JSON into InpinTiming or OutpinTiming object.
|
||||
""" Convert site_pin_info JSON into InPinTiming or OutPinTiming object.
|
||||
|
||||
Returns
|
||||
-------
|
||||
If timing information is not present for this site pin, returns None.
|
||||
If this is an output pin, returns OutpinTiming.
|
||||
If this is an input pin, returns InpinTiming.
|
||||
If this is an output pin, returns OutPinTiming.
|
||||
If this is an input pin, returns InPinTiming.
|
||||
|
||||
"""
|
||||
if isinstance(site_pin_info, str):
|
||||
|
|
@ -198,13 +198,13 @@ def get_site_pin_timing(site_pin_info):
|
|||
|
||||
if 'cap' in site_pin_info:
|
||||
assert 'res' not in site_pin_info
|
||||
return wire, InpinTiming(
|
||||
return wire, InPinTiming(
|
||||
delays=delays,
|
||||
capacitance=float(site_pin_info['cap']) / CAPACITANCE_FACTOR,
|
||||
)
|
||||
else:
|
||||
assert 'res' in site_pin_info
|
||||
return wire, OutpinTiming(
|
||||
return wire, OutPinTiming(
|
||||
delays=delays,
|
||||
drive_resistance=float(site_pin_info['res']) / RESISTANCE_FACTOR,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -30,31 +30,31 @@ a pi-model.
|
|||
|
||||
Example timing tree:
|
||||
|
||||
+------+
|
||||
|Outpin|
|
||||
+--+---+
|
||||
|
|
||||
|
|
||||
v
|
||||
+--+--+
|
||||
|Wire |
|
||||
+--+--+
|
||||
|
|
||||
+-----------------+
|
||||
| |
|
||||
+--+---+ +-------+------+
|
||||
|Buffer| |PassTransistor|
|
||||
+--+---+ +------+-------+
|
||||
| |
|
||||
v v
|
||||
+--+-+ +--+-+
|
||||
|Wire| |Wire|
|
||||
+--+-+ +--+-+
|
||||
| |
|
||||
v v
|
||||
+--+--+ +--+--+
|
||||
|Inpin| |Inpin|
|
||||
+-----+ +-----+
|
||||
+------+
|
||||
|Outpin|
|
||||
+--+---+
|
||||
|
|
||||
|
|
||||
v
|
||||
+--+--+
|
||||
|Wire |
|
||||
+--+--+
|
||||
|
|
||||
+-----------------+
|
||||
| |
|
||||
+--+---+ +-------+------+
|
||||
|Buffer| |PassTransistor|
|
||||
+--+---+ +------+-------+
|
||||
| |
|
||||
v v
|
||||
+--+-+ +--+-+
|
||||
|Wire| |Wire|
|
||||
+--+-+ +--+-+
|
||||
| |
|
||||
v v
|
||||
+--+--+ +--+--+
|
||||
|Inpin| |Inpin|
|
||||
+-----+ +-----+
|
||||
|
||||
Note on units:
|
||||
|
||||
|
|
@ -160,72 +160,6 @@ def fast_slow_tuple_to_corners(arr):
|
|||
}
|
||||
|
||||
|
||||
# Math models are used to represent abstract operations for the timing models.
|
||||
# This is useful for creating excel workbooks that can update dynamically, or
|
||||
# generating a model with symbolic constants to be backsolved.
|
||||
|
||||
|
||||
class ExcelMathModel(object):
|
||||
""" Math model used for outputting to an dyanmic Excel sheet. """
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def sum(self, elems):
|
||||
sum_val = '(' + ' + '.join(elems) + ')'
|
||||
if sum_val == '()':
|
||||
return '0'
|
||||
else:
|
||||
return sum_val
|
||||
|
||||
def product(self, elems):
|
||||
sum_val = '(' + ' * '.join(elems) + ')'
|
||||
if sum_val == '()':
|
||||
return '1'
|
||||
else:
|
||||
return sum_val
|
||||
|
||||
def plus(self, a, b):
|
||||
return self.sum((a, b))
|
||||
|
||||
def divide(self, a, b):
|
||||
return '({}/{})'.format(a, b)
|
||||
|
||||
def multiply(self, a, b):
|
||||
return '({}*{})'.format(a, b)
|
||||
|
||||
def eval(self, elem):
|
||||
return '=' + elem
|
||||
|
||||
|
||||
def PythonMathModel(object):
|
||||
""" Math model used for outputting values equalated immediately. """
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def sum(self, elems):
|
||||
return sum(elems)
|
||||
|
||||
def product(self, elems):
|
||||
v = 1.0
|
||||
for elem in elems:
|
||||
v *= elem
|
||||
return v
|
||||
|
||||
def divide(self, a, b):
|
||||
return a / b
|
||||
|
||||
def plus(self, a, b):
|
||||
return a + b
|
||||
|
||||
def multiply(self, a, b):
|
||||
return a * b
|
||||
|
||||
def eval(self, elem):
|
||||
return elem
|
||||
|
||||
|
||||
class TimingNode(object):
|
||||
""" Base class for timing node models.
|
||||
"""
|
||||
|
|
@ -288,6 +222,7 @@ class DownstreamNode(TimingNode):
|
|||
math : MathModel
|
||||
Math model to use to compute delays
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class Outpin(TimingNode):
|
||||
|
|
|
|||
Loading…
Reference in New Issue