Skip to content

Commit 70f571e

Browse files
committed
generate_tech_xml_files.sh
1 parent 15c5340 commit 70f571e

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

vtr_flow/scripts/generate_tech_xml_files.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@
33
./generate_cmos_tech_data.pl ../tech/PTM_22nm/22nm.pm 22e-9 0.8 85 > ../tech/PTM_22nm/22nm.xml &
44
./generate_cmos_tech_data.pl ../tech/PTM_45nm/45nm.pm 45e-9 0.9 85 > ../tech/PTM_45nm/45nm.xml &
55
./generate_cmos_tech_data.pl ../tech/PTM_130nm/130nm.pm 130e-9 1.3 85 > ../tech/PTM_130nm/130nm.xml &
6+
7+
# If you encounter a situation where the units in the generated numerical content
8+
# have not been converted to exponential levels, you may try using the following code snippet.
9+
10+
# python3 ./transform_the_content.py
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import re
2+
def convert_suffix(match):
3+
num = match.group(1)
4+
suffix = match.group(2)
5+
suffix_map = {
6+
'a': 'E-18',
7+
'f': 'E-15',
8+
'u': 'E-6',
9+
'n': 'E-9',
10+
'p': 'E-12',
11+
'm': 'E-3',
12+
'e': 'E'
13+
}
14+
return num + suffix_map.get(suffix.lower(), '')
15+
16+
# if you want to modify .xml files under other processes, you may need to modify the path below.
17+
xml_file = "~/vtr-verilog-to-routing/vtr_flow/tech/PTM_22nm/22nm.xml"
18+
19+
# read .xml file
20+
with open(xml_file, 'r') as file:
21+
lines = file.readlines()
22+
23+
# Replace the units with the corresponding exponential level.
24+
for i in range(1,len(lines)):
25+
lines[i] = re.sub(r'(\d+(?:\.\d*)?)([a-zA-Z])(?![a-zA-Z])', convert_suffix, lines[i])
26+
27+
28+
# write the content to the .xml file
29+
with open(xml_file, 'w') as file:
30+
file.writelines(lines)

0 commit comments

Comments
 (0)