From 10b217ddc318bdfd78f4ef2786587a735f560a5b Mon Sep 17 00:00:00 2001 From: IIITM-Jay Date: Tue, 23 Jul 2024 00:29:41 +0530 Subject: [PATCH] Refactor and Optimiation:: Argument Table Formation:: Constants.py --- constants.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/constants.py b/constants.py index cb3e689d..24a7901f 100644 --- a/constants.py +++ b/constants.py @@ -53,13 +53,10 @@ csv_reader = csv.reader(f, skipinitialspace=True) for row in csv_reader: csrs32.append((int(row[0], 0), row[1])) -arg_lut = {} -with open("arg_lut.csv") as f: - csv_reader = csv.reader(f, skipinitialspace=True) - for row in csv_reader: - k = row[0] - v = (int(row[1]), int(row[2])) - arg_lut[k] = v + +# Load the argument lookup table (arg_lut) from a CSV file, mapping argument names to their bit positions +arg_lut = {row[0]: (int(row[1]), int(row[2])) for row in csv.reader(open("arg_lut.csv"), skipinitialspace=True)} + # for mop arg_lut['mop_r_t_30'] = (30,30)