Skip to content

Commit c4009dd

Browse files
committed
Merge branch 'master' into 1.1.1
2 parents 15d6836 + fe8f9d0 commit c4009dd

12 files changed

+99
-79
lines changed

.travis.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ env:
1414
INSTALL_DIR=$TRAVIS_BUILD_DIR/install
1515
VERILATOR_ROOT=$INSTALL_DIR
1616
PATH=$PATH:$VERILATOR_ROOT/bin:$TRAVIS_BUILD_DIR/utils/bin
17+
CHISEL3=3.1.1
18+
CHISEL_TESTERS=1.2.1
1719

1820
install:
1921
# Install dependencies
2022
- bash .install_verilator.sh
2123
- verilator --version
2224

2325
script:
24-
- sbt test | sed '/info/,+1 d'
26+
- set -o pipefail && sbt -Dchisel3Version=$CHISEL3 -Dchisel-iotestersVersion=$CHISEL_TESTERS test
2527

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,6 @@ Some useful typeclasses:
180180

181181
----------
182182

183-
This code is maintained by [Chick](https://github.com/chick) [Angie](https://github.com/shunshou) and [Paul](https://github.com/grebe). Let us know if you have any questions/feedback!
183+
This code is maintained by [Chick](https://github.com/chick), [Angie](https://github.com/shunshou) and [Paul](https://github.com/grebe). Let us know if you have any questions/feedback!
184184

185185
Copyright (c) 2015 - 2016 The Regents of the University of California. Released under the Modified (3-clause) BSD license.

build.sbt

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ name := "dsptools"
3636

3737
organization := "edu.berkeley.cs"
3838

39-
version := "1.1.0"
39+
version := "1.1.1"
4040

4141
scalaVersion := "2.11.12"
4242

@@ -55,8 +55,8 @@ scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature", "-language:refle
5555

5656
// Provide a managed dependency on X if -DXVersion="" is supplied on the command line.
5757
val defaultVersions = Map(
58-
"chisel3" -> "3.1.0",
59-
"chisel-iotesters" -> "1.2.0"
58+
"chisel3" -> "3.1.1",
59+
"chisel-iotesters" -> "1.2.1"
6060
)
6161

6262
libraryDependencies ++= Seq(
@@ -67,7 +67,7 @@ libraryDependencies ++= Seq(
6767
)
6868

6969
javacOptions ++= javacOptionsVersion(scalaVersion.value)
70-
70+
7171
publishMavenStyle := true
7272

7373
publishArtifact in Test := false

src/main/scala/dsptools/numbers/blackbox_compatibility/DspRealFirrtlInterpBB.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ abstract class DspRealTwoArgumentToDouble extends BlackBoxImplementation {
1818

1919
def outputDependencies(outputName: String): Seq[(String)] = {
2020
outputName match {
21-
case "out" => Seq(fullName("in1"), fullName("in2"))
21+
case "out" => Seq("in1", "in2")
2222
case _ => Seq.empty
2323
}
2424
}
@@ -44,7 +44,7 @@ abstract class DspRealOneArgumentToDouble extends BlackBoxImplementation {
4444

4545
def outputDependencies(outputName: String): Seq[(String)] = {
4646
outputName match {
47-
case "out" => Seq(fullName("in"))
47+
case "out" => Seq("in")
4848
case _ => Seq.empty
4949
}
5050
}
@@ -70,7 +70,7 @@ abstract class DspRealTwoArgumentToBoolean extends BlackBoxImplementation {
7070

7171
def outputDependencies(outputName: String): Seq[(String)] = {
7272
outputName match {
73-
case "out" => Seq(fullName("in1"), fullName("in2"))
73+
case "out" => Seq("in1", "in2")
7474
case _ => Seq.empty
7575
}
7676
}
@@ -220,7 +220,7 @@ class DspRealATanh(val name: String) extends DspRealOneArgumentToDouble {
220220
class DspRealToInt(val name: String) extends BlackBoxImplementation {
221221
def outputDependencies(outputName: String): Seq[(String)] = {
222222
outputName match {
223-
case "out" => Seq(fullName("in"))
223+
case "out" => Seq("in")
224224
case _ => Seq.empty
225225
}
226226
}
@@ -235,7 +235,7 @@ class DspRealToInt(val name: String) extends BlackBoxImplementation {
235235
class DspRealFromInt(val name: String) extends BlackBoxImplementation {
236236
def outputDependencies(outputName: String): Seq[(String)] = {
237237
outputName match {
238-
case "out" => Seq(fullName("in"))
238+
case "out" => Seq("in")
239239
case _ => Seq.empty
240240
}
241241
}

src/main/scala/dsptools/numbers/chisel_types/DspRealTypeClass.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ trait BinaryRepresentationDspReal extends BinaryRepresentation[DspReal] with has
102102
def shl(a: DspReal, n: UInt): DspReal = {
103103
require(n.widthKnown, "n Width must be known for shl with DspReal")
104104
val max = (1 << n.getWidth) - 1
105-
val lut = Vec((0 to max).map(x => DspReal(math.pow(2, x))))
105+
val lut = VecInit((0 to max).map(x => DspReal(math.pow(2, x))))
106106
a * lut(n)
107107
}
108108
// mul2 consistent with shl

src/main/scala/dsptools/tester/DspTester.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class DspTester[T <: Module](
197197
}
198198
// UInt + SInt = Bits
199199
case _: Bits => (bi.doubleValue, bi)
200-
case _ => throw DspException("Peeked node ${getName(node)} has incorrect type ${node.getClass.getName}")
200+
case _ => throw DspException(s"Peeked node ${getName(node)} has incorrect type ${node.getClass.getName}")
201201
}
202202
if (dispDsp) logger info s" PEEK ${getName(node)} -> $dblOut, ${bitInfo(node)}"
203203
(dblOut, bigIntOut)

src/test/scala/dsptools/ShiftRegisterDelaySpec.scala

+13-9
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,12 @@ class CircuitWithDelaysTester[T <: Data : Signed](c: AbsCircuitWithDelays[T]) ex
6767
}
6868
}
6969

70-
reset()
71-
poke(c.io.in, 0.0)
72-
step(10)
73-
oneTest()
70+
updatableDspVerbose.withValue(false) {
71+
reset()
72+
poke(c.io.in, 0.0)
73+
step(10)
74+
oneTest()
75+
}
7476
}
7577

7678
class CeilTruncateTester(c: CeilTruncateCircuitWithDelays) extends DspTester(c) {
@@ -101,11 +103,13 @@ class CeilTruncateTester(c: CeilTruncateCircuitWithDelays) extends DspTester(c)
101103
}
102104
}
103105

104-
poke(c.io.inFixed, 0.0)
105-
poke(c.io.inReal, 0.0)
106-
reset()
107-
step(10)
108-
oneTest(c.io.inFixed, c.io.outFixedCeil, c.io.inReal, c.io.outRealCeil, delaySize)
106+
updatableDspVerbose.withValue(false) {
107+
poke(c.io.inFixed, 0.0)
108+
poke(c.io.inReal, 0.0)
109+
reset()
110+
step(10)
111+
oneTest(c.io.inFixed, c.io.outFixedCeil, c.io.inReal, c.io.outRealCeil, delaySize)
112+
}
109113
}
110114

111115
class ShiftRegisterDelaySpec extends FreeSpec with Matchers {

src/test/scala/dsptools/VerboseDspTesterSpec/SimpleTBwGenTypeOption.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ case class TestParams(
7979
}
8080

8181
class DataTypeBundle[R <: Data:Real](genType: R, dataWidth: Width, binaryPoint: BinaryPoint) extends Bundle {
82-
val gen = genType.chiselCloneType
82+
val gen = genType.cloneType
8383
val s = SInt(dataWidth)
8484
val f = FixedPoint(dataWidth, binaryPoint)
8585
val u = UInt(dataWidth)
@@ -338,7 +338,7 @@ object TestSetup {
338338
dspTesterOptions = DspTesterOptions(
339339
fixTolLSBs = 1,
340340
genVerilogTb = false,
341-
isVerbose = true)
341+
isVerbose = false)
342342
testerOptions = testerOptionsGlobal
343343
}
344344

src/test/scala/dsptools/numbers/FixedPointSpec.scala

+41-33
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@ class FixedRing1(val width: Int, val binaryPoint: Int) extends Module {
2929

3030
class FixedRing1Tester(c: FixedRing1) extends DspTester(c) {
3131
val increment: Double = if(c.binaryPoint == 0) 1.0 else 1.0 / (1 << c.binaryPoint)
32-
for(i <- -2.0 to 3.0 by increment) {
33-
poke(c.io.in, i)
34-
35-
expect(c.io.floor, breeze.numerics.floor(i), s"floor of $i should be ${breeze.numerics.floor(i)}")
36-
expect(c.io.ceil, breeze.numerics.ceil(i), s"ceil of $i should be ${breeze.numerics.ceil(i)}")
37-
expect(c.io.isWhole, breeze.numerics.floor(i) == i , s"isWhole of $i should be ${breeze.numerics.floor(i) == i}")
38-
expect(c.io.round, breeze.numerics.round(i), s"round of $i should be ${breeze.numerics.round(i)}")
39-
step(1)
32+
updatableDspVerbose.withValue(false) {
33+
for(i <- -2.0 to 3.0 by increment) {
34+
poke(c.io.in, i)
35+
36+
expect(c.io.floor, breeze.numerics.floor(i), s"floor of $i should be ${breeze.numerics.floor(i)}")
37+
expect(c.io.ceil, breeze.numerics.ceil(i), s"ceil of $i should be ${breeze.numerics.ceil(i)}")
38+
expect(c.io.isWhole, breeze.numerics.floor(i) == i , s"isWhole of $i should be ${breeze.numerics.floor(i) == i}")
39+
expect(c.io.round, breeze.numerics.round(i), s"round of $i should be ${breeze.numerics.round(i)}")
40+
step(1)
41+
}
4042
}
4143
}
4244

@@ -95,34 +97,38 @@ class FixedPointShiftTester(c: FixedPointShifter) extends DspTester(c) {
9597
val z = y / factor
9698
z
9799
}
98-
poke(c.io.dynamicShiftValue, 0)
100+
updatableDspVerbose.withValue(false) {
99101

100-
private val (minSIntValue, maxSIntValue) = firrtl_interpreter.extremaOfSIntOfWidth(c.width)
102+
poke(c.io.dynamicShiftValue, 0)
101103

102-
private val minValue = minSIntValue.toDouble * increment
103-
private val maxValue = maxSIntValue.toDouble * increment
104+
val (minSIntValue, maxSIntValue) = firrtl_interpreter.extremaOfSIntOfWidth(c.width)
104105

105-
for(value <- minValue to maxValue by increment) {
106-
poke(c.io.inValue, value)
107-
expect(c.io.shiftLeftResult, expectedValue(value, left = true, c.fixedShiftSize),
108-
s"shift left ${c.fixedShiftSize} of $value should be ${expectedValue(value, left = true, c.fixedShiftSize)}")
109-
c.io.shiftRightResult.foreach { sro =>
110-
expect(sro, expectedValue(value, left = false, c.fixedShiftSize),
111-
s"shift right ${c.fixedShiftSize} of $value should be ${expectedValue(value, left = false, c.fixedShiftSize)}")
112-
}
106+
val minValue = minSIntValue.toDouble * increment
107+
val maxValue = maxSIntValue.toDouble * increment
113108

114-
step(1)
109+
for(value <- minValue to maxValue by increment) {
110+
poke(c.io.inValue, value)
111+
expect(c.io.shiftLeftResult, expectedValue(value, left = true, c.fixedShiftSize),
112+
s"shift left ${c.fixedShiftSize} of $value should be ${expectedValue(value, left = true, c.fixedShiftSize)}")
113+
c.io.shiftRightResult.foreach { sro =>
114+
expect(sro, expectedValue(value, left = false, c.fixedShiftSize),
115+
s"shift right ${c.fixedShiftSize} of $value should be ${expectedValue(value, left = false, c.fixedShiftSize)}")
116+
}
115117

116-
for(dynamicShiftValue <- 0 until c.width) {
117-
poke(c.io.dynamicShiftValue, dynamicShiftValue)
118118
step(1)
119-
expect(c.io.dynamicShiftLeftResult, expectedValue(value, left = true, dynamicShiftValue),
120-
s"dynamic shift left $dynamicShiftValue of $value should " +
121-
s"be ${expectedValue(value, left = true, dynamicShiftValue)}")
122-
expect(c.io.dynamicShiftRightResult, expectedValue(value, left = false, dynamicShiftValue),
123-
s"dynamic shift right $dynamicShiftValue of $value should" +
124-
s"be ${expectedValue(value, left = false, dynamicShiftValue)}")
119+
120+
for(dynamicShiftValue <- 0 until c.width) {
121+
poke(c.io.dynamicShiftValue, dynamicShiftValue)
122+
step(1)
123+
expect(c.io.dynamicShiftLeftResult, expectedValue(value, left = true, dynamicShiftValue),
124+
s"dynamic shift left $dynamicShiftValue of $value should " +
125+
s"be ${expectedValue(value, left = true, dynamicShiftValue)}")
126+
expect(c.io.dynamicShiftRightResult, expectedValue(value, left = false, dynamicShiftValue),
127+
s"dynamic shift right $dynamicShiftValue of $value should" +
128+
s"be ${expectedValue(value, left = false, dynamicShiftValue)}")
129+
}
125130
}
131+
126132
}
127133
}
128134

@@ -138,10 +144,12 @@ class BrokenShifter(n: Int) extends Module {
138144
}
139145

140146
class BrokenShifterTester(c: BrokenShifter) extends DspTester(c) {
141-
poke(c.io.i, 1.5)
142-
peek(c.io.o)
143-
poke(c.io.si, 6)
144-
peek(c.io.so)
147+
updatableDspVerbose.withValue(false) {
148+
poke(c.io.i, 1.5)
149+
peek(c.io.o)
150+
poke(c.io.si, 6)
151+
peek(c.io.so)
152+
}
145153
}
146154

147155
class FixedPointSpec extends FreeSpec with Matchers {

src/test/scala/dsptools/numbers/ParameterizedOpSpec.scala

+14-10
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ class ParameterizedOpTester[T<:Data:Ring](c: ParameterizedNumberOperation[T]) ex
5050
case "*" => i * j
5151
case _ => i + j
5252
}
53-
poke(c.io.a1, i)
54-
poke(c.io.a2, j)
55-
step(1)
53+
updatableDspVerbose.withValue(false) {
54+
poke(c.io.a1, i)
55+
poke(c.io.a2, j)
56+
step(1)
5657

57-
val result = peek(c.io.c)
58+
val result = peek(c.io.c)
5859

59-
expect(c.io.c, expected, s"$i ${c.op} $j => $result, should have been $expected")
60+
expect(c.io.c, expected, s"$i ${c.op} $j => $result, should have been $expected")
61+
}
6062
}
6163
}
6264

@@ -110,13 +112,15 @@ class ComplexOpTester[T<:DspComplex[_]](c: ParameterizedNumberOperation[T]) exte
110112
case "*" => c1 * c2
111113
case _ => c1 + c2
112114
}
113-
poke(c.io.a1, c1)
114-
poke(c.io.a2, c2)
115-
step(1)
115+
updatableDspVerbose.withValue(false) {
116+
poke(c.io.a1, c1)
117+
poke(c.io.a2, c2)
118+
step(1)
116119

117-
val result = peek(c.io.c)
120+
val result = peek(c.io.c)
118121

119-
expect(c.io.c, expected, s"$i ${c.op} $j => $result, should have been $expected")
122+
expect(c.io.c, expected, s"$i ${c.op} $j => $result, should have been $expected")
123+
}
120124
}
121125
}
122126

src/test/scala/examples/ParameterizedAdderSpec.scala

+13-11
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,19 @@ class ParameterizedAdder[T <: Data:Ring](gen:() => T) extends Module {
2525
}
2626

2727
class ParameterizedAdderTester[T<:Data:Ring](c: ParameterizedAdder[T]) extends DspTester(c) {
28-
for {
29-
i <- -2.0 to 1.0 by 0.25
30-
j <- -2.0 to 4.0 by 0.5
31-
} {
32-
poke(c.io.a1, i)
33-
poke(c.io.a2, j)
34-
step(1)
35-
36-
val result = peek(c.io.c)
37-
38-
expect(c.io.c, i + j, s"parameterize adder tester $i + $j => $result should have been ${i + j}")
28+
updatableDspVerbose.withValue(false) {
29+
for {
30+
i <- -2.0 to 1.0 by 0.25
31+
j <- -2.0 to 4.0 by 0.5
32+
} {
33+
poke(c.io.a1, i)
34+
poke(c.io.a2, j)
35+
step(1)
36+
37+
val result = peek(c.io.c)
38+
39+
expect(c.io.c, i + j, s"parameterize adder tester $i + $j => $result should have been ${i + j}")
40+
}
3941
}
4042
}
4143

src/test/scala/examples/TransposedStreamFIRSpec.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class TransposedStreamFIRSpec extends FlatSpec with Matchers {
6161
"ConstantTapTransposedStreamingFIR" should "compute a running average like thing" in {
6262
val taps = 0 until 3
6363

64-
chisel3.iotesters.Driver.execute(Array("--is-verbose"),
64+
chisel3.iotesters.Driver.execute(Array[String](),
6565
() => new ConstantTapTransposedStreamingFIR(SInt(10.W), SInt(16.W), taps)) {
6666
c => new ConstantTapTransposedStreamingTester(c)
6767
} should be (true)

0 commit comments

Comments
 (0)