summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorducky2015-10-23 13:12:27 -0700
committerPalmer Dabbelt2015-10-23 13:18:16 -0700
commit233875001af47b0c7773872f8bd76f1e53ef9e83 (patch)
tree627d85a99298c431dc638095000c2df096a2eac6
parent6ce580969d1cefcdff18aa8ab6610b1c89c57739 (diff)
Whitespace scalastyle fixes for tests
-rw-r--r--src/test/scala/chiselTests/BitwiseOps.scala34
-rw-r--r--src/test/scala/chiselTests/BundleWire.scala2
-rw-r--r--src/test/scala/chiselTests/ChiselSpec.scala32
-rw-r--r--src/test/scala/chiselTests/ComplexAssign.scala9
-rw-r--r--src/test/scala/chiselTests/Counter.scala4
-rw-r--r--src/test/scala/chiselTests/Decoder.scala6
-rw-r--r--src/test/scala/chiselTests/Direction.scala4
-rw-r--r--src/test/scala/chiselTests/GCD.scala34
-rw-r--r--src/test/scala/chiselTests/MulLookup.scala6
-rw-r--r--src/test/scala/chiselTests/Tbl.scala6
-rw-r--r--src/test/scala/chiselTests/UInt.scala8
-rw-r--r--src/test/scala/chiselTests/Vec.scala4
12 files changed, 42 insertions, 107 deletions
diff --git a/src/test/scala/chiselTests/BitwiseOps.scala b/src/test/scala/chiselTests/BitwiseOps.scala
index 1d668ebd..86c7131b 100644
--- a/src/test/scala/chiselTests/BitwiseOps.scala
+++ b/src/test/scala/chiselTests/BitwiseOps.scala
@@ -1,32 +1,4 @@
-/*
- Copyright (c) 2011-2015 The Regents of the University of
- California (Regents). All Rights Reserved. Redistribution and use in
- source and binary forms, with or without modification, are permitted
- provided that the following conditions are met:
-
- * Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- two paragraphs of disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- two paragraphs of disclaimer in the documentation and/or other materials
- provided with the distribution.
- * Neither the name of the Regents nor the names of its contributors
- may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
- IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
- ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF
- ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION
- TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
- MODIFICATIONS.
-*/
+// See LICENSE for license details.
package chiselTests
@@ -40,7 +12,7 @@ class BitwiseOpsSpec extends ChiselPropSpec {
class BitwiseOpsTester(w: Int, _a: Int, _b: Int) extends BasicTester {
io.done := Bool(true)
val mask = (1 << w) - 1
- val a = UInt(_a)
+ val a = UInt(_a)
val b = UInt(_b)
when(~a != UInt(mask & ~_a)) { io.error := UInt(1) }
when((a & b) != UInt(mask & (_a & _b))) { io.error := UInt(2) }
@@ -50,7 +22,7 @@ class BitwiseOpsSpec extends ChiselPropSpec {
property("All bit-wise ops should return the correct result") {
forAll(safeUIntPair) { case(w: Int, a: Int, b: Int) =>
- assert(execute{ new BitwiseOpsTester(w, a, b) })
+ assert(execute{ new BitwiseOpsTester(w, a, b) })
}
}
}
diff --git a/src/test/scala/chiselTests/BundleWire.scala b/src/test/scala/chiselTests/BundleWire.scala
index 99455608..99dc665f 100644
--- a/src/test/scala/chiselTests/BundleWire.scala
+++ b/src/test/scala/chiselTests/BundleWire.scala
@@ -1,3 +1,5 @@
+// See LICENSE for license details.
+
package chiselTests
import Chisel._
import org.scalatest._
diff --git a/src/test/scala/chiselTests/ChiselSpec.scala b/src/test/scala/chiselTests/ChiselSpec.scala
index ab9d4d62..03f057d4 100644
--- a/src/test/scala/chiselTests/ChiselSpec.scala
+++ b/src/test/scala/chiselTests/ChiselSpec.scala
@@ -1,32 +1,4 @@
-/*
- Copyright (c) 2011-2015 The Regents of the University of
- California (Regents). All Rights Reserved. Redistribution and use in
- source and binary forms, with or without modification, are permitted
- provided that the following conditions are met:
-
- * Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- two paragraphs of disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- two paragraphs of disclaimer in the documentation and/or other materials
- provided with the distribution.
- * Neither the name of the Regents nor the names of its contributors
- may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
- IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
- ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF
- ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION
- TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
- MODIFICATIONS.
-*/
+// See LICENSE for license details.
package chiselTests
@@ -43,7 +15,7 @@ class ChiselPropSpec extends PropSpec with PropertyChecks {
def popCount(n: Long) = n.toBinaryString.count(_=='1')
val smallPosInts = Gen.choose(1, 7)
- val safeUIntWidth = Gen.choose(1, 30)
+ val safeUIntWidth = Gen.choose(1, 30)
val safeUInts = Gen.choose(0, (1 << 30))
val vecSizes = Gen.choose(0, 4)
val binaryString = for(i <- Arbitrary.arbitrary[Int]) yield "b" + i.toBinaryString
diff --git a/src/test/scala/chiselTests/ComplexAssign.scala b/src/test/scala/chiselTests/ComplexAssign.scala
index 47041ddd..09743e04 100644
--- a/src/test/scala/chiselTests/ComplexAssign.scala
+++ b/src/test/scala/chiselTests/ComplexAssign.scala
@@ -1,7 +1,10 @@
+// See LICENSE for license details.
+
package chiselTests
import Chisel._
import org.scalatest._
import org.scalatest.prop._
+
import Chisel.testers.BasicTester
class Complex[T <: Data](val re: T, val im: T) extends Bundle {
@@ -37,13 +40,13 @@ class ComplexAssignSpec extends ChiselPropSpec {
val re_correct = dut.io.out.re === Mux(dut.io.e, dut.io.in.re, UInt(0))
val im_correct = dut.io.out.im === Mux(dut.io.e, dut.io.in.im, UInt(0))
when(!re_correct || !im_correct) {
- io.done := Bool(true); io.error := cnt
+ io.done := Bool(true); io.error := cnt
} .elsewhen(wrap) { io.done := Bool(true) }
}
-
+
property("All complex assignments should return the correct result") {
forAll(enSequence(4), safeUInts, safeUInts) { (en: List[Boolean], re: Int, im: Int) =>
- assert(execute{ new ComplexAssignTester(en, re, im) })
+ assert(execute{ new ComplexAssignTester(en, re, im) })
}
}
}
diff --git a/src/test/scala/chiselTests/Counter.scala b/src/test/scala/chiselTests/Counter.scala
index 90e3afa3..0e8601b3 100644
--- a/src/test/scala/chiselTests/Counter.scala
+++ b/src/test/scala/chiselTests/Counter.scala
@@ -1,3 +1,5 @@
+// See LICENSE for license details.
+
package chiselTests
import Chisel._
import org.scalatest._
@@ -21,7 +23,7 @@ class CounterSpec extends ChiselPropSpec {
val (cntEn, cntWrap) = Counter(ens(0), 32)
val cnt = Counter(32)
when(cnt.value === UInt(31)) {
- io.done := Bool(true)
+ io.done := Bool(true)
io.error := cnt.value != UInt(popCount(seed))
}
}
diff --git a/src/test/scala/chiselTests/Decoder.scala b/src/test/scala/chiselTests/Decoder.scala
index 7562ea2a..69863608 100644
--- a/src/test/scala/chiselTests/Decoder.scala
+++ b/src/test/scala/chiselTests/Decoder.scala
@@ -1,3 +1,5 @@
+// See LICENSE for license details.
+
package chiselTests
import Chisel._
import org.scalatest._
@@ -29,8 +31,8 @@ class DecoderSpec extends ChiselPropSpec {
val rnd = new scala.util.Random(seed)
val bs = seed.toBinaryString
val bp = bs.map(if(rnd.nextBoolean) _ else "?").mkString
- ("b"+bs, "b"+bp)
- }
+ ("b" + bs, "b" + bp)
+ }
def nPairs(n: Int) = Gen.containerOfN[List, (String,String)](n,bitpatPair)
property("BitPat wildcards should be usable in decoding") {
diff --git a/src/test/scala/chiselTests/Direction.scala b/src/test/scala/chiselTests/Direction.scala
index 0df035c4..dd2f6572 100644
--- a/src/test/scala/chiselTests/Direction.scala
+++ b/src/test/scala/chiselTests/Direction.scala
@@ -1,3 +1,5 @@
+// See LICENSE for license details.
+
package chiselTests
import Chisel._
@@ -30,6 +32,6 @@ class DirectionSpec extends ChiselPropSpec {
property("Inputs should not be assignable") {
elaborate(new BadDirection)
- }
+ }
}
diff --git a/src/test/scala/chiselTests/GCD.scala b/src/test/scala/chiselTests/GCD.scala
index 12499abf..48a96f0d 100644
--- a/src/test/scala/chiselTests/GCD.scala
+++ b/src/test/scala/chiselTests/GCD.scala
@@ -1,32 +1,4 @@
-/*
- Copyright (c) 2011-2015 The Regents of the University of
- California (Regents). All Rights Reserved. Redistribution and use in
- source and binary forms, with or without modification, are permitted
- provided that the following conditions are met:
-
- * Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- two paragraphs of disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- two paragraphs of disclaimer in the documentation and/or other materials
- provided with the distribution.
- * Neither the name of the Regents nor the names of its contributors
- may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
- IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
- ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF
- ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION
- TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
- MODIFICATIONS.
-*/
+// See LICENSE for license details.
package chiselTests
@@ -66,7 +38,7 @@ class GCDSpec extends ChiselPropSpec {
io.error := (dut.io.z != UInt(z)).toUInt
}
}
-
+
//TODO: use generators and this function to make z's
def gcd(a: Int, b: Int): Int = if(b == 0) a else gcd(b, a%b)
@@ -77,7 +49,7 @@ class GCDSpec extends ChiselPropSpec {
( 48, 64, 12))
property("GCD should return the correct result") {
- forAll (gcds) { (a: Int, b: Int, z: Int) =>
+ forAll (gcds) { (a: Int, b: Int, z: Int) =>
assert(execute{ new GCDTester(a, b, z) })
}
}
diff --git a/src/test/scala/chiselTests/MulLookup.scala b/src/test/scala/chiselTests/MulLookup.scala
index 1fe77a93..18dcc431 100644
--- a/src/test/scala/chiselTests/MulLookup.scala
+++ b/src/test/scala/chiselTests/MulLookup.scala
@@ -1,3 +1,5 @@
+// See LICENSE for license details.
+
package chiselTests
import Chisel._
@@ -12,7 +14,7 @@ class MulLookup(val w: Int) extends Module {
val z = UInt(OUTPUT, 2 * w)
}
val tbl = Vec(
- for {
+ for {
i <- 0 until 1 << w
j <- 0 until 1 << w
} yield UInt(i * j, 2 * w)
@@ -31,7 +33,7 @@ class MulLookupSpec extends ChiselPropSpec {
}
property("Mul lookup table should return the correct result") {
- forAll(smallPosInts, smallPosInts) { (x: Int, y: Int) =>
+ forAll(smallPosInts, smallPosInts) { (x: Int, y: Int) =>
assert(execute{ new MulLookupTester(3, x, y) })
}
}
diff --git a/src/test/scala/chiselTests/Tbl.scala b/src/test/scala/chiselTests/Tbl.scala
index 4add985e..072f993f 100644
--- a/src/test/scala/chiselTests/Tbl.scala
+++ b/src/test/scala/chiselTests/Tbl.scala
@@ -1,3 +1,5 @@
+// See LICENSE for license details.
+
package chiselTests
import Chisel._
@@ -15,7 +17,7 @@ class Tbl(w: Int, n: Int) extends Module {
}
val m = Mem(UInt(width = w), n)
io.o := m(io.ri)
- when (io.we) {
+ when (io.we) {
m(io.wi) := io.d
when(io.ri === io.wi) { io.o := io.d }
}
@@ -41,7 +43,7 @@ class TblSpec extends ChiselPropSpec {
property("All table reads should return the previous write") {
forAll(safeUIntPairN(8)) { case(w: Int, pairs: List[(Int, Int)]) =>
val (idxs, values) = pairs.unzip
- assert(execute{ new TblTester(w, 1 << w, idxs, values) })
+ assert(execute{ new TblTester(w, 1 << w, idxs, values) })
}
}
}
diff --git a/src/test/scala/chiselTests/UInt.scala b/src/test/scala/chiselTests/UInt.scala
index 8885c71f..3c5e1ab7 100644
--- a/src/test/scala/chiselTests/UInt.scala
+++ b/src/test/scala/chiselTests/UInt.scala
@@ -1,3 +1,5 @@
+// See LICENSE for license details.
+
package chiselTests
import Chisel._
@@ -8,7 +10,7 @@ import Chisel.testers.BasicTester
class GoodBoolConversion extends Module {
val io = new Bundle {
val u = UInt(1, width = 1).asInput
- val b = Bool(OUTPUT)
+ val b = Bool(OUTPUT)
}
io.b := io.u.toBool
}
@@ -16,7 +18,7 @@ class GoodBoolConversion extends Module {
class BadBoolConversion extends Module {
val io = new Bundle {
val u = UInt(1, width = 5).asInput
- val b = Bool(OUTPUT)
+ val b = Bool(OUTPUT)
}
io.b := io.u.toBool
}
@@ -28,5 +30,5 @@ class UIntSpec extends ChiselPropSpec with Matchers {
property("Bools cannot be created from >1 bit UInts") {
a [Exception] should be thrownBy { elaborate(new BadBoolConversion) }
- }
+ }
}
diff --git a/src/test/scala/chiselTests/Vec.scala b/src/test/scala/chiselTests/Vec.scala
index 145fd8f6..ea670f37 100644
--- a/src/test/scala/chiselTests/Vec.scala
+++ b/src/test/scala/chiselTests/Vec.scala
@@ -1,3 +1,5 @@
+// See LICENSE for license details.
+
package chiselTests
import Chisel._
@@ -10,7 +12,7 @@ class VecSpec extends ChiselPropSpec {
class ValueTester(w: Int, values: List[Int]) extends BasicTester {
io.done := Bool(true)
val v = Vec(values.map(UInt(_, width = w))) // TODO: does this need a Wire? Why no error?
- io.error := v.zip(values).map { case(a,b) =>
+ io.error := v.zip(values).map { case(a,b) =>
a != UInt(b)
}.foldLeft(UInt(0))(_##_)
}