繁体   English   中英

函数内部的 MyHDL 信号未显示在 VCD 中

[英]MyHDL Signals inside functions not showing up in VCD

我应该能够在生成的 VCD 文件中看到这些吗?

   @always(clk.posedge)
    def MentorCluster():
        j = Signal(0)
        mentorq0, mentorq1, mentorq2, mentorq3 = [[Signal(0) for j in range(10)] for i in range(4)]

我可以看到我在顶层创建的所有信号,但看不到 function 本地的信号

这是我用来生成 VCD 的代码:

def simulate(timesteps):
    traceSignals.timescale = "1ps"
    tb = traceSignals(avaca)
    sim = Simulation(tb)
    sim.run(timesteps)
    sim.quit()

#simulate for 2000 ticks (picoseconds) -- very ambitious to do all this in 2ns!
simulate(2000)

在“always”中创建的信号不仅不会出现在 .vcd 中,而且也不会起作用。 这是一个小测试程序来试试这个。

'''

                   delay, StopSimulation)


@block
def f1(clk, sigin, sigout):
    # this is the place to declare Signals and ListOfSignals
    sigind1 = Signal(intbv(0)[4:])
    mentorq0, mentorq1, mentorq2, mentorq3 = [[Signal(bool(0)) for j in range(10)] for i in range(4)]

    @always_seq(clk.posedge, reset=None)
    def f1s():
        # declaring Signals and ListOfSignals won't work
        # sigind1 = Signal(intbv(0)[4:])
        # mentorq0, mentorq1, mentorq2, mentorq3 = [[Signal(bool(0)) for j in range(10)] for i in range(4)]

        sigind1.next = sigin
        mentorq0[0].next = sigind1[0]
        mentorq1[0].next = sigind1[1]
        mentorq2[0].next = sigind1[2]
        mentorq3[0].next = sigind1[3]
        for i in range(1, 10):
            mentorq0[i].next = mentorq0[i - 1]
            mentorq1[i].next = mentorq1[i - 1]
            mentorq2[i].next = mentorq2[i - 1]
            mentorq3[i].next = mentorq3[i - 1]
        sigout.next[0] = mentorq0[9]
        sigout.next[1] = mentorq1[9]
        sigout.next[2] = mentorq2[9]
        sigout.next[3] = mentorq3[9]

    return f1s


if __name__ == '__main__':
    import random
    random.seed = 'We want repeatable randomness'

    @block
    def tb_f1():
        clk = Signal(bool(0))
        sigin = Signal(intbv(0)[4:])
        sigout = Signal(intbv(0)[4:])

        tCK = 10

        dut = f1(clk, sigin, sigout)

        @instance
        def genclk():
            while True:
                clk.next = not clk
                yield delay(int(tCK // 2))

        @instance
        def stimulus():
            yield delay(int(tCK * 3.5))
            for __ in range(10):
                sigin.next = random.randint(1, 15)
                yield delay(tCK)
            yield delay(tCK * 20)

            raise StopSimulation

        return instances()

        # finally
    dft = tb_f1()
    dft.config_sim(trace=True)
    dft.run_sim()

当我们激活always块内的信号时,sigout将保持为0

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM