chipsalliance / chipsalliance/chisel

Make asUInt on Bundle Literals work outside of Builder context

Open
#1,830 1 comment 4 reactions 1 assignee Assigned to @jackkoenig View on GitHub
Dominant language
Scala
Stars
4.8k
Forks
658
Avg merge
18h 59m
Merged PRs (30d)
14

Description

**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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.