scripts/utils/utils.py
def add_computed_statistics(filename):
    """
    Adds some calculated values to a report CSV file, namely:

    * Cells per mm sq over core utilization
    * Suggested clock period
    * Suggested clock frequency
    """
    rows = []

    csv_headers = open(filename).read().split("\n")[0].split(",")

    def add(name: str, before: str):
        nonlocal csv_headers
        idx = csv_headers.index(before)
        csv_headers.insert(idx, name)

    add("(Cell/mm^2)/Core_Util", "DIEAREA_mm^2")
    add("suggested_clock_period", "CLOCK_PERIOD")
    add("suggested_clock_frequency", "CLOCK_PERIOD")

    csv_file_in = open(filename)
    reader = csv.DictReader(csv_file_in)
    for row in reader:
        row["(Cell/mm^2)/Core_Util"] = float(row["CellPer_mm^2"]) / (
            float(row["FP_CORE_UTIL"]) / 100
        )

        suggest_clock_period = float(row["CLOCK_PERIOD"]) - float(row["spef_wns"])
        row["suggested_clock_period"] = suggest_clock_period
        row["suggested_clock_frequency"] = 1000 / suggest_clock_period
        rows.append(row)
    csv_file_in.close()

    with open(filename, "w") as f:
        writer = csv.DictWriter(f, csv_headers)
        writer.writeheader()
        for row in rows:
            writer.writerow(row)

    Adds some calculated values to a report CSV file, namely:

    * Cells per mm sq over core utilization
    * Suggested clock period
    * Suggested clock frequency
    
Adds some calculated values to a report CSV file, namely:
Cells per mm sq over core utilization
Suggested clock period
Suggested clock frequency
Adds some calculated values to a report CSV file namely : Cells per mm sq over core utilization Suggested clock period Suggested clock frequency
def add_computed_statistics(filename):
    rows = []
    csv_headers = open(filename).read().split("\n")[0].split(",")
    def add(name: str, before: str):
        nonlocal csv_headers
        idx = csv_headers.index(before)
        csv_headers.insert(idx, name)
    add("(Cell/mm^2)/Core_Util", "DIEAREA_mm^2")
    add("suggested_clock_period", "CLOCK_PERIOD")
    add("suggested_clock_frequency", "CLOCK_PERIOD")
    csv_file_in = open(filename)
    reader = csv.DictReader(csv_file_in)
    for row in reader:
        row["(Cell/mm^2)/Core_Util"] = float(row["CellPer_mm^2"]) / (
            float(row["FP_CORE_UTIL"]) / 100
        )
        suggest_clock_period = float(row["CLOCK_PERIOD"]) - float(row["spef_wns"])
        row["suggested_clock_period"] = suggest_clock_period
        row["suggested_clock_frequency"] = 1000 / suggest_clock_period
        rows.append(row)
    csv_file_in.close()
    with open(filename, "w") as f:
        writer = csv.DictWriter(f, csv_headers)
        writer.writeheader()
        for row in rows:
            writer.writerow(row)
def add_computed_statistics ( filename ) : rows = [ ] csv_headers = open ( filename ) . read ( ) . split ( "\n" ) [ 0 ] . split ( "," ) def add ( name : str , before : str ) : nonlocal csv_headers idx = csv_headers . index ( before ) csv_headers . insert ( idx , name ) add ( "(Cell/mm^2)/Core_Util" , "DIEAREA_mm^2" ) add ( "suggested_clock_period" , "CLOCK_PERIOD" ) add ( "suggested_clock_frequency" , "CLOCK_PERIOD" ) csv_file_in = open ( filename ) reader = csv . DictReader ( csv_file_in ) for row in reader : row [ "(Cell/mm^2)/Core_Util" ] = float ( row [ "CellPer_mm^2" ] ) / ( float ( row [ "FP_CORE_UTIL" ] ) / 100 ) suggest_clock_period = float ( row [ "CLOCK_PERIOD" ] ) - float ( row [ "spef_wns" ] ) row [ "suggested_clock_period" ] = suggest_clock_period row [ "suggested_clock_frequency" ] = 1000 / suggest_clock_period rows . append ( row ) csv_file_in . close ( ) with open ( filename , "w" ) as f : writer = csv . DictWriter ( f , csv_headers ) writer . writeheader ( ) for row in rows : writer . writerow ( row )
Adds some calculated values to a report CSV file, namely:
 Cells per mm sq over core utilization
 Suggested clock period
 Suggested clock frequency
Adds some calculated values to a report CSV file namely : Cells per mm sq over core utilization Suggested clock period Suggested clock frequency
"""
    Adds some calculated values to a report CSV file, namely:

    * Cells per mm sq over core utilization
    * Suggested clock period
    * Suggested clock frequency
    """
filename