question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sub field assignment

See original GitHub issue

Type of issue: bug report

Impact: Chisel 2 code needs changes

Development Phase: request

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

assign subfields to a register (worked in Chisel 2):

  val shiftReg = RegInit(0x7ff.U)
...
      when(io.channel.valid) {
        shiftReg(0) := 0.U // start bit
        shiftReg(8, 1) := io.channel.data // data
        shiftReg(10, 9) := 3.U // two stop bits

workaround:

        shiftReg := Cat(Cat(3.U, io.channel.data), 0.U) // two stop bits, data, one start bit

What is the current behavior?

[error] (run-main-0) chisel3.internal.ChiselException: Cannot reassign to read-only chisel3.core.Bool@74 [error] chisel3.internal.ChiselException: Cannot reassign to read-only chisel3.core.Bool@74 [error] at chisel3.internal.throwException$.apply(Error.scala:13) [error] at chisel3.core.Data.connect(Data.scala:296) [error] at chisel3.core.Data.$colon$eq(Data.scala:365) [error] at uart.Tx$$anonfun$1$$anonfun$apply$mcV$sp$2$$anonfun$apply$mcV$sp$3.apply$mcV$sp(Uart.scala:55)

What is the expected behavior?

Work like in Chisel 2 or have an explanation in the porting Chisel 2 to 3 document.

Please tell us about your environment:

Mac

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
juliusbaxtercommented, Jan 2, 2019

Agree vecs and bundles are nice but you don’t always have them set up to access individual bits, so it’s inconvenient.

I think the main argument against the removal of subword assignment is consistency. If I can get a subword from a value, I should also be able to set it. Inconsistencies like this are frustrating for the user.

3reactions
tdb-alcorncommented, May 19, 2019

+1 I’m generating ultra-wide buses to get around the problem of many Vecs slowing down the Chisel compiler, and it would be great to be able to assign to subwords. Currently I’m working around this by using verilog black boxes to subword assign instead (very hacky)

Read more comments on GitHub >

github_iconTop Results From Across the Web

sub field assignment · Issue #878 · chipsalliance/chisel3
Is there any discussion on why subword assignment was removed from Chisel 3? It seems to me to be an oft-used feature, where...
Read more >
Processing Subfields - SAP Help Portal
SAP recommends that you assign values with offset and length specifications only between non-numeric fields. With numeric fields, the results can be meaningless ......
Read more >
Pydantic validate subfields on assignment - Stack Overflow
I'm trying to make sure one of my objects used is always in a correct state. For this I should validate not only...
Read more >
Psychology subfields
Quantitative psychologists study and develop the methods and techniques used to measure human behavior and other attributes. Their work involves the statistical ...
Read more >
Historical Specializations & Sub-Fields: Definition & Examples
In this lesson we will examine sub-fields of history. We will discover why some historians choose to specialize in a specific sub-field, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found