move junctions utils into top-level utils package
This commit is contained in:
28
src/main/scala/util/Misc.scala
Normal file
28
src/main/scala/util/Misc.scala
Normal file
@ -0,0 +1,28 @@
|
||||
package util
|
||||
|
||||
import Chisel._
|
||||
import cde.Parameters
|
||||
|
||||
class ParameterizedBundle(implicit p: Parameters) extends Bundle {
|
||||
override def cloneType = {
|
||||
try {
|
||||
this.getClass.getConstructors.head.newInstance(p).asInstanceOf[this.type]
|
||||
} catch {
|
||||
case e: java.lang.IllegalArgumentException =>
|
||||
throwException("Unable to use ParamaterizedBundle.cloneType on " +
|
||||
this.getClass + ", probably because " + this.getClass +
|
||||
"() takes more than one argument. Consider overriding " +
|
||||
"cloneType() on " + this.getClass, e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object DecoupledHelper {
|
||||
def apply(rvs: Bool*) = new DecoupledHelper(rvs)
|
||||
}
|
||||
|
||||
class DecoupledHelper(val rvs: Seq[Bool]) {
|
||||
def fire(exclude: Bool, includes: Bool*) = {
|
||||
(rvs.filter(_ ne exclude) ++ includes).reduce(_ && _)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user