Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't process std_logic_vector(xx downto 0) if xx starts with a 0 or a space #12

Open
sylvainhuard opened this issue Oct 12, 2023 · 0 comments

Comments

@sylvainhuard
Copy link

the "xx" is not identified as an integer. here are the 3 form of the same:
(3 downto 0) -- passes
(03 downto 0) -- fails
( 3 downto 0) -- fails.
it returns that error:
Cannot use str_expression on
The function
`
def str_expression(item):
'''
Returns a string representation of the mathematical equation.

>>> str_expression(Addition([Term(number=3, expression='fish'), Term(number=1, expression='bear')]))
'(3*fish+bear)'
'''
if isinstance(item, str):
    o = item
elif isinstance(item, int):
    o = str(item)
elif isinstance(item, float):
    if int(item) == item:
        o = str(int(item))
    else:
        o = str(item)
elif hasattr(item, 'str_expression'):
    o = item.str_expression()
else:
    raise MathParsingError('Cannot use str_expression on {}'.format(item))
return o

`
is in "math_parser.py"

when I write my own code, it's not an issue. I can workaround the limitation. When using open source IPs that uses the two failing form, it forces to modifiy the original source code and rework it every time we fetch from the source. I found the bug parsing
https://github.com/stnolting/neorv32/blob/main/rtl/core/neorv32_package.vhd
Even with this bug, slvcodec advantages outway by far the little maintenance after a fetch from origin. Thanks for this great utility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant