mirror of
https://github.com/VLSIDA/OpenRAM.git
synced 2026-08-29 17:39:02 +02:00
Added graph functions to compute analytical delay based on graph path.
This commit is contained in:
@@ -18,13 +18,16 @@ class timing_graph():
|
||||
def __init__(self):
|
||||
self.graph = defaultdict(set)
|
||||
self.all_paths = []
|
||||
self.edge_mods = {}
|
||||
|
||||
def add_edge(self, src_node, dest_node):
|
||||
"""Adds edge to graph. Nodes added as well if they do not exist."""
|
||||
def add_edge(self, src_node, dest_node, edge_mod):
|
||||
"""Adds edge to graph. Nodes added as well if they do not exist.
|
||||
Module which defines the edge must be provided for timing information."""
|
||||
|
||||
src_node = src_node.lower()
|
||||
dest_node = dest_node.lower()
|
||||
self.graph[src_node].add(dest_node)
|
||||
self.edge_mods[(src_node, dest_node)] = edge_mod
|
||||
|
||||
def add_node(self, node):
|
||||
"""Add node to graph with no edges"""
|
||||
@@ -34,8 +37,8 @@ class timing_graph():
|
||||
self.graph[node] = set()
|
||||
|
||||
def remove_edges(self, node):
|
||||
|
||||
"""Helper function to remove edges, useful for removing vdd/gnd"""
|
||||
|
||||
node = node.lower()
|
||||
self.graph[node] = set()
|
||||
|
||||
@@ -93,7 +96,32 @@ class timing_graph():
|
||||
|
||||
# Remove current vertex from path[] and mark it as unvisited
|
||||
path.pop()
|
||||
visited.remove(cur_node)
|
||||
visited.remove(cur_node)
|
||||
|
||||
def get_timing(self, path, corner, slew, load):
|
||||
"""Returns the analytical delays in the input path"""
|
||||
|
||||
if len(path) == 0:
|
||||
return []
|
||||
|
||||
delays = []
|
||||
for i in range(len(path)-1):
|
||||
|
||||
path_edge_mod = self.edge_mods[(path[i], path[i+1])]
|
||||
|
||||
# On the output of the current stage, get COUT from all other mods connected
|
||||
cout = 0
|
||||
for node in self.graph[path[i+1]]:
|
||||
output_edge_mode = self.edge_mods[(path[i+1], node)]
|
||||
cout+=output_edge_mode.input_load()
|
||||
# If at the last output, include the final output load
|
||||
if i == len(path)-2:
|
||||
cout+=load
|
||||
|
||||
delays.append(path_edge_mod.analytical_delay(corner, slew, cout))
|
||||
slew = delays[-1].slew
|
||||
|
||||
return delays
|
||||
|
||||
def __str__(self):
|
||||
""" override print function output """
|
||||
|
||||
@@ -219,7 +219,7 @@ class hierarchy_design(hierarchy_spice.spice, hierarchy_layout.layout):
|
||||
for inp in input_pins+inout_pins:
|
||||
for out in output_pins+inout_pins:
|
||||
if inp != out: #do not add self loops
|
||||
graph.add_edge(pin_dict[inp], pin_dict[out])
|
||||
graph.add_edge(pin_dict[inp], pin_dict[out], self)
|
||||
|
||||
def __str__(self):
|
||||
""" override print function output """
|
||||
|
||||
@@ -13,7 +13,7 @@ import tech
|
||||
from delay_data import *
|
||||
from wire_spice_model import *
|
||||
from power_data import *
|
||||
|
||||
import logical_effort
|
||||
|
||||
class spice():
|
||||
"""
|
||||
@@ -304,14 +304,28 @@ class spice():
|
||||
|
||||
def analytical_delay(self, corner, slew, load=0.0):
|
||||
"""Inform users undefined delay module while building new modules"""
|
||||
debug.warning("Design Class {0} delay function needs to be defined"
|
||||
relative_cap = logical_effort.convert_farad_to_relative_c(load)
|
||||
stage_effort = self.get_stage_effort(relative_cap)
|
||||
|
||||
# If it fails, then keep running with a valid object.
|
||||
if stage_effort == None:
|
||||
return delay_data(0.0, 0.0)
|
||||
|
||||
abs_delay = stage_effort.get_absolute_delay()
|
||||
corner_delay = self.apply_corners_analytically(abs_delay, corner)
|
||||
SLEW_APPROXIMATION = 0.1
|
||||
corner_slew = SLEW_APPROXIMATION*corner_delay
|
||||
return delay_data(corner_delay, corner_slew)
|
||||
|
||||
def get_stage_effort(self, corner, slew, load=0.0):
|
||||
"""Inform users undefined delay module while building new modules"""
|
||||
debug.warning("Design Class {0} logical effort function needs to be defined"
|
||||
.format(self.__class__.__name__))
|
||||
debug.warning("Class {0} name {1}"
|
||||
.format(self.__class__.__name__,
|
||||
self.name))
|
||||
# return 0 to keep code running while building
|
||||
return delay_data(0.0, 0.0)
|
||||
|
||||
return None
|
||||
|
||||
def cal_delay_with_rc(self, corner, r, c ,slew, swing = 0.5):
|
||||
"""
|
||||
Calculate the delay of a mosfet by
|
||||
|
||||
Reference in New Issue
Block a user