Skip to content

Commit

Permalink
Fix bitonic example; skip locals in AttrRefResolver
Browse files Browse the repository at this point in the history
  • Loading branch information
jandecaluwe committed Feb 3, 2016
1 parent a48eb2e commit 755d2b8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 7 additions & 2 deletions example/cookbook/bitonic/bitonic.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import subprocess

from myhdl import *
from myhdl.conversion import analyze

Expand Down Expand Up @@ -71,12 +73,15 @@ def Array8Sorter(a0, a1, a2, a3, a4, a5, a6, a7,
def Array8Sorter_v(a0, a1, a2, a3, a4, a5, a6, a7,
z0, z1, z2, z3, z4, z5, z6, z7):

analyze.simulator = 'iverilog'
toVerilog(Array8Sorter, a0, a1, a2, a3, a4, a5, a6, a7,
z0, z1, z2, z3, z4, z5, z6, z7)
analyze(Array8Sorter, a0, a1, a2, a3, a4, a5, a6, a7,
z0, z1, z2, z3, z4, z5, z6, z7)
cmd = "cver -q +loadvpi=../../../cosimulation/cver/myhdl_vpi:vpi_compat_bootstrap " + \
"Array8Sorter.v tb_Array8Sorter.v"
# cmd = "cver -q +loadvpi=../../../cosimulation/cver/myhdl_vpi:vpi_compat_bootstrap " + \
# "Array8Sorter.v tb_Array8Sorter.v"
subprocess.call("iverilog -o Array8Sorter.o Array8Sorter.v tb_Array8Sorter.v", shell=True)
cmd = "vvp -m ../../../cosimulation/icarus/myhdl.vpi Array8Sorter.o"
return Cosimulation(cmd, **locals())


8 changes: 6 additions & 2 deletions myhdl/_resolverefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,16 @@ def visit_Attribute(self, node):
if node.attr in reserved:
return node

#Don't handle subscripts for now.
# Don't handle subscripts for now.
if not isinstance(node.value, ast.Name):
return node

# Don't handle locals
if node.value.id not in self.data.symdict:
return node

obj = self.data.symdict[node.value.id]
#Don't handle enums and functions, handle signals as long as it is a new attribute
# Don't handle enums and functions, handle signals as long as it is a new attribute
if isinstance(obj, (EnumType, FunctionType)):
return node
elif isinstance(obj, SignalType):
Expand Down

0 comments on commit 755d2b8

Please sign in to comment.