Skip to content

Commit

Permalink
Merge pull request #268 from IIITM-Jay/argument-table-optimization
Browse files Browse the repository at this point in the history
Refactor and Optimization:: Argument Table Formation:: Constants.py
  • Loading branch information
aswaterman authored Oct 7, 2024
2 parents 0033120 + 84fd0ad commit 9653f6a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

imported_regex = re.compile('^\s*\$import\s*(?P<extension>.*)\s*::\s*(?P<instruction>.*)', re.M)


def read_csv(filename):
"""
Reads a CSV file and returns a list of tuples.
Expand All @@ -57,13 +58,8 @@ def read_csv(filename):
csrs = read_csv("csrs.csv")
csrs32 = read_csv("csrs32.csv")

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)
Expand Down

0 comments on commit 9653f6a

Please sign in to comment.