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