# MyHDL Signals inside functions not showing up in VCD

**URL:** <https://discourse.myhdl.org/t/myhdl-signals-inside-functions-not-showing-up-in-vcd/488>\
**Category:** Uncategorized\
**Created:** [January 1, 2022, 7:55pm UTC](https://discourse.myhdl.org/t/myhdl-signals-inside-functions-not-showing-up-in-vcd/488 "2022-01-01T19:55:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Mark](https://discourse.myhdl.org/u/Mark)\
**Post date:** [January 1, 2022, 7:55pm UTC](https://discourse.myhdl.org/t/myhdl-signals-inside-functions-not-showing-up-in-vcd/488/1 "2022-01-01T19:55:52Z")

</div>

Should I be able to see these in the generated VCD file?

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

```

I can see all the signals I created at the top level, but not the ones local to the function

Here is the code I used to generate the VCD:

```auto
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)

```

---

<div class="post-metadata">

**Author:** ![josyb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/josyb/32/5_2.png) [@josyb](https://discourse.myhdl.org/u/josyb)\
**Post date:** [January 2, 2022, 3:59pm UTC](https://discourse.myhdl.org/t/myhdl-signals-inside-functions-not-showing-up-in-vcd/488/2 "2022-01-02T15:59:37Z")

</div>

Hi Mark,

Signals created inside an `always’ will not only _not show up_ in the .vcd, but also _won’t work_.  
I created a small test program to try this.

```auto
'''
Created on 2 jan. 2022

@author: josy
'''

from myhdl import (Signal, intbv, block, always_seq, instance, instances,
                   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()

```

When we activate the Signals inside the `always` block `sigout` will remain 0

Regards,  
Josy
