Re: [myhdl-list] strange problem
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2009-03-24 15:11:45
|
Neal Becker wrote: > That worked fine, until I needed to access (read) a variable also in another > generator. > > I find that: > > x = Signal (0) > > def gen1... > x.next = x + 1 > > def gen2... > print x > > Works fine, but if x was just a simple variable, say int, we have the > referenced before assignment (of course, using x = x+1 instead of x.next = > x+1). > > Other than using a Signal, any other solution? It seems silly to use Signal > for something that is just part of my test setup. You could declare the int x as global inside your generators. Or you could declare a global intbv and use x[:] = x + 1. In both cases though, you loose the determinism that signals give you. In other words, the behavior will depend on the (unspecified) order in which generators are run by the simulator. Jan -- Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com Python as an HDL: http://www.myhdl.org VHDL development, the modern way: http://www.sigasi.com Analog design automation: http://www.mephisto-da.com World-class digital design: http://www.easics.com |