blob: 3ccade8e81703a564fe439b67ed42008b7a13bc1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// See LICENSE for license details.
package chiselTests
import chisel3._
import chisel3.testers.BasicTester
//scalastyle:off magic.number
class IntegerMathTester extends BasicTester {
//TODO: Add more operators
/* absolute values tests */
val uint = 3.U(4.W)
val sint = (-3).S()
val sintpos = 3.S()
val wrongSIntPos = 4.S()
assert(uint.abs() === uint)
assert(sint.abs() === sintpos)
assert(sintpos.abs() === sintpos)
assert(sint.abs() =/= wrongSIntPos)
stop()
}
class IntegerMathSpec extends ChiselPropSpec {
property("All integer ops should return the correct result") {
assertTesterPasses{ new IntegerMathTester }
}
}
|