Skip to content

Commit

Permalink
Support dfx status pin via a cdc IP. RapidWright integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Ruiz committed Feb 7, 2022
1 parent 9480c5a commit e198f7d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions pynq_composable/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ def _get_dfxdecoupler_decouple_gpio_pin(signame: str,
search_term = "MODULES/*PORTS/*/[@SIGNAME=\'" + signame + "\']....."
node = tree.findall(search_term)
for m in node:
if 'xilinx.com:ip:xlslice' in m.get('VLNV'):

if 'xilinx.com:ip:xlslice' in (vlnv := m.get('VLNV')):
din_from = int(m.find("./PARAMETERS/*[@NAME='DIN_FROM']")
.get('VALUE'))
din_to = int(m.find("./PARAMETERS/*[@NAME='DIN_FROM']")
Expand All @@ -88,21 +87,26 @@ def _get_dfxdecoupler_decouple_gpio_pin(signame: str,
raise ValueError("{} cannot be more than 1-bit wide"
.format(signame))
return din_to
elif 'xilinx.com:ip:xpm_cdc_gen' in m.get('VLNV') and m != module:
elif 'xilinx.com:ip:xpm_cdc_gen' in vlnv and m != module:
return _get_dfxdecoupler_decouple_gpio_pin(
m.find("./PORTS/*[@NAME='src_in']").get('SIGNAME'), tree, m)
return None


def _get_dfxdecoupler_status_gpio_pin(signame: str,
tree: ElementTree) -> Union[int, None]:
tree: ElementTree,
module: ElementTree.Element=None) -> Union[int, None]:
"""Find the gpio pins that gets the DFX status pin"""

search_term = "MODULES/*PORTS/*/[@SIGNAME=\'" + signame + "\']"
search_term = "MODULES/*PORTS/*/[@SIGNAME=\'" + signame + "\']....."
node = tree.findall(search_term)
for m in node:
if m.get('DIR') == 'I':
return int(re.findall(r'\d+', m.get('NAME'))[0])
if 'xilinx.com:ip:xlconcat' in (vlnv := m.get('VLNV')):
return int(re.findall(r'\d+',
m.find(f"./PORTS/*[@SIGNAME='{signame}']").get('NAME'))[0])
elif 'xilinx.com:ip:xpm_cdc_gen' in vlnv and m != module:
return _get_dfxdecoupler_status_gpio_pin(
m.find("./PORTS/*[@NAME='dest_out']").get('SIGNAME'), tree, m)
return None


Expand Down

0 comments on commit e198f7d

Please sign in to comment.