Skip to content

Commit

Permalink
refactored filtering algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
simon1hofmann committed Nov 23, 2023
1 parent e3b97e8 commit 603d4c7
Showing 1 changed file with 40 additions and 35 deletions.
75 changes: 40 additions & 35 deletions src/mnt/bench/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,53 +155,58 @@ def filter_database(self, benchmark_config: BenchmarkConfiguration) -> pd.DataFr
db_tmp = db_tmp.loc[db_tmp["level"] == "gate"]
db_filtered = pd.concat([db_filtered, db_tmp])

if benchmark_config.one and not benchmark_config.bestagon:
db_filtered = db_tmp.loc[db_tmp["library"] == "one"]
if benchmark_config.best:
db_tmp = db_tmp.loc[db_tmp["clocking_scheme"] == "best"]
db_filtered = pd.concat([db_filtered, db_tmp])

if not benchmark_config.one and benchmark_config.bestagon:
db_filtered = db_tmp.loc[db_tmp["library"] == "bestagon"]
else:
if benchmark_config.one and not benchmark_config.bestagon:
db_filtered = db_tmp.loc[db_tmp["library"] == "one"]

db_tmp_all_schemes = pd.DataFrame(columns=colnames)
if benchmark_config.twoddwave:
db_tmp = db_filtered.loc[db_filtered["clocking_scheme"] == "2ddwave"]
db_tmp_all_schemes = pd.concat([db_tmp_all_schemes, db_tmp])
if not benchmark_config.one and benchmark_config.bestagon:
db_filtered = db_tmp.loc[db_tmp["library"] == "bestagon"]

if benchmark_config.use:
db_tmp = db_filtered.loc[db_filtered["clocking_scheme"] == "use"]
db_tmp_all_schemes = pd.concat([db_tmp_all_schemes, db_tmp])
db_tmp_all_schemes = pd.DataFrame(columns=colnames)
if benchmark_config.twoddwave:
db_tmp = db_filtered.loc[db_filtered["clocking_scheme"] == "2ddwave"]
db_tmp_all_schemes = pd.concat([db_tmp_all_schemes, db_tmp])

if benchmark_config.res:
db_tmp = db_filtered.loc[db_filtered["clocking_scheme"] == "res"]
db_tmp_all_schemes = pd.concat([db_tmp_all_schemes, db_tmp])
if benchmark_config.use:
db_tmp = db_filtered.loc[db_filtered["clocking_scheme"] == "use"]
db_tmp_all_schemes = pd.concat([db_tmp_all_schemes, db_tmp])

if benchmark_config.esr:
db_tmp = db_filtered.loc[db_filtered["clocking_scheme"] == "esr"]
db_tmp_all_schemes = pd.concat([db_tmp_all_schemes, db_tmp])
if benchmark_config.res:
db_tmp = db_filtered.loc[db_filtered["clocking_scheme"] == "res"]
db_tmp_all_schemes = pd.concat([db_tmp_all_schemes, db_tmp])

if benchmark_config.row:
db_tmp = db_filtered.loc[db_filtered["clocking_scheme"] == "row"]
db_tmp_all_schemes = pd.concat([db_tmp_all_schemes, db_tmp])
if benchmark_config.esr:
db_tmp = db_filtered.loc[db_filtered["clocking_scheme"] == "esr"]
db_tmp_all_schemes = pd.concat([db_tmp_all_schemes, db_tmp])

if not db_tmp_all_schemes.empty:
db_filtered = db_tmp_all_schemes
if benchmark_config.row:
db_tmp = db_filtered.loc[db_filtered["clocking_scheme"] == "row"]
db_tmp_all_schemes = pd.concat([db_tmp_all_schemes, db_tmp])

if benchmark_config.exact:
db_filtered = db_filtered.loc[db_filtered["physical_design_algorithm"] == "exact"]
if not db_tmp_all_schemes.empty:
db_filtered = db_tmp_all_schemes

if benchmark_config.nanoplacer:
db_filtered = db_filtered.loc[db_filtered["physical_design_algorithm"] == "nanoplacer"]
if benchmark_config.exact:
db_filtered = db_filtered.loc[db_filtered["physical_design_algorithm"] == "exact"]

if benchmark_config.optimized:
db_filtered = db_filtered.loc[db_filtered["optimized"] == "opt"]
if benchmark_config.nanoplacer:
db_filtered = db_filtered.loc[db_filtered["physical_design_algorithm"] == "nanoplacer"]

if benchmark_config.ortho:
db_filtered = db_filtered.loc[db_filtered["physical_design_algorithm"] == "ortho"]
if benchmark_config.optimized:
db_filtered = db_filtered.loc[db_filtered["optimized"] == "opt"]

if benchmark_config.optimized:
db_filtered = db_filtered.loc[db_filtered["optimized"] == "opt"]
if benchmark_config.ortho:
db_filtered = db_filtered.loc[db_filtered["physical_design_algorithm"] == "ortho"]

if benchmark_config.ordered:
db_filtered = db_filtered.loc[db_filtered["ordered"] == "ord"]
if benchmark_config.optimized:
db_filtered = db_filtered.loc[db_filtered["optimized"] == "opt"]

if benchmark_config.ordered:
db_filtered = db_filtered.loc[db_filtered["ordered"] == "ord"]

if benchmark_config.network:
db_filtered = pd.concat([db_filtered, db_networks])
Expand Down Expand Up @@ -277,7 +282,7 @@ def prettify_table(table: pd.DataFrame) -> pd.DataFrame:
level_mapping = {"gate": "Gate-level", "network": "Network"}
table.replace({"level": level_mapping}, inplace=True)

library_mapping = {"one": "ONE", "bestagon": "Bestagon"}
library_mapping = {"one": "QCA ONE", "bestagon": "Bestagon"}
table.replace({"library": library_mapping}, inplace=True)

clocking_scheme_mapping = {"2ddwave": "2DDWave", "use": "USE", "res": "RES", "esr": "ESR", "row": "ROW"}
Expand Down

0 comments on commit 603d4c7

Please sign in to comment.