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

Using output as a source (rather than a dest) throw internal error instead of user error #263

Open
timsherwood opened this issue Jul 2, 2019 · 0 comments
Labels
beginner friendly A good target for undergrads to contribute to PyRTL confusing or uncaught error PyRTL error messages not sufficient for situation

Comments

@timsherwood
Copy link
Contributor

PyRTL throws an "internal error" when an output is used as a source. This should be caught with a proper pyrtl error (earlier in the process if possible).

Traceback (most recent call last):
File "outerr.py", line 9, in
mem_direct[mreg] <<= mout + 1
File "/Users/sherwood/Desktop/work-stuff/GitProjects/PyRTL/pyrtl/wire.py", line 259, in add
return self._two_var_op(other, '+')
File "/Users/sherwood/Desktop/work-stuff/GitProjects/PyRTL/pyrtl/wire.py", line 201, in _two_var_op
working_block().add_net(net)
File "/Users/sherwood/Desktop/work-stuff/GitProjects/PyRTL/pyrtl/core.py", line 297, in add_net
self.sanity_check_net(net)
File "/Users/sherwood/Desktop/work-stuff/GitProjects/PyRTL/pyrtl/core.py", line 569, in sanity_check_net
raise PyrtlInternalError('error, Outputs cannot be arguments for a net')
pyrtl.pyrtlexceptions.PyrtlInternalError: error, Outputs cannot be arguments for a net

Here is a small piece of code that demonstrates the error.

from pyrtl import *

mem_direct = MemBlock(bitwidth=8, addrwidth=8, name='mem_direct')
mout = Output(8, 'mem_direct_output')
mreg = Register(8, 'mreg')

mout <<= mem_direct[mreg]
mreg.next <<= mreg + 1
mem_direct[mreg] <<= mout + 1
@timsherwood timsherwood added beginner friendly A good target for undergrads to contribute to PyRTL confusing or uncaught error PyRTL error messages not sufficient for situation labels Jul 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginner friendly A good target for undergrads to contribute to PyRTL confusing or uncaught error PyRTL error messages not sufficient for situation
Projects
None yet
Development

No branches or pull requests

1 participant