1
0
mirror of https://github.com/myhdl/myhdl.git synced 2025-01-24 21:52:56 +08:00

Bug fix merge from default

--HG--
branch : 0.9-dev
This commit is contained in:
Jan Decaluwe 2013-09-15 22:36:59 +02:00
commit 4189d9ba95
5 changed files with 58 additions and 1 deletions

View File

@ -127,6 +127,16 @@ class _SigNameVisitor(ast.NodeVisitor):
def visit_Attribute(self, node):
self.visit(node.value)
def visit_Call(self, node):
fn = None
if isinstance(node.func, ast.Name):
fn = node.func.id
if fn == "len":
pass
else:
self.generic_visit(node)
def visit_Subscript(self, node, access=INPUT):
self.visit(node.value)
self.context = INPUT

View File

@ -590,6 +590,7 @@ class _AnalyzeVisitor(ast.NodeVisitor, _ConversionMixin):
elif f is concat:
node.obj = self.getVal(node)
elif f is len:
self.access = _access.UNKNOWN
node.obj = int(0) # XXX
elif f is bool:
node.obj = bool()

View File

@ -0,0 +1,22 @@
#! /usr/bin/env python
from myhdl import *
def module(sigin, sigout):
# Using @always(sigin) only warns, but using @always_comp breaks.
# The reason is that len(sigout) is interpreted as sigout being used as
# an input.
#@always(sigin)
@always_comb
def output():
sigout.next = sigin[len(sigout):]
return output
sigin = Signal(intbv(0)[2:])
sigout = Signal(intbv(0)[2:])
def test_bug_42():
toVHDL(module, sigin, sigout)

View File

@ -0,0 +1,24 @@
#! /usr/bin/env python
from myhdl import *
def module(sigin, sigout):
# Using @always(sigin) only warns, but using @always_comp breaks.
# The reason is that len(sigout) is interpreted as sigout being used as
# an input.
@always(sigin)
def output():
sigout.next = sigin[len(sigout):]
return output
sigin = Signal(intbv(0)[2:])
sigout = Signal(intbv(0)[2:])
def test_bug_42_2():
toVHDL(module, sigin, sigout)
toVHDL(module, sigin, sigout)

View File

@ -32,7 +32,7 @@ Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
setup(name="myhdl",
version="0.8",
version="0.9",
description="Python as a Hardware Description Language",
long_description = "See home page.",
author="Jan Decaluwe",