Ejemplo n.º 1
0
    def test2(self):
        def g():
            yield delay(10)

        i = g()
        with raises_kind(SimulationError, _error.DuplicatedArg):
            Simulation(i, i)
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 8
0
 def testDecArgType2(self):
     with raises_kind(AlwaysError, _error.DecArgType):
         @always(g)
         def h(n):
             return n
Ejemplo n.º 9
0
 def testArgIsGeneratorFunction(self):
     with raises_kind(InstanceError, _error.ArgType):
         @instance
         def h():
             return None
Ejemplo n.º 10
0
 def testWrongExe(self):
     with raises_kind(CosimulationError, _error.OSError):
         Cosimulation('bla -x 45')
Ejemplo n.º 11
0
 def testNoComm(self):
     with raises_kind(CosimulationError, _error.NoCommunication):
         Cosimulation(exe + "cosimNoComm", **allSigs)
Ejemplo n.º 12
0
 def testTimeZero(self):
     with raises_kind(CosimulationError, _error.TimeZero):
         Cosimulation(exe + "cosimTimeZero", **allSigs)
Ejemplo n.º 13
0
 def testArgHasNoArgs(self):
     with raises_kind(InstanceError, _error.NrOfArgs):
         @instance
         def h(n):
             yield n
Ejemplo n.º 14
0
    def testArgIsGeneratorFunction(self):
        with raises_kind(InstanceError, _error.ArgType):

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

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

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

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