chisel icon indicating copy to clipboard operation
chisel copied to clipboard

Mem issues clock warnings for unclocked ports

Open aswaterman opened this issue 2 years ago • 0 comments

In #2333, we introduced warnings when the implicit clock at Mem declaration time doesn't match the implicit clock at Mem port generation time. These warnings shouldn't be emitted for combinational-read ports--since those ports don't depend on a clock, we shouldn't care what the current implicit clock is.

This is easy enough to fix for the Mem.read method, but it's not immediately obvious to me how to fix it for Mem.apply, since it's not known at port-declaration time whether the port will be used for writing.

In the meantime, there are obvious workarounds.

Type of issue: bug report

Impact: API addition (no impact on existing code)

Development Phase: request

Other information

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

    val mem = Mem(2, Bool())
    val alt_clock = WireInit(clock)
    val rdata = WireInit(false.B)
    withClock (alt_clock) { rdata := mem(0.U) }

What is the current behavior? Warning is emitted.

What is the expected behavior? No warning should be emitted. (More importantly, this should not become an error in 3.6.0, as the message warns.)

Please tell us about your environment:

What is the use case for changing the behavior?

aswaterman avatar Mar 03 '22 22:03 aswaterman