aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/firrtlTests/Regress.scala
blob: 49c955902de40599105befc4a3d9bfd3c3016c57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package firrtlTests

import org.scalatest._

import firrtl._
import java.io._
import scala.io.Source

class RocketRegressionSpec extends FlatSpec with Matchers {

  // This test is temporary until we move to simulation-based testing
  "CHIRRTL Rocket" should "match expected Verilog" in {
    val firrtlSource = Source.fromURL(getClass.getResource("/regress/rocket.fir"))
    val highCircuit = firrtl.Parser.parse("rocket.fir", firrtlSource.getLines)
    val verilogSW = new StringWriter()
    VerilogCompiler.run(highCircuit, verilogSW)

    val goldenVerilog = Source.fromURL(getClass.getResource("/regress/rocket-golden.v"))
    
    verilogSW.toString shouldEqual goldenVerilog.mkString 
  }
}