1
0
rocket-chip/src/main/scala/util/GenericParameterizedBundle.scala

22 lines
667 B
Scala

// See LICENSE for license details.
package util
import Chisel._
abstract class GenericParameterizedBundle[T <: Object](val params: T) extends Bundle
{
override def cloneType = {
try {
this.getClass.getConstructors.head.newInstance(params).asInstanceOf[this.type]
} catch {
case e: java.lang.IllegalArgumentException =>
throw new Exception("Unable to use GenericParameterizedBundle.cloneType on " +
this.getClass + ", probably because " + this.getClass +
"() takes more than one argument. Consider overriding " +
"cloneType() on " + this.getClass, e)
}
}
}