Re: [myhdl-list] Unable to get a counter working
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2008-08-18 09:10:11
|
Andrew Lentvorski wrote: > Could someone please explain to me what I'm doing wrong? I'm trying to > implement what would be a basic PC counter in a microprocessor. The > stage has two def's: pc_logic which should basically just be a > combinatorial adder and pc_flops which captures the state of the > combinatorial logic on an edge. > > Why doesn't this work? Worse, why does the one commented line throw a > UboundLocalError error? See Gunter's post for the answer in a MyHDL context. For clarity, I would like to add that the issue is conceptually not related to something MyHDL-specific, but to the semantics of assignment and local namespaces in Python. These work differently than in many other languages and it is important to understand this clearly. See also: http://www.network-theory.co.uk/docs/pytut/PythonScopesandNameSpaces.html Regards, Jan -- Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com Kaboutermansstraat 97, B-3000 Leuven, Belgium From Python to silicon: http://myhdl.jandecaluwe.com |