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.

"when" is not working

See original GitHub issue

Type of issue: bug report

Impact: unknown

Other information

I use the chipyard v1.3.0, and change some code in the BOOM generator. As usual, the when condition will check the default value. But I find that one of my when blocks didn’t work. I havn’t assigned the default value, but it didnot report a error like “Reference io is not fully initialized”. My code:

for (i <- 0 until numReadPort){
    when(delogic.io.zeroDetectOut(i).resZero){
      io.wp(i).iresp.bits.data := 0.U
      io.wp(i).iresp.valid := io.rp(i).req.valid && !IsKilledByBranch(io.rp(i).brupdate, io.rp(i).req.bits.uop)
      io.wp(i).iresp.bits.uop := io.rp(i).req.bits.uop
      io.wp(i).iresp.bits.uop.br_mask := GetNewBrMask(io.rp(i).brupdate, io.rp(i).req.bits.uop)
    }
  }

I see the verilog it generated, and find it just like “when(delogic.io.zeroDetectOut(i).resZero)” was not exist. It does not use any mux. For example:

  assign io_wp_0_iresp_valid = io_rp_0_req_valid & _T_36; // @[MultiPortExeUnit.scala 84:28:chipyard.TestHarness.My6WideBoomConfig.fir@406003.6]

The _T_36 just equal to “!IsKilledByBranch(io.rp(i).brupdate, io.rp(i).req.bits.uop)” in Chisel.

If the current behavior is a bug, please provide the steps to reproduce the problem: I try some other simple conditions, but they worked well. Maybe it only show up in big projects.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jackkoenigcommented, Feb 2, 2021

The issue is that your module (named MulExeUnit) extends MultiPortExeUnit (also your module) which extends BoomModule which extends rocket-chip’s CoreModule which extends Module but uses import Chisel._. Unfortunately, when using inheritance, it is the Module at the top of the inheritance tree that sets the behavior of whether or not signals are invalidated by default.

This is unfortunately intended behavior, ideally either rocket-chip would stop doing import Chisel._, or other projects would not inherit from its Modules.

Thinking about this more, we probably should have made the stricter connection semantics bind on definition of the signal (eg. val io = IO(...)) rather than the declaration of the module (which we can only do at the top of the inheritance hierarchy, ie. we can only associate information about which import is used where the extends Module code is located). This would be a hard thing to change as this point as it could potentially break a lot of otherwise working code, but it’s worth considering.

0reactions
lxu28973commented, Feb 2, 2021

Yeah, this is the problem. Thank you veay much!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mockito when method not working - Stack Overflow
Mockito mock works when we mock the objects loosely. Here is the change i have made to make it work: when(controlWfDefTypeService.
Read more >
Mockito.mock() vs @Mock vs @MockBean - Baeldung
We can use the @MockBean to add mock objects to the Spring application context. The mock will replace any existing bean of the...
Read more >
10 ways to fix Instagram if it's not working properly
If Instagram is not working properly, there are many potential causes, each with its own troubleshooting method.
Read more >
Is there any difference between "it's not working" and "it doesn ...
It is correct to say "It's not working" when something is broken permanently, however, if something is broken forever (or permanently), stating, "It...
Read more >
Fusion 360 is not responding after starting
Fusion 360 shows the message "Not Responding" and freezes or crashes after starting. After forcibly closing the program, the operating ...
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