aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/Utils.scala
diff options
context:
space:
mode:
authorLeway Colin2019-07-09 01:41:02 +0800
committermergify[bot]2019-07-08 17:41:02 +0000
commitaa571e1d4f76d095344a9deed28dfa70f704fa75 (patch)
tree77e34d92f04f32f7c3c28bde8c9dac2892943ac5 /src/main/scala/firrtl/Utils.scala
parent648dddeacd9aece4a43cad09430dad25cba69457 (diff)
Remove some warnings (#1118)
Diffstat (limited to 'src/main/scala/firrtl/Utils.scala')
-rw-r--r--src/main/scala/firrtl/Utils.scala16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main/scala/firrtl/Utils.scala b/src/main/scala/firrtl/Utils.scala
index b7073f70..72003608 100644
--- a/src/main/scala/firrtl/Utils.scala
+++ b/src/main/scala/firrtl/Utils.scala
@@ -114,13 +114,13 @@ object fromBits {
rhs: Expression,
offset: BigInt): (BigInt, Seq[Statement]) =
lhst match {
- case t: VectorType => (0 until t.size foldLeft (offset, Seq[Statement]())) {
+ case t: VectorType => (0 until t.size foldLeft( (offset, Seq[Statement]()) )) {
case ((curOffset, stmts), i) =>
val subidx = WSubIndex(lhs, i, t.tpe, UNKNOWNGENDER)
val (tmpOffset, substmts) = getPart(subidx, t.tpe, rhs, curOffset)
(tmpOffset, stmts ++ substmts)
}
- case t: BundleType => (t.fields foldRight (offset, Seq[Statement]())) {
+ case t: BundleType => (t.fields foldRight( (offset, Seq[Statement]()) )) {
case (f, (curOffset, stmts)) =>
val subfield = WSubField(lhs, f.name, f.tpe, UNKNOWNGENDER)
val (tmpOffset, substmts) = getPart(subfield, f.tpe, rhs, curOffset)
@@ -303,7 +303,7 @@ object Utils extends LazyLogging {
t match {
case (_: GroundType) => f
case (tx: BundleType) =>
- val (_, flip) = tx.fields.foldLeft(i, None: Option[Orientation]) {
+ val (_, flip) = tx.fields.foldLeft( (i, None: Option[Orientation]) ) {
case ((n, ret), x) if n < get_size(x.tpe) => ret match {
case None => (n, Some(get_flip(x.tpe, n, times(x.flip, f))))
case Some(_) => (n, ret)
@@ -312,7 +312,7 @@ object Utils extends LazyLogging {
}
flip.get
case (tx: VectorType) =>
- val (_, flip) = (0 until tx.size).foldLeft(i, None: Option[Orientation]) {
+ val (_, flip) = (0 until tx.size).foldLeft( (i, None: Option[Orientation]) ) {
case ((n, ret), x) if n < get_size(tx.tpe) => ret match {
case None => (n, Some(get_flip(tx.tpe, n, f)))
case Some(_) => (n, ret)
@@ -453,10 +453,10 @@ object Utils extends LazyLogging {
case (_: AnalogType, _: AnalogType) => if (flip1 == flip2) Seq((0, 0)) else Nil
case (t1x: BundleType, t2x: BundleType) =>
def emptyMap = Map[String, (Type, Orientation, Int)]()
- val t1_fields = t1x.fields.foldLeft(emptyMap, 0) { case ((map, ilen), f1) =>
- (map + (f1.name ->(f1.tpe, f1.flip, ilen)), ilen + get_size(f1.tpe))
+ val t1_fields = t1x.fields.foldLeft( (emptyMap, 0) ) { case ((map, ilen), f1) =>
+ (map + (f1.name ->( (f1.tpe, f1.flip, ilen) )), ilen + get_size(f1.tpe))
}._1
- t2x.fields.foldLeft(Seq[(Int, Int)](), 0) { case ((points, jlen), f2) =>
+ t2x.fields.foldLeft( (Seq[(Int, Int)](), 0) ) { case ((points, jlen), f2) =>
t1_fields get f2.name match {
case None => (points, jlen + get_size(f2.tpe))
case Some((f1_tpe, f1_flip, ilen)) =>
@@ -468,7 +468,7 @@ object Utils extends LazyLogging {
}._1
case (t1x: VectorType, t2x: VectorType) =>
val size = math.min(t1x.size, t2x.size)
- (0 until size).foldLeft(Seq[(Int, Int)](), 0, 0) { case ((points, ilen, jlen), _) =>
+ (0 until size).foldLeft( (Seq[(Int, Int)](), 0, 0) ) { case ((points, ilen, jlen), _) =>
val ls = get_valid_points(t1x.tpe, t2x.tpe, flip1, flip2)
(points ++ (ls map { case (x, y) => (x + ilen, y + jlen) }),
ilen + get_size(t1x.tpe), jlen + get_size(t2x.tpe))