summaryrefslogtreecommitdiff
path: root/core/src/main/scala/chisel3/experimental/hierarchy/IsLookupable.scala
blob: a82cbd7d9a5f67580d8df384bf507c0295407372 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// SPDX-License-Identifier: Apache-2.0

package chisel3.experimental.hierarchy

/** A User-extendable trait to mark metadata-containers, e.g. parameter case classes, as valid to return unchanged
  * from an instance.
  *
  * This should only be true of the metadata returned is identical for ALL instances!
  *
  * @example For instances of the same proto, metadata or other construction parameters
  *   may be useful to access outside of the instance construction. For parameters that are
  *   the same for all instances, we should mark it as IsLookupable
  * {{{
  * case class Params(debugMessage: String) extends IsLookupable
  * class MyModule(p: Params) extends MultiIOModule {
  *   printf(p.debugMessage)
  * }
  * val myParams = Params("Hello World")
  * val definition = Definition(new MyModule(myParams))
  * val i0 = Instance(definition)
  * val i1 = Instance(definition)
  * require(i0.p == i1.p) // p is only accessable because it extends IsLookupable
  * }}}
  */
trait IsLookupable