Skip to content

Commit

Permalink
Removed BinaryValue for cocotb compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Anderson Ignacio da Silva <anderson@aignacio.com>
  • Loading branch information
aignacio committed Oct 1, 2024
1 parent f86966b commit 49ff4de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 2 additions & 3 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: 03.09.2024
# Last Modified Date: 01.10.2024

import logging
import cocotb
Expand All @@ -18,7 +18,6 @@
from cocotb.triggers import RisingEdge
from typing import Optional, Sequence, Union, List
from cocotb.types import LogicArray
from cocotb.binary import BinaryValue


class AHBLiteMaster:
Expand Down Expand Up @@ -68,7 +67,7 @@ def _reset_bus(self) -> None:
except AttributeError:
pass

def _get_def(self, width: int = 1) -> BinaryValue:
def _get_def(self, width: int = 1) -> LogicArray:
"""Return a handle obj with the default value"""
return LogicArray([self.def_val for _ in range(width)])

Expand Down
3 changes: 1 addition & 2 deletions cocotbext/ahb/ahb_monitor.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 : 27.10.2023
# Last Modified Date: 09.09.2024
# Last Modified Date: 01.10.2024
import cocotb
import logging
import random
Expand All @@ -19,7 +19,6 @@
from cocotb.triggers import RisingEdge, FallingEdge
from cocotb.handle import SimHandleBase
from cocotb.types import LogicArray
from cocotb.binary import BinaryValue
from cocotb_bus.monitors import Monitor
from typing import Optional, Union, Generator, List, Any
from .memory import Memory
Expand Down
7 changes: 3 additions & 4 deletions cocotbext/ahb/ahb_slave.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 : 16.10.2023
# Last Modified Date: 09.09.2024
# Last Modified Date: 01.10.2024

import cocotb
import logging
Expand All @@ -18,7 +18,6 @@

from cocotb.triggers import RisingEdge
from cocotb.types import LogicArray
from cocotb.binary import BinaryValue
from typing import Optional, Union, Generator, List
from .memory import Memory

Expand Down Expand Up @@ -58,7 +57,7 @@ def _init_bus(self) -> None:
self.bus.hresp.setimmediatevalue(AHBResp.OKAY)
self.bus.hrdata.setimmediatevalue(0)

def _get_def(self, width: int = 1) -> BinaryValue:
def _get_def(self, width: int = 1) -> LogicArray:
"""Return a handle obj with the default value"""
return LogicArray([self.def_val for _ in range(width)])

Expand Down Expand Up @@ -273,7 +272,7 @@ def _rd(self, addr: int, size: AHBSize) -> int:
data = int.from_bytes(data, byteorder="little")
return data

def _wr(self, addr: int, size: AHBSize, value: BinaryValue) -> int:
def _wr(self, addr: int, size: AHBSize, value: LogicArray) -> int:
if size == AHBSize.BYTE:
# Mask the data to a single byte
data = value.integer & 0xFF
Expand Down

0 comments on commit 49ff4de

Please sign in to comment.