当前位置: 首页>>代码示例>>Python>>正文


Python triggers.Event类代码示例

本文整理汇总了Python中cocotb.triggers.Event的典型用法代码示例。如果您正苦于以下问题:Python Event类的具体用法?Python Event怎么用?Python Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Event类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_locker

class test_locker(object):
    def __init__(self):
        self.in_event = None
        self.out_event = Event()
        self.result = None

    def set_in(self):
        self.in_event.set()

    def set_out(self):
        self.out_event.set()
开发者ID:enchanter,项目名称:cocotb,代码行数:11,代码来源:decorators.py

示例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
开发者ID:kirknodeng,项目名称:cocotb,代码行数:7,代码来源:test_drv.py

示例3: __init__

    def __init__(self):

        self.log = SimLog("cocotb.scheduler")
        if _debug:
            self.log.setLevel(logging.DEBUG)

        # Use OrderedDict here for deterministic behavior (gh-934)

        # A dictionary of pending coroutines for each trigger,
        # indexed by trigger
        self._trigger2coros = collections.OrderedDict()

        # A dictionary mapping coroutines to the trigger they are waiting for
        self._coro2trigger = collections.OrderedDict()

        # Our main state
        self._mode = Scheduler._MODE_NORMAL

        # A dictionary of pending writes
        self._writes = collections.OrderedDict()

        self._pending_coros = []
        self._pending_triggers = []
        self._pending_threads = []
        self._pending_events = []   # Events we need to call set on once we've unwound

        self._terminate = False
        self._test_result = None
        self._entrypoint = None
        self._main_thread = threading.current_thread()

        self._is_reacting = False

        self._write_coro_inst = None
        self._writes_pending = Event()
开发者ID:cmarqu,项目名称:cocotb,代码行数:35,代码来源:scheduler.py

示例4: __init__

    def __init__(self, helperSlave, listOperation):
        self.sda = helperSlave.io.sda_rd
        self.scl = helperSlave.io.scl_rd
        self.clk = helperSlave.io.clk

        self.event_RisingEdge  = Event()
        self.event_FallingEdge  = Event()

        self.event_Start = Event()
        self.event_Stop  = Event()

        self.listOp = list()
        self.refListOp = listOperation
        self.dataBinRead = list()

        self.startSeq = 0
开发者ID:svancau,项目名称:SpinalHDL,代码行数:16,代码来源:I2CHAL.py

示例5: __init__

    def __init__(self, callback=None, event=None):
        """
        Constructor for a monitor instance

        callback will be called with each recovered transaction as the argument

        If the callback isn't used, received transactions will be placed on a
        queue and the event used to notify any consumers.
        """
        self._event = event
        self._wait_event = None
        self._recvQ = []
        self._callbacks = []
        self.stats = MonitorStatistics()
        self._wait_event = Event()

        # Subclasses may already set up logging
        if not hasattr(self, "log"):
            self.log = SimLog("cocotb.monitor.%s" % (self.__class__.__name__))

        if callback is not None:
            self.add_callback(callback)

        # Create an independent coroutine which can receive stuff
        self._thread = cocotb.scheduler.add(self._monitor_recv())
开发者ID:cpehle,项目名称:cocotb,代码行数:25,代码来源:__init__.py

示例6: __init__

    def __init__(self, helperMaster ): # initMemory = dict()):

        self.startEvent  = Event()
        self.stopEvent   = Event()
        self.dataRxEvent = Event()
        self.dataTXEvent = Event()

        self.sda_rd      = helperMaster.io.sda_wr
        self.sda_wr      = helperMaster.io.sda_rd
        self.scl_rd      = helperMaster.io.scl_wr
        self.scl_wr      = helperMaster.io.scl_rd

        self.resetn      = helperMaster.io.resetn
        self.clk         = helperMaster.io.clk

        self.sda         = 1
        self.scl         = 1
开发者ID:svancau,项目名称:SpinalHDL,代码行数:17,代码来源:I2CSlaveModelHAL.py

示例7: __init__

 def __init__(self, entity, name, clock, timeout=5000):
     Wishbone.__init__(self, entity, name, clock)
     sTo = ", no cycle timeout"        
     if not (timeout is None):
         sTo = ", cycle timeout is %u clockcycles" % timeout
     self.log.info("Wishbone Master created%s" % sTo)
     self.busy_event = Event("%s_busy" % name)
     self.busy = False
     self._timeout = timeout
开发者ID:mkreider,项目名称:cocotb2,代码行数:9,代码来源:wishbone.py

示例8: read

 def read(self, address, tag=0):
     """ 32 bit read """
     tlp = np.zeros(4, dtype='uint32')
     tlp[0] = 0x00000001
     tlp[1] = 0xbaaa00ff | tag << 8
     tlp[2] = address
     self.read_wait = Event("rw")
     self.txqueue.put(tlp)
     yield self.read_wait.wait()
     raise ReturnValue(self.read_data)
开发者ID:HarmonInstruments,项目名称:hififo,代码行数:10,代码来源:test.py

示例9: __init__

    def __init__(self):
        """Constructor for a driver instance."""
        self._pending = Event(name="Driver._pending")
        self._sendQ = deque()

        # Subclasses may already set up logging
        if not hasattr(self, "log"):
            self.log = SimLog("cocotb.driver.%s" % (self.__class__.__name__))

        # Create an independent coroutine which can send stuff
        self._thread = cocotb.scheduler.add(self._send_thread())
开发者ID:TC01,项目名称:cocotb,代码行数:11,代码来源:__init__.py

示例10: __init__

 def __init__(self, dut, rx_channels=1, tx_channels=1,
              tx_clock_half_period=16276, rx_clock_half_period=16276,
              loopback_queue_maxlen=16):
     self.dut = dut
     self.tx_clock_half_period = tx_clock_half_period
     self.rx_clock_half_period = rx_clock_half_period
     self.rx_frame_asserted = False
     self.tx_frame_asserted = False
     self.lbqi = deque()
     self.lbqq = deque()
     cocotb.fork(self._rx_clock())
     self.got_tx = Event("Got tx event")
开发者ID:TC01,项目名称:cocotb,代码行数:12,代码来源:ad9361.py

示例11: __init__

    def __init__(self, helperSlave, clockDivider):

        self.wr_scl   = helperSlave.io.scl_rd
        self.wr_sda   = helperSlave.io.sda_rd
        self.rd_scl   = helperSlave.io.scl_wr
        self.rd_sda   = helperSlave.io.sda_wr
        self.clk      = helperSlave.io.clk

        self.sda       = 1
        self.scl       = 1

        self.clockDivider = clockDivider

        self.scl_en       = 0

        self.trigger     = Event()
        self.sclRising   = Event()
        self.sclFalling  = Event()

        self.dataRead    = Event()

        self.freezeBus   = False
开发者ID:svancau,项目名称:SpinalHDL,代码行数:22,代码来源:I2CMasterModelHAL.py

示例12: __init__

    def __init__(self, entity, name, clock, **kwargs):
        AvalonMM.__init__(self, entity, name, clock, **kwargs)
        self.log.debug("AvalonMaster created")
        self.busy_event = Event("%s_busy" % name)
        self.busy = False

        config = kwargs.pop('config', {})
        self.config = AvalonMaster._default_config.copy()

        for configoption, value in config.items():
            self.config[configoption] = value
            self.log.debug("Setting config option %s to %s" %
                           (configoption, str(value)))
开发者ID:zpan007,项目名称:cocotb,代码行数:13,代码来源:avalon.py

示例13: test_drv

class test_drv(BusDriver):
    _signals = ["A", "B", "X"]
    _optional_signals= []

    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

    @cocotb.coroutine
    def _acquire_lock(self):
        if self.busy:
            yield self.busy_event.wait()
        self.busy_event.clear()
        self.busy = True

    def _release_lock(self):
        self.busy = False
        self.busy_event.set()


    @cocotb.coroutine
    def write(self, value_a, value_b, sync=True):
        """
        """
        yield self._acquire_lock()

        if sync:
            yield RisingEdge(self.clock)
        self.bus.A <= value_a
        self.bus.B <= value_b

        self._release_lock()
开发者ID:kirknodeng,项目名称:cocotb,代码行数:36,代码来源:test_drv.py

示例14: __init__

    def __init__(self, callback=None, event=None):
        self._event = event
        self._wait_event = None
        self._recvQ = deque()
        self._callbacks = []
        self.stats = MonitorStatistics()
        self._wait_event = Event()

        # Subclasses may already set up logging
        if not hasattr(self, "log"):
            self.log = SimLog("cocotb.monitor.%s" % (self.__class__.__name__))

        if callback is not None:
            self.add_callback(callback)

        # Create an independent coroutine which can receive stuff
        self._thread = cocotb.scheduler.add(self._monitor_recv())
开发者ID:zpan007,项目名称:cocotb,代码行数:17,代码来源:__init__.py

示例15: __init__

 def __init__(self, entity, name, clock, **kwargs):
     AvalonMM.__init__(self, entity, name, clock, **kwargs)
     self.log.debug("AvalonMaster created")
     self.busy_event = Event("%s_busy" % name)
     self.busy = False
开发者ID:TC01,项目名称:cocotb,代码行数:5,代码来源:avalon.py


注:本文中的cocotb.triggers.Event类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。