diff --git a/compiler/characterizer/lib.py b/compiler/characterizer/lib.py index 948f8e47..ad1f5e1c 100644 --- a/compiler/characterizer/lib.py +++ b/compiler/characterizer/lib.py @@ -11,9 +11,7 @@ import math import datetime from .setup_hold import * from .delay import * -from .elmore import * from .charutils import * -from .linear_regression import * import tech import numpy as np from globals import OPTS @@ -585,16 +583,24 @@ class lib: def compute_delay(self): """Compute SRAM delays for current corner""" if self.use_model: + model_name_lc = OPTS.model_name.lower() + if model_name_lc == "linear_regression": + from .linear_regression import linear_regression as model + elif model_name_lc == "elmore": + from .elmore import elmore as model + else: + debug.error("{} model not recognized. See options.py for available models.".format(OPTS.model_name)) import math #FIXME: ML models only designed for delay. Cannot produce all values for Lib - d = linear_regression() - temp_wpr = 2.0 #OPTS not working right now + m = model() + #temp_wpr = 2.0 #OPTS not working right now log_num_words = math.log(OPTS.num_words, 2) + debug.info(1, "OPTS.words_per_row={}".format(OPTS.words_per_row)) model_inputs = [log_num_words, OPTS.word_size, - temp_wpr, + OPTS.words_per_row, self.sram.width * self.sram.height] - char_results = d.get_prediction(model_inputs) + char_results = m.get_prediction(model_inputs) #self.d = elmore(self.sram, self.sp_file, self.corner) # char_results = self.d.analytical_delay(self.slews,self.loads) diff --git a/compiler/options.py b/compiler/options.py index e4a61052..f6915035 100644 --- a/compiler/options.py +++ b/compiler/options.py @@ -103,7 +103,9 @@ class options(optparse.Values): use_pex = False # Output config with all options output_extended_config = True - + # Determines which analytical model to use. + # Available Models: elmore, linear_regression + model_name = "linear_regression" ################### # Tool options @@ -152,8 +154,6 @@ class options(optparse.Values): bitcell = "bitcell" buf_dec = "pbuf" column_mux_array = "column_mux_array" - col_cap = "col_cap" - col_cap_array = "col_cap_array" control_logic = "control_logic" decoder = "hierarchical_decoder" delay_chain = "delay_chain" @@ -162,12 +162,10 @@ class options(optparse.Values): inv_dec = "pinv" nand2_dec = "pnand2" nand3_dec = "pnand3" - nand4_dec = "pnand4" + nand4_dec = "pnand4" # Not available right now precharge_array = "precharge_array" ptx = "ptx" replica_bitline = "replica_bitline" - row_cap = "row_cap" - row_cap_array = "row_cap_array" sense_amp_array = "sense_amp_array" sense_amp = "sense_amp" tri_gate_array = "tri_gate_array"