chipsalliance / chipsalliance/chisel

ProbeValue of Probe Should Error in Chisel

Open
#3,648 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
4.8k
Forks
658
Avg merge
18h 59m
Merged PRs (30d)
14

Description

Chisel currently lets you `ProbeValue` a `Probe` type. This then produces illegal FIRRTL. Change Chisel to catch this.

Consider:

```scala
//> using scala "2.13.11"
//> using repository sonatype-s01:snapshots
//> using lib "org.chipsalliance::chisel::6.0.0-M3+117-2372b1c4-SNAPSHOT"
//> using plugin "org.chipsalliance:::chisel-plugin::6.0.0-M3+117-2372b1c4-SNAPSHOT"
//> using options "-unchecked", "-deprecation", "-language:reflectiveCalls", "-feature", "-Xcheckinit", "-Xfatal-warnings", "-Ywarn-dead-code", "-Ywarn-unused", "-Ymacro-annotations"

import chisel3._
import chisel3.probe.{Probe, ProbeValue, define}
import circt.stage.ChiselStage

class Foo extends RawModule {
val a = IO(Probe(Bool()))

val b = WireInit(Bool(), DontCare)

define(a, ProbeValue(ProbeValue(b)))
}

object Main extends App {
println(
ChiselStage.emitCHIRRTL(
new Foo
)
)
}
```

This produces the following FIRRTL (`scala-cli Foo.scala`):

```
FIRRTL version 3.3.0
circuit Foo :
module Foo :
output a : Probe>

wire b : UInt<1>
invalidate b
define a = probe(probe(b))
```

However, `probe(probe(b))` is illegal (`scala-cli Foo.scala | firtool -format=fir`):

```
error: expected static reference expression in 'probe'
define a = probe(probe(b))
^
```

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.