util: add Option.unzip
This commit is contained in:
parent
60614055e3
commit
5323cf88dd
@ -109,8 +109,7 @@ class ICacheModule(outer: ICache) extends LazyModuleImp(outer)
|
|||||||
val io = IO(new ICacheBundle(outer))
|
val io = IO(new ICacheBundle(outer))
|
||||||
val (tl_out, edge_out) = outer.masterNode.out(0)
|
val (tl_out, edge_out) = outer.masterNode.out(0)
|
||||||
// Option.unzip does not exist :-(
|
// Option.unzip does not exist :-(
|
||||||
val tl_in = outer.slaveNode.in.headOption.map(_._1)
|
val (tl_in, edge_in) = outer.slaveNode.in.headOption.unzip
|
||||||
val edge_in = outer.slaveNode.in.headOption.map(_._2)
|
|
||||||
|
|
||||||
val tECC = cacheParams.tagECC
|
val tECC = cacheParams.tagECC
|
||||||
val dECC = cacheParams.dataECC
|
val dECC = cacheParams.dataECC
|
||||||
|
@ -6,6 +6,10 @@ import Chisel._
|
|||||||
import scala.math.min
|
import scala.math.min
|
||||||
|
|
||||||
package object util {
|
package object util {
|
||||||
|
implicit class UnzippableOption[S, T](val x: Option[(S, T)]) {
|
||||||
|
def unzip = (x.map(_._1), x.map(_._2))
|
||||||
|
}
|
||||||
|
|
||||||
implicit class UIntIsOneOf(val x: UInt) extends AnyVal {
|
implicit class UIntIsOneOf(val x: UInt) extends AnyVal {
|
||||||
def isOneOf(s: Seq[UInt]): Bool = s.map(x === _).reduce(_||_)
|
def isOneOf(s: Seq[UInt]): Bool = s.map(x === _).reduce(_||_)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user