Skip to content

Commit

Permalink
Merge pull request f4pga#1483 from antmicro/fix_xpath
Browse files Browse the repository at this point in the history
Allow import scripts to parse huge .net files
  • Loading branch information
litghost committed Jun 23, 2020
2 parents 9d0b8f2 + d0acc9a commit 0a2ff13
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 5 additions & 3 deletions utils/vpr_io_place.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ def load_block_names_from_net_file(self, net_file):
net_root = net_xml.getroot()
self.net_to_block = {}

for block in net_root.xpath(
"//block[@instance='inpad[0]'] | //block[@instance='outpad[0]']"
):
for block in net_root.xpath("//block"):
instance = block.attrib["instance"]
if instance != "inpad[0]" and instance != "outpad[0]":
continue

top_block = block.getparent()
assert top_block is not None
while top_block.getparent() is not net_root:
Expand Down
6 changes: 5 additions & 1 deletion utils/vpr_place_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ def load_loc_sites_from_net_file(self, net_file):
self.block_to_root_block[el.attrib['name']
] = root_block.attrib['name']

for attr in net_root.xpath("//attribute[@name='LOC']"):
for attr in net_root.xpath("//attribute"):
name = attr.attrib["name"]
if name != 'LOC':
continue

# Get block name
top_block = attr.getparent()
assert top_block is not None
Expand Down

0 comments on commit 0a2ff13

Please sign in to comment.