Skip to content

Make asUInt on Bundle Literals work outside of Builder context #1830

@KasperHesse

Description

@KasperHesse

Type of issue: feature request

Impact: | API modification

Development Phase: request

Other information

When calling asUInt() on a bundle literal outside of a builder context, it currently raises a ChiselException: Error: Not in UserModule. Being able to call asUInt() on bundle literals outside the Builder context (eg in a tester) would make testing easier. See https://gitter.im/freechipsproject/chisel3?at=605469f03a9448256c1703a for an example of the code that raises this exception.

If the current behavior is a bug, please provide the steps to reproduce the problem:
N/A

What is the current behavior?
It raises a chisel3.internal.ChiselException

What is the expected behavior?
It should cast the bundle to a UInt representing the same bit values.

Please tell us about your environment:

Chisel version: 3.4.2
OS: Windows 10, build 19042.867 running openJDK 11.0.8
What is the use case for changing the behavior?
Casting to/from bundle literals and UInts seems like a useful feature to have outside of Builders.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions