OpenRAM/compiler/custom/dff.py

42 lines
1.3 KiB
Python
Raw Normal View History

# See LICENSE for licensing information.
#
2019-06-14 17:43:41 +02:00
# Copyright (c) 2016-2019 Regents of the University of California and The Board
# of Regents for the Oklahoma Agricultural and Mechanical College
# (acting for and on behalf of Oklahoma State University)
# All rights reserved.
#
import design
from tech import cell_properties as props
2020-11-14 00:55:55 +01:00
from tech import spice
class dff(design.design):
"""
Memory address flip-flop
"""
2020-11-03 15:29:17 +01:00
def __init__(self, name="dff"):
super().__init__(name, prop=props.dff)
def analytical_power(self, corner, load):
"""Returns dynamic and leakage power. Results in nW"""
c_eff = self.calculate_effective_capacitance(load)
freq = spice["default_event_frequency"]
power_dyn = self.calc_dynamic_power(corner, c_eff, freq)
power_leak = spice["dff_leakage"]
2020-11-03 15:29:17 +01:00
total_power = self.return_power(power_dyn, power_leak)
return total_power
2020-11-03 15:29:17 +01:00
def calculate_effective_capacitance(self, load):
"""Computes effective capacitance. Results in fF"""
c_load = load
2020-11-14 00:55:55 +01:00
c_para = spice["dff_out_cap"] # ff
transition_prob = 0.5
2020-11-14 00:55:55 +01:00
return transition_prob * (c_load + c_para)
def build_graph(self, graph, inst_name, port_nets):
"""Adds edges based on inputs/outputs. Overrides base class function."""
self.add_graph_edges(graph, port_nets)
2020-11-03 15:29:17 +01:00