# Inverting a signal passed into a module

**URL:** <https://discourse.myhdl.org/t/inverting-a-signal-passed-into-a-module/266>\
**Category:** Support\
**Created:** [April 5, 2018, 5:11pm UTC](https://discourse.myhdl.org/t/inverting-a-signal-passed-into-a-module/266 "2018-04-05T17:11:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kc64](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/kc64/32/83_2.png) [@kc64](https://discourse.myhdl.org/u/kc64)\
**Post date:** [April 5, 2018, 5:11pm UTC](https://discourse.myhdl.org/t/inverting-a-signal-passed-into-a-module/266/1 "2018-04-05T17:11:00Z")

</div>

When I use the form

```
ff_1 = dffe(reset, clock, d, q, ena)

```

I get the expected results. But when I do this

```
ff_1 = dffe(reset, clock, d, q, not ena)

```

or

```
ff_1 = dffe(reset, clock, d, q, not(ena))

```

I get

```
ToVerilogWarning: Signal is driven but not read: ena

```

What is the correct form for passing in an inverted signal?

---

<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:** [April 5, 2018, 6:26pm UTC](https://discourse.myhdl.org/t/inverting-a-signal-passed-into-a-module/266/2 "2018-04-05T18:26:55Z")

</div>

This is something that doesn’t work; you have to pass a Signal proper. the `not` evaluates its argument (_ena_ in this case). MyHDL will only evaluate that line once; it is the returned generators that do the simulation work, and that are the ones that get converted.

The workaround:

```python
ena_n = Signal(bool(0))

@always_comb
def mknot():
    ena_n.next = not ena

ff_1 = dffe(reset, clock, d, q, ena_n)

. . .

return mknot, ff_1, ...

```

---

<div class="post-metadata">

**Author:** ![kc64](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/kc64/32/83_2.png) [@kc64](https://discourse.myhdl.org/u/kc64)\
**Post date:** [April 5, 2018, 6:34pm UTC](https://discourse.myhdl.org/t/inverting-a-signal-passed-into-a-module/266/3 "2018-04-05T18:34:54Z")

</div>

Thank you, @josyb! Makes sense now. I guess we’re all hoping that it might work someday?
