示例#1
0
    def testArgIsNormalFunction(self):

        def h():
            yield None

        with raises_kind(AlwaysCombError, _error.ArgType):
            always_comb(h)
示例#2
0
    def testArgHasNoArgs(self):

        def h(n):
            return n

        with raises_kind(AlwaysCombError, _error.NrOfArgs):
            always_comb(h)
示例#3
0
    def testInfer6(self):
        a, b, c, d = [Signal(0) for i in range(4)]

        def h():
            c.next = a
            x.next = c
        with raises_kind(AlwaysCombError, _error.SignalAsInout % set('c')):
            g = always_comb(h).gen
示例#4
0
    def testInfer6(self):
        a, b, c, d = [Signal(0) for i in range(4)]

        def h():
            c.next = a
            x.next = c

        with raises_kind(AlwaysCombError, _error.SignalAsInout % set('c')):
            g = always_comb(h).gen
示例#5
0
def issue_104_multiple_instance():
    sim1 = Simulation(test())
    sim1.run(1000)
    # sim1 is "puased"

    # try and create a second, third, forth simulation instance
    for ii in range(4):
        with raises_kind(SimulationError, _error.MultipleSim):
              another_sim = Simulation(test())
    # generating more sims should have failed
    sim1.run(1000)
    sim1.quit()
示例#6
0
def issue_104_multiple_instance():
    sim1 = Simulation(test())
    sim1.run(1000)
    # sim1 is "puased"

    # try and create a second, third, forth simulation instance
    for ii in range(4):
        with raises_kind(SimulationError, _error.MultipleSim):
              another_sim = Simulation(test())
    # generating more sims should have failed
    sim1.run(1000)
    sim1.quit()
示例#7
0
    def testEmbeddedFunction(self):
        a, b, c, d = [Signal(0) for i in range(4)]
        u = 1

        def h():
            def g():
                e = b
                return e
            c.next = x
            g = a
        with raises_kind(AlwaysCombError, _error.EmbeddedFunction):
            g = always_comb(h)
示例#8
0
    def testEmbeddedFunction(self):
        a, b, c, d = [Signal(0) for i in range(4)]
        u = 1

        def h():
            def g():
                e = b
                return e

            c.next = x
            g = a

        with raises_kind(AlwaysCombError, _error.EmbeddedFunction):
            g = always_comb(h)
示例#9
0
def test_clock():
    """ check the edge parameter """

    # should fail without a valid Signal
    clock = Signal(bool(0))
    reset = ResetSignal(0, active=0, async=True)

    with raises_kind(AlwaysSeqError, _error.EdgeType):
        @always_seq(clock, reset=reset)
        def logic1():
            pass

    # should work with a valid Signal
    clock = Signal(bool(0))
    try:
        @always_seq(clock.posedge, reset=reset)
        def logic2():
            pass
    except:
        assert False
示例#10
0
def test_clock():
    """ check the edge parameter """

    # should fail without a valid Signal
    clock = Signal(bool(0))
    reset = ResetSignal(0, active=0, async=True)

    with raises_kind(AlwaysSeqError, _error.EdgeType):

        @always_seq(clock, reset=reset)
        def logic1():
            pass

    # should work with a valid Signal
    clock = Signal(bool(0))
    try:

        @always_seq(clock.posedge, reset=reset)
        def logic2():
            pass
    except:
        assert False
示例#11
0
 def testArgIsFunction(self):
     h = 5
     with raises_kind(AlwaysError, _error.ArgType):
         always(delay(3))(h)
示例#12
0
    def testArgHasNoArgs(self):
        with raises_kind(AlwaysError, _error.NrOfArgs):

            @always(delay(3))
            def h(n):
                return n
示例#13
0
def check(*args):
    with raises_kind(ConversionError, _error.NotSupported):
        toVerilog(*args)
示例#14
0
 def testArgIsGeneratorFunction(self):
     with raises_kind(InstanceError, _error.ArgType):
         @instance
         def h():
             return None
示例#15
0
 def testArgType1(self, vcd_dir):
     with raises_kind(TraceSignalsError, _error.ArgType):
         dut = traceSignals([1, 2])
示例#16
0
 def testArgIsFunction(self):
     h = 5
     with raises_kind(AlwaysError, _error.ArgType):
         always(delay(3))(h)
示例#17
0
 def testNotUnique(self):
     cosim1 = Cosimulation(exe + "cosimNotUnique", **allSigs)
     with raises_kind(CosimulationError, _error.MultipleCosim):
         Cosimulation(exe + "cosimNotUnique", **allSigs)
示例#18
0
 def testArgIsGeneratorFunction(self):
     with raises_kind(InstanceError, _error.ArgType):
         @instance
         def h():
             return None
示例#19
0
 def testToSignalsDupl(self):
     with raises_kind(CosimulationError, _error.DuplicateSigNames):
         Cosimulation(exe + "cosimToSignalsDupl", **allSigs)
示例#20
0
 def testWrongExe(self):
     with raises_kind(CosimulationError, _error.OSError):
         Cosimulation("bla -x 45")
示例#21
0
 def testNoComm(self):
     with raises_kind(CosimulationError, _error.NoCommunication):
         Cosimulation(exe + "cosimNoComm", **allSigs)
示例#22
0
 def testTimeZero(self):
     with raises_kind(CosimulationError, _error.TimeZero):
         Cosimulation(exe + "cosimTimeZero", **allSigs)
示例#23
0
 def testArgHasNoArgs(self):
     with raises_kind(InstanceError, _error.NrOfArgs):
         @instance
         def h(n):
             yield n
示例#24
0
 def testMultipleTraces(self, vcd_dir):
     with raises_kind(TraceSignalsError, _error.MultipleTraces):
         dut = top3()
 def testTimeZero(self):
     with raises_kind(CosimulationError, _error.TimeZero):
         Cosimulation(exe + "cosimTimeZero", **allSigs)
示例#26
0
 def testReturnVal(self, vcd_dir):
     from myhdl import ExtractHierarchyError
     from myhdl._extractHierarchy import _error
     kind = _error.InconsistentToplevel % (2, "dummy")
     with raises_kind(ExtractHierarchyError, kind):
         dut = traceSignals(dummy)
 def testNoComm(self):
     with raises_kind(CosimulationError, _error.NoCommunication):
         Cosimulation(exe + "cosimNoComm", **allSigs)
示例#28
0
 def testArgHasNoArgs(self):
     def h(n):
         return n
     with raises_kind(AlwaysCombError, _error.NrOfArgs):
         always_comb(h)
 def testToSignalsDupl(self):
     with raises_kind(CosimulationError, _error.DuplicateSigNames):
         Cosimulation(exe + "cosimToSignalsDupl", **allSigs)
示例#30
0
 def testArgIsFunction(self):
     h = 5
     with raises_kind(AlwaysCombError, _error.ArgType):
         always_comb(h)
 def testWrongExe(self):
     with raises_kind(CosimulationError, _error.OSError):
         Cosimulation('bla -x 45')
示例#32
0
 def testReturnVal(self, vcd_dir):
     from myhdl import ExtractHierarchyError
     from myhdl._extractHierarchy import _error
     kind = _error.InconsistentToplevel % (2, "dummy")
     with raises_kind(ExtractHierarchyError, kind):
         dut = traceSignals(dummy)
 def testNotUnique(self):
     cosim1 = Cosimulation(exe + "cosimNotUnique", **allSigs)
     with raises_kind(CosimulationError, _error.MultipleCosim):
         Cosimulation(exe + "cosimNotUnique", **allSigs)
示例#34
0
 def testArgIsFunction(self):
     h = 5
     with raises_kind(InstanceError, _error.ArgType):
         instance(h)
示例#35
0
    def testArgHasNoArgs(self):
        with raises_kind(AlwaysError, _error.NrOfArgs):

            @always(delay(3))
            def h(n):
                return n
示例#36
0
 def testArgHasNoArgs(self):
     with raises_kind(InstanceError, _error.NrOfArgs):
         @instance
         def h(n):
             yield n
示例#37
0
    def testArgIsNormalFunction(self):
        with raises_kind(AlwaysError, _error.ArgType):

            @always(delay(3))
            def h():
                yield None
示例#38
0
    def testArgIsNormalFunction(self):
        with raises_kind(AlwaysError, _error.ArgType):

            @always(delay(3))
            def h():
                yield None
示例#39
0
 def test2(self):
     def g():
         yield delay(10)
     i = g()
     with raises_kind(SimulationError, _error.DuplicatedArg):
         Simulation(i, i)
示例#40
0
    def testDecArgType2(self):
        with raises_kind(AlwaysError, _error.DecArgType):

            @always(g)
            def h(n):
                return n
示例#41
0
 def testMultipleTraces(self, vcd_dir):
     with raises_kind(TraceSignalsError, _error.MultipleTraces):
         dut = top3()
示例#42
0
 def testArgType1(self, vcd_dir):
     with raises_kind(TraceSignalsError, _error.ArgType):
         dut = traceSignals([1, 2])
示例#43
0
 def testArgIsNormalFunction(self):
     def h():
         yield None
     with raises_kind(AlwaysCombError, _error.ArgType):
         always_comb(h)
示例#44
0
 def test1(self):
     with raises_kind(SimulationError, _error.ArgType):
         Simulation(None)
示例#45
0
 def testArgIsFunction(self):
     h = 5
     with raises_kind(InstanceError, _error.ArgType):
         instance(h)
示例#46
0
 def testArgIsFunction(self):
     h = 5
     with raises_kind(AlwaysCombError, _error.ArgType):
         always_comb(h)
示例#47
0
    def testDecArgType2(self):
        with raises_kind(AlwaysError, _error.DecArgType):

            @always(g)
            def h(n):
                return n