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

Slicing non-Bits signals inside update blocks does not generate very helpful error messages #197

Closed
ptpan opened this issue Aug 12, 2020 · 1 comment

Comments

@ptpan
Copy link
Contributor

ptpan commented Aug 12, 2020

To reproduce, use the following code:

from pymtl3 import *

BitStruct = mk_bitstruct( "BitStruct", {
    "foo" : Bits32,
} )

class A( Component ):

  def construct( s ):

    s.in_ = InPort( BitStruct )
    s.out = OutPort( 16 )

    @update
    def upblk():
      s.out @= s.in_[0:16]

A().elaborate()

The slicing error on line s.out @= s.in_[0:16] gives the following error messages which do not refer to the offending signals:

(python3.7.4) [pp@server] $ python3 slice.py
Traceback (most recent call last):
  File "slice.py", line 18, in <module>
    A().elaborate()
  File "/.../pymtl3/dsl/Component.py", line 439, in elaborate
    super().elaborate()
  File "/.../pymtl3/dsl/ComponentLevel2.py", line 615, in elaborate
    c._elaborate_read_write_func()
  File "/.../pymtl3/dsl/ComponentLevel2.py", line 301, in _elaborate_read_write_func
    s._dsl.upblk_reads [ blk ] = extract_obj_from_names( blk, name_rd[ name ] )
  File "/.../pymtl3/dsl/ComponentLevel2.py", line 210, in extract_obj_from_names
    lookup_variable( s, 1, 1 )
  File "/.../pymtl3/dsl/ComponentLevel2.py", line 191, in lookup_variable
    else:       expand_array_index( child, name_depth,   node_depth+1, 0, idx )
  File "/.../pymtl3/dsl/ComponentLevel2.py", line 154, in expand_array_index
    child = obj[ current_idx ]
  File "/.../pymtl3/dsl/Connectable.py", line 233, in __getitem__
    raise InvalidConnectionError( "We don't allow slicing on non-Bits signals." )
pymtl3.dsl.errors.InvalidConnectionError: We don't allow slicing on non-Bits signals.
@ptpan
Copy link
Contributor Author

ptpan commented Dec 6, 2023

Resolved by #259

@ptpan ptpan closed this as completed Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant