2016-11-28 01:16:37 +01:00
|
|
|
// See LICENSE.SiFive for license details.
|
2016-10-04 00:17:36 +02:00
|
|
|
|
2017-07-07 19:48:16 +02:00
|
|
|
package freechips.rocketchip.util
|
2016-10-04 00:17:36 +02:00
|
|
|
|
|
|
|
import Chisel._
|
|
|
|
|
2016-12-02 02:46:52 +01:00
|
|
|
abstract class GenericParameterizedBundle[+T <: Object](val params: T) extends Bundle
|
2016-10-04 00:17:36 +02:00
|
|
|
{
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|