summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/Printf.scala
blob: 2e26dfbf285f435b4ea8e15ca2e68bc842e05611 (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
// See LICENSE for license details.

package chiselTests

import org.scalatest._
import Chisel._
import Chisel.testers.BasicTester

class SinglePrintfTester() extends BasicTester {
  val x = UInt(254)
  printf("x=%x", x)
  stop()
}

class MultiPrintfTester() extends BasicTester {
  val x = UInt(254)
  val y = UInt(255)
  printf("x=%x y=%x", x, y)
  stop()
}

class PrintfSpec extends ChiselFlatSpec {
  "A printf with a single argument" should "run" in {
    assert(execute{ new SinglePrintfTester })
  }
  "A printf with multiple arguments" should "run" in {
    assert(execute{ new MultiPrintfTester })
  }
}