Skip to content

Conversation

@sh-mug
Copy link
Contributor

@sh-mug sh-mug commented Nov 11, 2022

When trying to perform a binary operation on an int variable and a Parameter variable:

m = Module('blinkled')
width = m.Parameter('WIDTH', 8)
a = m.Input('A', 32)
b = m.Output('B', width)
b.assign(a[32-width:32])

And I expected B to be assigned the following:

assign B = A[31:32-WIDTH];

But I got the following error.

TypeError: unsupported operand type(s) for -: 'int' and 'Parameter'

So I added support for binary operations with _Numeric class in the right term.

@shtaxxx shtaxxx merged commit c548d58 into PyHDI:develop Dec 6, 2022
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

Successfully merging this pull request may close these issues.

2 participants