Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions vtr_flow/scripts/generate_tech_xml_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@
./generate_cmos_tech_data.pl ../tech/PTM_22nm/22nm.pm 22e-9 0.8 85 > ../tech/PTM_22nm/22nm.xml &
./generate_cmos_tech_data.pl ../tech/PTM_45nm/45nm.pm 45e-9 0.9 85 > ../tech/PTM_45nm/45nm.xml &
./generate_cmos_tech_data.pl ../tech/PTM_130nm/130nm.pm 130e-9 1.3 85 > ../tech/PTM_130nm/130nm.xml &

# If you encounter a situation where the units in the generated numerical content
# have not been converted to exponential levels, you may try using the following code snippet.

# python3 ./transform_the_content.py
30 changes: 30 additions & 0 deletions vtr_flow/scripts/transform_the_content.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import re
def convert_suffix(match):
num = match.group(1)
suffix = match.group(2)
suffix_map = {
'a': 'E-18',
'f': 'E-15',
'u': 'E-6',
'n': 'E-9',
'p': 'E-12',
'm': 'E-3',
'e': 'E'
}
return num + suffix_map.get(suffix.lower(), '')

# if you want to modify .xml files under other processes, you may need to modify the path below.
xml_file = "~/vtr-verilog-to-routing/vtr_flow/tech/PTM_22nm/22nm.xml"

# read .xml file
with open(xml_file, 'r') as file:
lines = file.readlines()

# Replace the units with the corresponding exponential level.
for i in range(1,len(lines)):
lines[i] = re.sub(r'(\d+(?:\.\d*)?)([a-zA-Z])(?![a-zA-Z])', convert_suffix, lines[i])


# write the content to the .xml file
with open(xml_file, 'w') as file:
file.writelines(lines)