tb: Move BIT to util

This function may be useful for other testbenches.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
This commit is contained in:
Sean Anderson 2023-02-18 21:38:33 -05:00
parent a179ccb9ab
commit afbb64023e
2 changed files with 4 additions and 2 deletions

View File

@ -6,8 +6,7 @@ from cocotb.clock import Clock
from cocotb.triggers import FallingEdge, Timer
from cocotb.types import LogicArray
def BIT(n):
return 1 << n
from .util import BIT
BMCR = 0
BMSR = 1

View File

@ -16,6 +16,9 @@ async def async_iter(it):
for i in it:
yield i
def BIT(n):
return 1 << n
# From https://stackoverflow.com/a/7864317/5086505
class classproperty(property):
def __get__(self, cls, owner):