George Pantazopoulos wrote:
> Hi Jan,
>
> I've often run into the situation where I forget to use .next for a
> variable, and it produces subtle errors that are hard to detect.
>
> (eg. doing "count = (count + 1) % 2**COUNTER_WIDTH", rather than doing
> "count.next = (count + 1) % 2**COUNTER_WIDTH)". I often slip up because
> I'm very used to programming in C/C++ at work. I feel that myHDL should
> flag this as an obvious error.
From a Python point of view, it's not necessarily that obvious. It's a
fact that assignment in Python is very different from other languages,
and this has to be understood for effecive Python (not just MyHDL)
coding. See also:
http://www.jandecaluwe.com/Tools/MyHDL/manual/conv-meth-assign.html
On the other hand, you are right that with Signals (and intbv's) this
must usually be an unintended error. In fact, toVerilog does flag
such issues (not checked for this case - but it should).
Of course, I can hardly recommend using toVerilog before
simulation, when I usually do the opposite :-)
Anyway, toVerilog shows that it can be done. However, it's
not nessarily straigthforward what would be the best way for
general checking. We should also investigate what we can reuse from
general Python linting tools, such as pychecker.
A MyHDL checker would be very useful, but it's a significant
project. I can't devote time to it in the short term. If
someone is looking for a major contribution ...
Jan
--
Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com
Losbergenlaan 16, B-3010 Leuven, Belgium
From Python to silicon:
http://myhdl.jandecaluwe.com
|