2021-04-02 15:46:39 +08:00
|
|
|
# Load Configurations for LEC of Golden and Revised Design
|
|
|
|
|
2021-03-03 14:35:11 +08:00
|
|
|
import re
|
2021-03-29 21:34:16 +08:00
|
|
|
infile= open("./design/snapshots/default/param.vh",'r')
|
2021-03-03 14:35:11 +08:00
|
|
|
params = []
|
2021-04-02 15:46:39 +08:00
|
|
|
lines = infile.readlines() # Read Param.vh file.
|
2021-03-03 14:35:11 +08:00
|
|
|
for line in lines:
|
|
|
|
patern_1=re.match(r'(.*):(.*)' , line )
|
|
|
|
if ((patern_1)):
|
2021-04-02 15:46:39 +08:00
|
|
|
# Group string to the left side of colon
|
|
|
|
patern_group1=patern_1.group(1)
|
|
|
|
split_bef_col = patern_group1.split()
|
|
|
|
bef_col=''
|
|
|
|
print("split_bef_col = ",split_bef_col)
|
|
|
|
for parametr in split_bef_col:
|
|
|
|
bef_col=bef_col+" "+parametr
|
|
|
|
# Group string to the right side of colon
|
|
|
|
patern_group2=patern_1.group(2)
|
|
|
|
split_after_col = patern_group2.split()
|
|
|
|
after_col=''
|
|
|
|
for strng in split_after_col:
|
|
|
|
after_col=after_col+strng
|
|
|
|
|
2021-03-03 14:35:11 +08:00
|
|
|
else:
|
|
|
|
continue
|
2021-04-02 15:46:39 +08:00
|
|
|
# concatenate the string obtained before and after colon
|
|
|
|
params.append(bef_col+" = " + after_col)
|
2021-03-03 14:35:11 +08:00
|
|
|
|
2021-04-02 15:46:39 +08:00
|
|
|
# Writing configurations to file
|
2021-03-03 14:35:11 +08:00
|
|
|
filename2 = "./verif/LEC/LEC_RTL/Golden_RTL/parameter.sv"
|
|
|
|
outfile = open(filename2, 'w+')
|
|
|
|
outfile.write("#(parameter"+"\n")
|
|
|
|
outfile.write("\t"+" AWIDTH = 7,"+"\n")
|
|
|
|
outfile.write("\t"+" TAG = 1'h1,"+"\n")
|
2021-04-02 15:46:39 +08:00
|
|
|
for parameters in params:
|
|
|
|
if ("DCCM_INDEX_BITS") in parameters:
|
|
|
|
commented=" //" + parameters
|
|
|
|
outfile.write("\t"+str(commented)+"\n")
|
2021-03-03 14:35:11 +08:00
|
|
|
else:
|
2021-04-02 15:46:39 +08:00
|
|
|
outfile.write("\t"+str(parameters)+"\n")
|
2021-03-03 14:35:11 +08:00
|
|
|
outfile.write(")"+"\n")
|
|
|
|
outfile.close() #Close file
|
2021-04-02 15:46:39 +08:00
|
|
|
print("\nConfiguration file for LEC is updated successfully.\n")
|