當前位置: 首頁>>代碼示例>>Python>>正文


Python Signal.next方法代碼示例

本文整理匯總了Python中myhdl.Signal.next方法的典型用法代碼示例。如果您正苦於以下問題:Python Signal.next方法的具體用法?Python Signal.next怎麽用?Python Signal.next使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在myhdl.Signal的用法示例。


在下文中一共展示了Signal.next方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: bench

# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import next [as 別名]
    def bench(self):
        clk = Signal(0)
        sig1 = Signal(0)
        sig2 = Signal(0)
        td = 10

        def gen(s, n):
            for i in range(n-1):
                yield delay(td)
            s.next = 1
            yield delay(td)

        for i in range(10):
            offset = now()
            n0 = randrange(1, 50)
            n1 = randrange(1, 50)
            n2 = randrange(1, 50)
            sig1.next = 0
            sig2.next = 0
            yield join(delay(n0*td), gen(sig1, n1), gen(sig2, n2))
            assert sig1.val == 1
            assert sig2.val == 1
            assert now() == offset + td * max(n0, n1, n2)

        raise StopSimulation("Joined concurrent generator yield")
開發者ID:Aravind-Suresh,項目名稱:myhdl,代碼行數:27,代碼來源:test_Simulation.py

示例2: testSignalBoolBounds

# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import next [as 別名]
 def testSignalBoolBounds(self):
     if type(bool) is not type:  # bool not a type in 2.2
         return
     s = Signal(bool())
     s.next = 1
     s.next = 0
     for v in (-1, -8, 2, 5):
         with pytest.raises(ValueError):
             s.next = v
開發者ID:Aravind-Suresh,項目名稱:myhdl,代碼行數:11,代碼來源:test_Signal.py

示例3: inst

# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import next [as 別名]
    def inst():
        yield delay(200 * nsec)

        addr = Signal(intbv(0x10)[len(bus.A):])

        while 1:
            yield system.CLK.posedge

            bus.CS_B.next = 0
            bus.RAS_B.next = 0
            bus.A.next = 0x4
            bus.BA.next = 0x2

            yield system.CLK.posedge

            bus.CS_B.next = 1
            bus.RAS_B.next = 1
            bus.A.next = ~0 & mask(bus.A)
            bus.BA.next = ~0 & mask(bus.BA)

            yield system.CLK.posedge

            bus.CS_B.next = 0
            bus.CAS_B.next = 0
            bus.A.next = addr
            bus.BA.next = 0

            yield system.CLK.posedge

            bus.CS_B.next = 1
            bus.CAS_B.next = 1
            bus.A.next = ~0 & mask(bus.A)
            bus.BA.next = ~0 & mask(bus.BA)

            addr.next = 0
            if addr != n - 1:
                addr.next = addr + 4

            yield system.CLK.posedge

            bus.CS_B.next = 0
            bus.CAS_B.next = 0
            bus.A.next = addr

            yield system.CLK.posedge

            bus.CS_B.next = 1
            bus.CAS_B.next = 1
            bus.A.next = ~0 & mask(bus.A)

            addr.next = 0
            if addr != n - 1:
                addr.next = addr + 4

            yield delay(interval - 1)
開發者ID:trigrass2,項目名稱:sds7102,代碼行數:57,代碼來源:test_ddr.py

示例4: testUpdateNoEvent

# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import next [as 別名]
 def testUpdateNoEvent(self):
     """ update without value change should not return event waiters """
     s1 = Signal(1)
     s1.next = 4
     s1._update()
     s1.next = 4
     s1._eventWaiters = self.eventWaiters[:]
     s1._posedgeWaiters = self.posedgeWaiters[:]
     s1._negedgeWaiters = self.negedgeWaiters[:]
     waiters = s1._update()
     self.assertEqual(waiters, [])
     self.assertEqual(s1._eventWaiters, self.eventWaiters)
     self.assertEqual(s1._posedgeWaiters, self.posedgeWaiters)
     self.assertEqual(s1._negedgeWaiters, self.negedgeWaiters)
開發者ID:Cadavis8,項目名稱:myhdl,代碼行數:16,代碼來源:test_Signal.py

示例5: testSignalBoolBounds

# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import next [as 別名]
 def testSignalBoolBounds(self):
     if type(bool) is not type: # bool not a type in 2.2
         return
     s = Signal(bool())
     s.next = 1
     s.next = 0
     for v in (-1, -8, 2, 5):
         try:
             s.next = v
             #s._update()
             #s.val
         except ValueError:
             pass
         else:
             self.fail()
開發者ID:Cadavis8,項目名稱:myhdl,代碼行數:17,代碼來源:test_Signal.py

示例6: testUpdateEvent

# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import next [as 別名]
 def testUpdateEvent(self):
     """ update on non-edge event should return event waiters """
     s1 = Signal(1)
     s1.next = 4
     s1._update()
     s1.next = 5
     s1._eventWaiters = self.eventWaiters[:]
     s1._posedgeWaiters = self.posedgeWaiters[:]
     s1._negedgeWaiters = self.negedgeWaiters[:]
     waiters = s1._update()
     expected = self.eventWaiters
     self.assertEqual(set(waiters), set(expected))
     self.assertEqual(s1._eventWaiters, [])
     self.assertEqual(s1._posedgeWaiters, self.posedgeWaiters)
     self.assertEqual(s1._negedgeWaiters, self.negedgeWaiters)
開發者ID:Cadavis8,項目名稱:myhdl,代碼行數:17,代碼來源:test_Signal.py

示例7: testUpdateNegedge

# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import next [as 別名]
 def testUpdateNegedge(self):
     """ update on negedge should return event and negedge waiters """
     s1 = Signal(1)
     s1.next = 1
     s1._update()
     s1.next = 0
     s1._eventWaiters = self.eventWaiters[:]
     s1._posedgeWaiters = self.posedgeWaiters[:]
     s1._negedgeWaiters = self.negedgeWaiters[:]
     waiters = s1._update()
     expected = self.eventWaiters + self.negedgeWaiters
     self.assertEqual(set(waiters), set(expected))
     self.assertEqual(s1._eventWaiters, [])
     self.assertEqual(s1._posedgeWaiters, self.posedgeWaiters)
     self.assertEqual(s1._negedgeWaiters, [])
開發者ID:Cadavis8,項目名稱:myhdl,代碼行數:17,代碼來源:test_Signal.py

示例8: testUpdatePosedge

# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import next [as 別名]
 def testUpdatePosedge(self):
     """ update on posedge should return event and posedge waiters """
     s1 = Signal(1)
     s1.next = 0
     s1._update()
     s1.next = 1
     s1._eventWaiters = self.eventWaiters[:]
     s1._posedgeWaiters = self.posedgeWaiters[:]
     s1._negedgeWaiters = self.negedgeWaiters[:]
     waiters = s1._update()
     expected = self.eventWaiters + self.posedgeWaiters
     assert set(waiters) == set(expected)
     assert s1._eventWaiters == []
     assert s1._posedgeWaiters == []
     assert s1._negedgeWaiters == self.negedgeWaiters
開發者ID:Aravind-Suresh,項目名稱:myhdl,代碼行數:17,代碼來源:test_Signal.py

示例9: stimulus

# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import next [as 別名]
 def stimulus():
     a = Signal(0)
     yield delay(10)
     a.next = 1
     assert a.val == 0
     assert now() == 10
     yield None
     a.next = 0
     assert a.val == 0
     assert now() == 10
     yield None
     a.next = 1
     assert a.val == 0
     assert now() == 10
     yield delay(0)
     assert a.val == 1
     assert now() == 10
開發者ID:Aravind-Suresh,項目名稱:myhdl,代碼行數:19,代碼來源:test_Simulation.py

示例10: stimulus

# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import next [as 別名]
 def stimulus():
     a = Signal(0)
     yield delay(10)
     a.next = 1
     self.assertEqual(a.val, 0)
     self.assertEqual(now(), 10)
     yield None
     a.next = 0
     self.assertEqual(a.val, 0)
     self.assertEqual(now(), 10)
     yield None
     a.next = 1
     self.assertEqual(a.val, 0)
     self.assertEqual(now(), 10)
     yield delay(0)
     self.assertEqual(a.val, 1)
     self.assertEqual(now(), 10)
開發者ID:Alisa-lisa,項目名稱:uni-stuff,代碼行數:19,代碼來源:test_Simulation.py

示例11: stimulus

# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import next [as 別名]
        def stimulus():
            N = Signal(intbv(0)[32:])

            yield bus.reset()
            # Send a clear
            yield whitebox_clear(bus)

            # Check the fifo flags
            yield bus.receive(WE_STATUS_ADDR)
            assert bus.rdata & WES_SPACE
            assert not (bus.rdata & WES_DATA)

            yield bus.transmit(WE_THRESHOLD_ADDR,
                concat(intbv(1)[16:], intbv(3)[16:]))
            yield bus.receive(WE_THRESHOLD_ADDR)
            assert bus.rdata == concat(intbv(1)[16:], intbv(3)[16:])

            yield bus.transmit(WE_INTERP_ADDR, INTERP)
            yield bus.receive(WE_INTERP_ADDR)
            assert bus.rdata == INTERP

            ## Insert samples until overrun
            yield bus.receive(WE_RUNS_ADDR)
            while not (bus.rdata & 0x0000ffff):
                x = intbv(int(sin(1000 * (2 * pi) * N / 50000) * 2**15), min=-2**15, max=2**15)[16:]
                yield bus.transmit(WE_SAMPLE_ADDR, concat(x, x))
                N.next = N + 1
                yield bus.receive(WE_RUNS_ADDR)

            # Check that we're full
            yield bus.receive(WE_STATUS_ADDR)
            assert not (bus.rdata & WES_SPACE)
            assert bus.rdata & WES_DATA

            ## Now start transmitting
            yield bus.transmit(WE_STATUS_ADDR, WES_TXEN)
            yield bus.receive(WE_STATUS_ADDR)
            assert bus.rdata & WES_TXEN

            ## Wait until underrun
            yield bus.receive(WE_RUNS_ADDR)
            while not (bus.rdata & 0xffff0000):
                yield bus.delay(1000)
                yield bus.receive(WE_RUNS_ADDR)

            ## Make sure we're both over and underrun
            assert bus.rdata & 0xffff0000 and bus.rdata & 0x0000ffff

            # Check the fifo flags
            yield bus.receive(WE_STATUS_ADDR)
            assert bus.rdata & WES_SPACE
            assert not (bus.rdata & WES_DATA)

            raise StopSimulation
開發者ID:n8ohu,項目名稱:whitebox,代碼行數:56,代碼來源:test_whitebox.py

示例12: test

# 需要導入模塊: from myhdl import Signal [as 別名]
# 或者: from myhdl.Signal import next [as 別名]
 def test(B, G):
     w = len(B)
     G_Z = Signal(intbv(0)[w:])
     B.next = intbv(0)
     yield delay(10)
     for i in range(1, 2**w):
         G_Z.next = G
         B.next = intbv(i)
         yield delay(10)
         diffcode = bin(G ^ G_Z)
         self.assertEqual(diffcode.count('1'), 1)
開發者ID:StudentESE,項目名稱:myhdl,代碼行數:13,代碼來源:test_gray_properties.py


注:本文中的myhdl.Signal.next方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。