Skip to content

Commit

Permalink
Split soft reset and dfx decouple control. Part of #111
Browse files Browse the repository at this point in the history
  • Loading branch information
mariodruiz committed Sep 12, 2022
1 parent af26a07 commit a578e69
Showing 1 changed file with 38 additions and 14 deletions.
52 changes: 38 additions & 14 deletions pynq_composable/composable.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,17 @@ def __init__(self, description):
_get_ip_name_by_vlnv(description, 'xilinx.com:ip:axis_switch:1.1')
self._switch = getattr(self._ol, self._hier + switch_name)
self._max_slots = self._switch.max_slots
self._control = True
self._enable_soft_reset = True
self._enable_dfx_decouple = True
self._pipelinecrt = \
_get_ip_name_by_vlnv(description, 'xilinx.com:ip:axi_gpio:2.0')
if self._pipelinecrt:
pipecrtl = getattr(self._ol, self._hier + self._pipelinecrt)
self._soft_reset = pipecrtl.channel1
self._dfx_control = pipecrtl.channel2
else:
self._control = False
self._enable_soft_reset = False
self._enable_dfx_decouple = False
self._soft_reset = None
self._dfx_control = None

Expand Down Expand Up @@ -293,23 +295,43 @@ def current_pipeline(self) -> list:
return self._current_pipeline

@property
def control(self):
""" Set the operation mode of the pipeline control logic
def soft_reset_mode(self):
""" Set the operation mode of the soft reset logic
Parameters
----------
enable : bool
True: Soft reset and DFX decouple commands are issued
False: No soft reset neither DFX decouple commands are issued
True: Soft reset command is issued
False: No soft reset is issued
"""
return self._control
return self._enable_soft_reset

@control.setter
def control(self, enable: bool):
@soft_reset_mode.setter
def soft_reset_mode(self, enable: bool):
if self._pipelinecrt:
self._control = enable
self._enable_soft_reset = enable
elif enable:
warnings.warn("Can't enable pipeline control logic as there is no "
warnings.warn("Can't enable soft reset logic as there is no "
"associated hardware", UserWarning)

@property
def dfx_decouple_mode(self):
""" Set the operation mode of the dfx decouple logic
Parameters
----------
enable : bool
True: DFX decouple commands are issued
False: No DFX decouple commands are issued
"""
return self._enable_dfx_decouple

@dfx_decouple_mode.setter
def dfx_decouple_mode(self, enable: bool):
if self._pipelinecrt:
self._enable_dfx_decouple = enable
elif enable:
warnings.warn("Can't enable DFX decouple logic as there is no "
"associated hardware", UserWarning)

def _default_paths(self):
Expand Down Expand Up @@ -565,7 +587,7 @@ def compose(self, cle_list: list) -> None:
" instance can only be used once"
.format(ip._fullpath))

if self._soft_reset and self._control:
if self._soft_reset and self._enable_soft_reset:
self._soft_reset[0].write(1)
self._soft_reset[0].write(0)

Expand Down Expand Up @@ -630,7 +652,8 @@ def load(self, dfx_list: list) -> None:
for pr in bit_dict:
if not bit_dict[pr]['loaded']:
decoupler = self._dfx_control[self._dfx_dict[pr]['decouple']]
if self._dfx_control and decoupler and self._control:
if self._dfx_control and decoupler and \
self._enable_dfx_decouple:
decoupler.write(1)
for i in range(5):
try:
Expand All @@ -643,7 +666,8 @@ def load(self, dfx_list: list) -> None:
"downloaded"
.format(bit_dict[pr]['bitstream']))

if self._dfx_control and decoupler and self._control:
if self._dfx_control and decoupler and \
self._enable_dfx_decouple:
decoupler.write(0)

def remove(self, iplist: list = None) -> None:
Expand Down

0 comments on commit a578e69

Please sign in to comment.