本文整理汇总了Python中cocotb.drivers.BusDriver类的典型用法代码示例。如果您正苦于以下问题:Python BusDriver类的具体用法?Python BusDriver怎么用?Python BusDriver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BusDriver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, entity, name, clock, **kwargs):
BusDriver.__init__(self, entity, name, clock, **kwargs)
self._can_read = False
self._can_write = False
# Drive some sensible defaults (setimmediatevalue to avoid x asserts)
if hasattr(self.bus, "read"):
self.bus.read.setimmediatevalue(0)
self._can_read = True
if hasattr(self.bus, "write"):
self.bus.write.setimmediatevalue(0)
v = self.bus.writedata.value
v.binstr = "x" * len(self.bus.writedata)
self.bus.writedata <= v
self._can_write = True
if hasattr(self.bus, "byteenable"):
self.bus.byteenable.setimmediatevalue(0)
if hasattr(self.bus, "cs"):
self.bus.cs.setimmediatevalue(0)
v = self.bus.address.value
v.binstr = "x" * len(self.bus.address)
self.bus.address.setimmediatevalue(v)
示例2: __init__
def __init__(self, entity, name, clock):
BusDriver.__init__(self, entity, name, clock)
self.bus.A.setimmediatevalue(5)
self.bus.B.setimmediatevalue(5)
self.log.debug("Test DrvM created")
self.busy_event = Event("%s_busy" % name)
self.busy = False
示例3: __init__
def __init__(self, entity, name, clock):
BusDriver.__init__(self, entity, name, clock)
# Drive some sensible defaults (setimmediatevalue to avoid x asserts)
self.bus.read.setimmediatevalue(0)
self.bus.write.setimmediatevalue(0)
self.bus.address.setimmediatevalue(0)
示例4: __init__
def __init__(self, entity, name, clock, debug = False):
BusDriver.__init__(self, entity, name, clock)
if debug:
self.log.setLevel(logging.DEBUG)
self.bus.act <= 0
self.bus.stb <= 0
self.data = Array('B')
示例5: __init__
def __init__(self, entity, name, clock, readlatency_min=1,
readlatency_max=1, memory=None):
BusDriver.__init__(self, entity, name, clock)
self._readable = False
self._writeable = False
if hasattr(self.bus, "readdata"):
self._width = len(self.bus.readdata)
self._readable = True
if hasattr(self.bus, "writedata"):
self._width = len(self.bus.writedata)
self._writeable = True
if not self._readable and not self._writeable:
raise TestError("Attempt to instantiate useless memory")
# Allow dual port RAMs by referencing the same dictionary
if memory is None:
self._mem = {}
else:
self._mem = memory
self._val = BinaryValue(bits=self._width, bigEndian=False)
self._readlatency_min = readlatency_min
self._readlatency_max = readlatency_max
self._responses = []
self._coro = cocotb.fork(self._respond())
if hasattr(self.bus, "readdatavalid"):
self.bus.readdatavalid.setimmediatevalue(0)
if hasattr(self.bus, "waitrequest"):
self.bus.waitrequest.setimmediatevalue(0)
示例6: __init__
def __init__(self, entity, name, clock, readlatency_min=1,
readlatency_max=1, memory=None, avl_properties={}):
BusDriver.__init__(self, entity, name, clock)
if avl_properties != {}:
for key, value in self._avalon_properties.items():
self._avalon_properties[key] = avl_properties.get(key, value)
if self._avalon_properties["burstCountUnits"] != "symbols":
self.log.error("Only symbols burstCountUnits is supported")
if self._avalon_properties["addressUnits"] != "symbols":
self.log.error("Only symbols addressUnits is supported")
self._burstread = False
self._burstwrite = False
self._readable = False
self._writeable = False
self._width = None
if hasattr(self.bus, "readdata"):
self._width = len(self.bus.readdata)
self._readable = True
if hasattr(self.bus, "writedata"):
width = len(self.bus.writedata)
if (self._width is not None) and self._width != width:
self.log.error("readdata and writedata bus" +
" are not the same size")
self._width = width
self._writeable = True
if hasattr(self.bus, "burstcount"):
if hasattr(self.bus, "readdatavalid"):
self._burstread = True
self._burstwrite = True
if not self._readable and not self._writeable:
raise TestError("Attempt to instantiate useless memory")
# Allow dual port RAMs by referencing the same dictionary
if memory is None:
self._mem = {}
else:
self._mem = memory
self._val = BinaryValue(bits=self._width, bigEndian=False)
self._readlatency_min = readlatency_min
self._readlatency_max = readlatency_max
self._responses = []
self._coro = cocotb.fork(self._respond())
if hasattr(self.bus, "readdatavalid"):
self.bus.readdatavalid.setimmediatevalue(0)
if hasattr(self.bus, "waitrequest"):
self.bus.waitrequest.setimmediatevalue(0)
if hasattr(self.bus, "readdatavalid"):
self.bus.readdatavalid.setimmediatevalue(0)
示例7: __init__
def __init__(self,
entity,
name,
clock,
wr_fifo_name = "WR",
wr_fifo_clk = None,
wr_fifo_clk_period = 10,
rd_fifo_name = "RD",
rd_fifo_clk = None,
rd_fifo_clk_period = 10):
BusDriver.__init__(self, entity, name, clock)
if wr_fifo_clk is None:
wr_fifo_clk = entity.WR_CLK
if rd_fifo_clk is None:
rd_fifo_clk = entity.RD_CLK
self.bus.EN.setimmediatevalue(0)
self.bus.ADR.setimmediatevalue(0)
self.bus.ADR_FIXED.setimmediatevalue(0)
self.bus.ADR_WRAP.setimmediatevalue(0)
self.bus.WR_RD.setimmediatevalue(0)
self.bus.COUNT.setimmediatevalue(0)
# Mutex for each channel that we master to prevent contention
self.command_busy = Lock("%s_wabusy" % name)
cocotb.fork(Clock(wr_fifo_clk, wr_fifo_clk_period).start())
cocotb.fork(Clock(rd_fifo_clk, rd_fifo_clk_period).start())
self.write_fifo = PPFIFOWritePath(entity, wr_fifo_name, wr_fifo_clk)
self.read_fifo = PPFIFOReadPath(entity, rd_fifo_name, rd_fifo_clk)
示例8: __init__
def __init__(self, entity, name, clock, buffer_size = BUFFER_SIZE, debug = False):
BusDriver.__init__(self, entity, name, clock)
if debug:
self.log.setLevel(logging.DEBUG)
self.buffer_size = buffer_size
self.bus.data.binstr = 'ZZZZZZZZ'
self.bus.txe_n <= 1
self.bus.rde_n <= 1
self.data = Array('B')
示例9: __init__
def __init__(self, entity, name, clock):
BusDriver.__init__(self, entity, name, clock)
word = BinaryValue(bits=32)
single = BinaryValue(bits=1)
word.binstr = ("x" * 32)
single.binstr = ("x")
self.bus.load_i <= single
self.bus.rst_i <= single
self.bus.dat_i <= word
示例10: __init__
def __init__(self, entity, name, clock):
BusDriver.__init__(self, entity, name, clock)
# Drive some sensible defaults (setimmediatevalue to avoid x asserts)
self.bus.cyc.setimmediatevalue(0)
self.bus.stb.setimmediatevalue(0)
self.bus.we.setimmediatevalue(0)
self.bus.adr.setimmediatevalue(0)
self.bus.datwr.setimmediatevalue(0)
v = self.bus.sel.value
v.binstr = "1" * len(self.bus.sel)
self.bus.sel <= v
示例11: __init__
def __init__(self, entity):
BusDriver.__init__(self, entity, "", entity.FCLK_IN)
# Create an appropriately sized high-impedence value
self._high_impedence = BinaryValue(bits=len(self.bus.BUS_DATA))
self._high_impedence.binstr = "Z" * len(self.bus.BUS_DATA)
# Create an appropriately sized high-impedence value
self._x = BinaryValue(bits=16)
self._x.binstr = "x" * 16
# Kick off a clock generator
cocotb.fork(Clock(self.clock, 20833).start())
示例12: __init__
def __init__(self, entity, name, clock, width=32):
BusDriver.__init__(self, entity, name, clock)
#Drive default values onto bus
self.width = width
self.strobe_width = width / 8
self.bus.TVALID.setimmediatevalue(0)
self.bus.TLAST.setimmediatevalue(0)
self.bus.TDATA.setimmediatevalue(0)
self.bus.TKEEP.setimmediatevalue(0)
self.bus.TID.setimmediatevalue(0)
self.bus.TDEST.setimmediatevalue(0)
self.bus.TUSER.setimmediatevalue(0)
self.write_data_busy = Lock("%s_wbusy" % name)
示例13: __init__
def __init__(self, entity, name, clock, width = 100, height = 100, y_fp = 10, y_bp = 10, x_fp = 10, x_bp = 10):
BusDriver.__init__(self, entity, name, clock)
self.width = width
self.height = height
self.y_fp = y_fp
self.y_bp = y_bp
self.x_fp = x_fp
self.x_bp = x_bp
self.bus.SOF_STB.setimmediatevalue(0)
self.bus.HSYNC.setimmediatevalue(0)
self.bus.RED.setimmediatevalue(0)
self.bus.BLUE.setimmediatevalue(0)
self.bus.GREEN.setimmediatevalue(0)
self.busy = Lock("%s_busy" % name)
示例14: __init__
def __init__(self, entity, name, clock):
BusDriver.__init__(self, entity, name, clock)
# Drive some sensible defaults (setimmediatevalue to avoid x asserts)
self.bus.AWVALID.setimmediatevalue(0)
self.bus.WVALID.setimmediatevalue(0)
self.bus.ARVALID.setimmediatevalue(0)
self.bus.BREADY.setimmediatevalue(1)
self.bus.RREADY.setimmediatevalue(1)
# Mutex for each channel that we master to prevent contention
self.write_address_busy = Lock("%s_wabusy" % name)
self.read_address_busy = Lock("%s_rabusy" % name)
self.write_data_busy = Lock("%s_wbusy" % name)
示例15: __init__
def __init__(self, entity, name, clock, gen):
''' The clock shall be serial '''
BusDriver.__init__(self, entity, name, clock)
# outcoming elecidle flag
self.txelecidle = 1
# queue of *parallel* values to send
self.sq = []
# stream trace of received parallel values
self.rq = []
# sata generation (~ clock frequency)
self.gen = gen
self.driveBit(0)