1
0
Fork 0

util: add the IdentityModule, useful to dedup wires

This commit is contained in:
Wesley W. Terpstra 2017-09-06 16:07:31 -07:00
parent 1a87ed1193
commit 5626cdd18f
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
// See LICENSE.SiFive for license details.
package freechips.rocketchip.tilelink
import Chisel._
class IdentityModule[T <: Data](gen: T) extends Module
{
val io = new Bundle {
val in = gen.cloneType.flip
val out = gen.cloneType
}
io.out := io.in
}
object IdentityModule
{
def apply[T <: Data](x: T): T = {
val identity = Module(new IdentityModule(x))
identity.io.in := x
identity.io.out
}
}