Skip to content

Commit

Permalink
Moved from setimmediatevalue to normal assign on but init
Browse files Browse the repository at this point in the history
Signed-off-by: Anderson Ignacio <anderson@aignacio.com>
  • Loading branch information
aignacio committed Nov 15, 2023
1 parent dad8683 commit d394b13
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
27 changes: 18 additions & 9 deletions cocotbext/ahb/ahb_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# License : MIT license <Check LICENSE>
# Author : Anderson I. da Silva (aignacio) <anderson@aignacio.com>
# Date : 08.10.2023
# Last Modified Date: 14.11.2023
# Last Modified Date: 15.11.2023

import cocotb
import logging
Expand Down Expand Up @@ -52,7 +52,10 @@ def _init_bus(self) -> None:
sig = getattr(self.bus, signal)
try:
default_value = self._get_def(len(sig))
sig.setimmediatevalue(default_value)
sig.value = default_value
# setimmediatevalue seems to not work with some designs
# decided to move to normal assign
# sig.setimmediatevalue(default_value)
except AttributeError:
pass

Expand Down Expand Up @@ -141,7 +144,7 @@ async def _send_txn(
mode: Sequence[AHBWrite],
trans: Sequence[AHBTrans],
pip: bool = False,
sync: bool = True
sync: bool = False,
) -> Sequence[dict]:
"""Drives the AHB transaction into the bus."""
response = []
Expand Down Expand Up @@ -249,7 +252,7 @@ async def write(
value: Union[int, Sequence[int]],
size: Optional[Union[int, Sequence[int]]] = None,
pip: Optional[bool] = False,
sync: Optional[bool] = True
sync: Optional[bool] = False,
) -> Sequence[dict]:
"""Write data in the AHB bus."""

Expand Down Expand Up @@ -301,14 +304,16 @@ async def write(
width = len(self.bus.htrans)
t_trans = self._create_vector(t_trans, width, "address_ph", pip)

return await self._send_txn(t_address, t_value, t_size, t_mode, t_trans, pip, sync)
return await self._send_txn(
t_address, t_value, t_size, t_mode, t_trans, pip, sync
)

async def read(
self,
address: Union[int, Sequence[int]],
size: Optional[Union[int, Sequence[int]]] = None,
pip: Optional[bool] = False,
sync: Optional[bool] = True
sync: Optional[bool] = False,
) -> Sequence[dict]:
"""Read data from the AHB bus."""

Expand Down Expand Up @@ -351,7 +356,9 @@ async def read(
width = len(self.bus.htrans)
t_trans = self._create_vector(t_trans, width, "address_ph", pip)

return await self._send_txn(t_address, t_value, t_size, t_mode, t_trans, pip, sync)
return await self._send_txn(
t_address, t_value, t_size, t_mode, t_trans, pip, sync
)

async def custom(
self,
Expand All @@ -360,7 +367,7 @@ async def custom(
mode: Union[int, Sequence[int]],
size: Optional[Union[int, Sequence[int]]] = None,
pip: Optional[bool] = True,
sync: Optional[bool] = True
sync: Optional[bool] = False,
) -> Sequence[dict]:
"""Back-to-Back operation"""

Expand Down Expand Up @@ -410,7 +417,9 @@ async def custom(
width = len(self.bus.htrans)
t_trans = self._create_vector(t_trans, width, "address_ph", pip)

return await self._send_txn(t_address, t_value, t_size, t_mode, t_trans, pip, sync)
return await self._send_txn(
t_address, t_value, t_size, t_mode, t_trans, pip, sync
)


class AHBMaster(AHBLiteMaster):
Expand Down
2 changes: 1 addition & 1 deletion cocotbext/ahb/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.2"
__version__ = "0.2.3"

0 comments on commit d394b13

Please sign in to comment.