title: Debugging module internals in Chisel
body: <p>I have a complex module written in Chisel. I'm using chiseltest to verify its operation. The test is failing. I want to be able to inspect the module's internal wire values to debug what is going wrong. Since the PeekPokeTester only allows me to inspect the value of the io signals, how can I inspect the internal wires?</p>
  <p>Here is an example:</p>
  <pre><code>import chisel3._
  
  class MyModule extends Module {
    val io = IO(new Bundle {
      val a = Input(Bool())
      val b = Input(Bool())
      val c = Input(Bool())
      val d = Output(Bool())
    })
  
    val i = Wire(Bool())
    i := io.a ^ io.b
  
    io.d := i | io.c
  }
  </code></pre>
  <pre><code>import chisel3._
  import chisel3.tester._
  import org.scalatest.FreeSpec
  
  class MyModuleTest extends FreeSpec with ChiselScalatestTester {
    &quot;MyModule should work properly&quot; in {
      test(new MyModule) { dut =&gt;
        dut.io.a.poke(true.B)
        dut.io.b.poke(false.B)
        dut.io.c.poke(false.B)
        dut.i.expect(true.B)  // This line throws a java.util.NoSuchElementException
                              // : key not found: Bool(Wire in MyModule)
      }
    }
  }
  </code></pre>
  <p>How can I inspect the intermediate value &quot;i&quot;?</p>