Example #1
0
    def test2(self):
        def g():
            yield delay(10)

        i = g()
        with raises_kind(SimulationError, _error.DuplicatedArg):
            Simulation(i, i)
Example #2
0
    def testInfer5(self):
        a, b, c, d = [Signal(0) for i in range(4)]

        def h():
            c.next += 1
            a += 1
        with raises_kind(AlwaysCombError, _error.SignalAsInout % "c"):
            g = always_comb(h).gen
Example #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
Example #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
Example #5
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)
Example #6
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)
Example #7
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
Example #8
0
 def testDecArgType2(self):
     with raises_kind(AlwaysError, _error.DecArgType):
         @always(g)
         def h(n):
             return n
Example #9
0
 def testArgIsGeneratorFunction(self):
     with raises_kind(InstanceError, _error.ArgType):
         @instance
         def h():
             return None
Example #10
0
 def testWrongExe(self):
     with raises_kind(CosimulationError, _error.OSError):
         Cosimulation('bla -x 45')
Example #11
0
 def testNoComm(self):
     with raises_kind(CosimulationError, _error.NoCommunication):
         Cosimulation(exe + "cosimNoComm", **allSigs)
Example #12
0
 def testTimeZero(self):
     with raises_kind(CosimulationError, _error.TimeZero):
         Cosimulation(exe + "cosimTimeZero", **allSigs)
Example #13
0
 def testArgHasNoArgs(self):
     with raises_kind(InstanceError, _error.NrOfArgs):
         @instance
         def h(n):
             yield n
Example #14
0
    def testArgIsGeneratorFunction(self):
        with raises_kind(InstanceError, _error.ArgType):

            @instance
            def h():
                return None
Example #15
0
 def testArgIsFunction(self):
     h = 5
     with raises_kind(AlwaysCombError, _error.ArgType):
         always_comb(h)
Example #16
0
 def testArgType1(self, vcd_dir):
     with raises_kind(TraceSignalsError, _error.ArgType):
         dut = traceSignals([1, 2])
Example #17
0
 def testNotUnique(self):
     cosim1 = Cosimulation(exe + "cosimNotUnique", **allSigs)
     with raises_kind(CosimulationError, _error.MultipleCosim):
         Cosimulation(exe + "cosimNotUnique", **allSigs)
Example #18
0
 def testWrongExe(self):
     with raises_kind(CosimulationError, _error.OSError):
         Cosimulation('bla -x 45')
Example #19
0
 def testToSignalsDupl(self):
     with raises_kind(CosimulationError, _error.DuplicateSigNames):
         Cosimulation(exe + "cosimToSignalsDupl", **allSigs)
Example #20
0
 def testNoComm(self):
     with raises_kind(CosimulationError, _error.NoCommunication):
         Cosimulation(exe + "cosimNoComm", **allSigs)
Example #21
0
    def testArgHasNoArgs(self):
        def h(n):
            return n

        with raises_kind(AlwaysCombError, _error.NrOfArgs):
            always_comb(h)
Example #22
0
 def testArgIsFunction(self):
     h = 5
     with raises_kind(InstanceError, _error.ArgType):
         instance(h)
Example #23
0
 def test2(self):
     def g():
         yield delay(10)
     i = g()
     with raises_kind(SimulationError, _error.DuplicatedArg):
         Simulation(i, i)
Example #24
0
    def testArgHasNoArgs(self):
        with raises_kind(InstanceError, _error.NrOfArgs):

            @instance
            def h(n):
                yield n
Example #25
0
 def testMultipleTraces(self, vcd_dir):
     with raises_kind(TraceSignalsError, _error.MultipleTraces):
         dut = top3()
Example #26
0
 def testArgIsFunction(self):
     h = 5
     with raises_kind(AlwaysCombError, _error.ArgType):
         always_comb(h)
Example #27
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)
Example #28
0
    def testArgIsNormalFunction(self):
        def h():
            yield None

        with raises_kind(AlwaysCombError, _error.ArgType):
            always_comb(h)
Example #29
0
 def testArgIsNormalFunction(self):
     def h():
         yield None
     with raises_kind(AlwaysCombError, _error.ArgType):
         always_comb(h)
Example #30
0
 def test1(self):
     with raises_kind(SimulationError, _error.ArgType):
         Simulation(None)
Example #31
0
 def testArgHasNoArgs(self):
     def h(n):
         return n
     with raises_kind(AlwaysCombError, _error.NrOfArgs):
         always_comb(h)
Example #32
0
 def test1(self):
     with raises_kind(SimulationError, _error.ArgType):
         Simulation(None)
Example #33
0
 def testArgIsFunction(self):
     h = 5
     with raises_kind(AlwaysError, _error.ArgType):
         always(delay(3))(h)
Example #34
0
 def testTimeZero(self):
     with raises_kind(CosimulationError, _error.TimeZero):
         Cosimulation(exe + "cosimTimeZero", **allSigs)
Example #35
0
 def testArgIsNormalFunction(self):
     with raises_kind(AlwaysError, _error.ArgType):
         @always(delay(3))
         def h():
             yield None
Example #36
0
 def testToSignalsDupl(self):
     with raises_kind(CosimulationError, _error.DuplicateSigNames):
         Cosimulation(exe + "cosimToSignalsDupl", **allSigs)
Example #37
0
 def testArgHasNoArgs(self):
     with raises_kind(AlwaysError, _error.NrOfArgs):
         @always(delay(3))
         def h(n):
             return n
Example #38
0
 def testNotUnique(self):
     cosim1 = Cosimulation(exe + "cosimNotUnique", **allSigs)
     with raises_kind(CosimulationError, _error.MultipleCosim):
         Cosimulation(exe + "cosimNotUnique", **allSigs)
Example #39
0
 def testArgIsFunction(self):
     h = 5
     with raises_kind(InstanceError, _error.ArgType):
         instance(h)