From 249d1b9c1d8323571acfd6f67974c75f1a8d0a7e Mon Sep 17 00:00:00 2001 From: Bugra Onal Date: Fri, 24 Feb 2023 16:42:39 -0800 Subject: [PATCH] Moved sram_op and bit_polarity --- compiler/characterizer/bit_polarity.py | 14 ------------ compiler/characterizer/charutils.py | 31 ++++++++++++++++++++++++++ compiler/characterizer/sram_op.py | 15 ------------- 3 files changed, 31 insertions(+), 29 deletions(-) delete mode 100644 compiler/characterizer/bit_polarity.py delete mode 100644 compiler/characterizer/sram_op.py diff --git a/compiler/characterizer/bit_polarity.py b/compiler/characterizer/bit_polarity.py deleted file mode 100644 index 5a6b6a06..00000000 --- a/compiler/characterizer/bit_polarity.py +++ /dev/null @@ -1,14 +0,0 @@ -# See LICENSE for licensing information. -# -# Copyright (c) 2016-2023 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. -# - -from enum import Enum - -class bit_polarity(Enum): - NONINVERTING = 0 - INVERTING = 1 - diff --git a/compiler/characterizer/charutils.py b/compiler/characterizer/charutils.py index 872901b7..1c365fd5 100644 --- a/compiler/characterizer/charutils.py +++ b/compiler/characterizer/charutils.py @@ -7,6 +7,7 @@ # import os import re +from enum import Enum from openram import debug from openram import OPTS @@ -107,3 +108,33 @@ def check_dict_values_is_float(dict): if type(value)!=float: return False return True + + +def bidir_search(func, upper, lower, time_out=9): + """ + Performs bidirectional search over given function with given + upper and lower bounds. + """ + time_count = 0 + while time_count < time_out: + val = (upper + lower) / 2 + if func(val): + return (True, val) + time_count += 1 + return (False, 0) + + +class bit_polarity(Enum): + NONINVERTING = 0 + INVERTING = 1 + + +class sram_op(Enum): + READ_ZERO = 0 + READ_ONE = 1 + WRITE_ZERO = 2 + WRITE_ONE = 3 + DISABLED_READ_ZERO = 4 + DISABLED_READ_ONE = 5 + DISABLED_WRITE_ZERO = 6 + DISABLED_WRITE_ONE = 7 diff --git a/compiler/characterizer/sram_op.py b/compiler/characterizer/sram_op.py deleted file mode 100644 index 3aeca925..00000000 --- a/compiler/characterizer/sram_op.py +++ /dev/null @@ -1,15 +0,0 @@ -# See LICENSE for licensing information. -# -# Copyright (c) 2016-2023 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. -# - -from enum import Enum - -class sram_op(Enum): - READ_ZERO = 0 - READ_ONE = 1 - WRITE_ZERO = 2 - WRITE_ONE = 3