1
0

Add a way to create Async Reset Registers and a way to easily access them with TL2

This commit is contained in:
Megan Wachs
2016-09-08 20:01:03 -07:00
parent c1eb1f12a2
commit fda4c2bd76
4 changed files with 148 additions and 1 deletions

View File

@ -4,6 +4,8 @@ package uncore.tilelink2
import Chisel._
import uncore.util.{SimpleRegIO}
case class RegReadFn private(combinational: Boolean, fn: (Bool, Bool) => (Bool, Bool, UInt))
object RegReadFn
{
@ -81,6 +83,15 @@ object RegField
// Setting takes priority over clearing.
def w1ToClear(n: Int, reg: UInt, set: UInt): RegField =
RegField(n, reg, RegWriteFn((valid, data) => { reg := ~(~reg | Mux(valid, data, UInt(0))) | set; Bool(true) }))
// This RegField wraps an explicit register
// (e.g. Black-Boxed Register) to create a R/W register.
def rwReg(n: Int, bb: SimpleRegIO) : RegField =
RegField(n, bb.q, RegWriteFn((valid, data) => {
bb.en := valid
bb.d := data
Bool(true)
}))
}
trait HasRegMap