Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate_tech_xml_files.sh #2426

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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)
Loading