summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/util/BlackBoxUtils.scala
blob: 084d58f9fd5a17b182bea6f055ba92eb604e73fb (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
// See LICENSE for license details.

package chisel3.util

import chisel3._
import chisel3.core.ChiselAnnotation
import firrtl.transforms.{BlackBoxInline, BlackBoxResource, BlackBoxSourceHelper}

trait HasBlackBoxResource extends BlackBox {
  self: Module =>

  def setResource(blackBoxResource: String): Unit = {
    annotate(ChiselAnnotation(self, classOf[BlackBoxSourceHelper], BlackBoxResource(blackBoxResource).serialize))
  }
}

trait HasBlackBoxInline extends BlackBox {
  self: Module =>

  def setInline(blackBoxName: String, blackBoxInline: String): Unit = {
    annotate(ChiselAnnotation(
      self, classOf[BlackBoxSourceHelper], BlackBoxInline(blackBoxName, blackBoxInline).serialize))
  }
}