Re: [myhdl-list] enums and non-local
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2015-02-11 13:46:13
|
On 2/11/2015 1:11 AM, JOSE MARIA GOMEZ CAMA wrote: > Hello all, > > I am trying to use an enumeration to define the states of a finite state machine. There are examples where it seems to work, but I am not able to do that. Moreover, I have gone through the code and in the _analyze.py module it seems that only intbv are allowed to be seen as non-locals. I assume there is a reason for this filtering, but there is no information. Can anyone provide a hint? Do you have an example of the enumeration not working? I have used it many times, you can peruse this example if you like: https://github.com/schoeberl/comphdl/blob/master/myhdl/vending/vending.py#L31 Also the examples on the MyHDL website: http://www.myhdl.org/examples/sinecomp/#design The nonlocals are a little more complicated and will be enhanced (!) when porting to Py3k is completed. In general using /intbv/ is the safest approach. def m_some_module(*portmap): myvar = intbv(0, min=-8, max=8) @always... def rtl(): myvar[:] = x + 1 ... Hope that helps, Chris |