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