# Intbv and the .next attribute

**URL:** <https://discourse.myhdl.org/t/intbv-and-the-next-attribute/128>\
**Category:** Enhancement Request\
**Created:** [October 14, 2016, 7:51pm UTC](https://discourse.myhdl.org/t/intbv-and-the-next-attribute/128 "2016-10-14T19:51:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![devbisme](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/devbisme/32/79_2.png) [@devbisme](https://discourse.myhdl.org/u/devbisme)\
**Post date:** [October 14, 2016, 7:51pm UTC](https://discourse.myhdl.org/t/intbv-and-the-next-attribute/128/1 "2016-10-14T19:51:07Z")

</div>

I was doing a testbench and had a “signal” I defined as `opcode = intbv('000')`. Then I did something like this:

`opcode.next = 1`

but `opcode` never changed during the simulation and I never got any warnings or errors.

Of course, the simulation started working correctly once I defined the signal as `opcode = Signal(intbv('000'))`. Without the `Signal()`, my code was just creating a new attribute called `next` in the `opcode` object and this is perfectly legal so I wasn’t getting any indication of a problem.

My question: should the `intbv` and `modbv` classes have a predefined `next` property that will issue an error or warning if an assignment is made to them?

---

<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:** [October 16, 2016, 3:58pm UTC](https://discourse.myhdl.org/t/intbv-and-the-next-attribute/128/2 "2016-10-16T15:58:42Z")

</div>

David,

That’s indeed a useful enhancement. The same has happened to me too 🙂 Not often, but it takes a fair amount of time peering into the waveform before this ‘inattention’ is found.

Regards,  
Josy

---

<div class="post-metadata">

**Author:** ![cfelton](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/cfelton/32/3_2.png) [@cfelton](https://discourse.myhdl.org/u/cfelton)\
**Post date:** [October 17, 2016, 1:40pm UTC](https://discourse.myhdl.org/t/intbv-and-the-next-attribute/128/3 "2016-10-17T13:40:01Z")

</div>

I also agree this would be a useful enhancement. Since the `intbv` is not intended to have dynamic attributes (especially for conversion) the ` __getattr__ ` can be implemented so **no** dynamic attributes can created (e.g. `if not hasattr(self, attr): raise Exception`). If dynamic attrs are desired for modeling a subclass can be created.

The `Signal` object already does something similar.
