1
0

tilelink2: make bundle parameterization reusable

This commit is contained in:
Wesley W. Terpstra 2016-08-29 17:02:04 -07:00
parent 594850eaae
commit 77cf186cf0

View File

@ -4,14 +4,14 @@ package uncore.tilelink2
import Chisel._ import Chisel._
abstract class TLBundleBase(val params: TLBundleParameters) extends Bundle abstract class GenericParameterizedBundle[T <: Object](val params: T) extends Bundle
{ {
override def cloneType = { override def cloneType = {
try { try {
this.getClass.getConstructors.head.newInstance(params).asInstanceOf[this.type] this.getClass.getConstructors.head.newInstance(params).asInstanceOf[this.type]
} catch { } catch {
case e: java.lang.IllegalArgumentException => case e: java.lang.IllegalArgumentException =>
throwException("Unable to use TLBundleBase.cloneType on " + throwException("Unable to use GenericParameterizedBundle.cloneType on " +
this.getClass + ", probably because " + this.getClass + this.getClass + ", probably because " + this.getClass +
"() takes more than one argument. Consider overriding " + "() takes more than one argument. Consider overriding " +
"cloneType() on " + this.getClass, e) "cloneType() on " + this.getClass, e)
@ -19,6 +19,8 @@ abstract class TLBundleBase(val params: TLBundleParameters) extends Bundle
} }
} }
abstract class TLBundleBase(params: TLBundleParameters) extends GenericParameterizedBundle(params)
// common combos in lazy policy: // common combos in lazy policy:
// Put + Acquire // Put + Acquire
// Release + AccessAck // Release + AccessAck