Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update in light of annotations refactor. #191

Merged
merged 2 commits into from
Mar 1, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/main/scala/chisel3/iotesters/ChiselMain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,10 @@ object chiselMain {
(new firrtl.LowFirrtlEmitter).emit(firrtl.CircuitState(chirrtl, firrtl.ChirrtlForm), writer)
writer.close()
case _ if context.isGenVerilog =>
val annotations = firrtl.AnnotationMap(Seq(
firrtl.passes.memlib.InferReadWriteAnnotation(name)))
val annotations = Seq(firrtl.passes.memlib.InferReadWriteAnnotation)
val writer = new FileWriter(verilogFile)
val compileResult = (new firrtl.VerilogCompiler).compileAndEmit(
firrtl.CircuitState(chirrtl, firrtl.ChirrtlForm, Some(annotations)),
firrtl.CircuitState(chirrtl, firrtl.ChirrtlForm, annotations),
List(new firrtl.passes.memlib.InferReadWrite)
)
writer.write(compileResult.getEmittedCircuit.value)
Expand Down
10 changes: 5 additions & 5 deletions src/main/scala/chisel3/iotesters/VCSBackend.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import chisel3.core.{ActualDirection, DataMirror}
import chisel3.{ChiselExecutionFailure, ChiselExecutionSuccess}
import firrtl.{ChirrtlForm, CircuitState}
import firrtl.annotations.CircuitName
import firrtl.transforms.{BlackBoxSourceHelper, BlackBoxTargetDir}
import firrtl.transforms.{BlackBoxSourceHelper, BlackBoxTargetDirAnno}

/**
* Copies the necessary header files used for verilator compilation to the specified destination folder
Expand Down Expand Up @@ -136,13 +136,13 @@ private[iotesters] object setupVCSBackend {
The following block adds an annotation that tells the black box helper where the
current build directory is, so that it can copy verilog resource files into the right place
*/
val annotationMap = firrtl.AnnotationMap(optionsManager.firrtlOptions.annotations ++ List(
val annotations = optionsManager.firrtlOptions.annotations ++ List(
firrtl.annotations.Annotation(
CircuitName(circuit.name),
classOf[BlackBoxSourceHelper],
BlackBoxTargetDir(optionsManager.targetDirName).serialize
BlackBoxTargetDirAnno(optionsManager.targetDirName).serialize
)
))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using firrtl.annotations.Annotation(....) (which is deprecated), you can just use the BlackBoxTargetDirAnno, ie.

val annotations = optionsManager.firrtlOptions.annotations ++
  List(BlackBoxTargetDirAnno(optionsManager.targetDirName))

)

val transforms = optionsManager.firrtlOptions.customTransforms

Expand All @@ -151,7 +151,7 @@ private[iotesters] object setupVCSBackend {
val verilogWriter = new FileWriter(verilogFile)

val compileResult = (new firrtl.VerilogCompiler).compileAndEmit(
CircuitState(chirrtl, ChirrtlForm, Some(annotationMap)),
CircuitState(chirrtl, ChirrtlForm, annotations),
customTransforms = transforms
)
val compiledStuff = compileResult.getEmittedCircuit
Expand Down
10 changes: 5 additions & 5 deletions src/main/scala/chisel3/iotesters/VerilatorBackend.scala
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ private[iotesters] object setupVerilatorBackend {
The following block adds an annotation that tells the black box helper where the
current build directory is, so that it can copy verilog resource files into the right place
*/
val annotationMap = firrtl.AnnotationMap(optionsManager.firrtlOptions.annotations ++ List(
val annotations = optionsManager.firrtlOptions.annotations ++ List(
firrtl.annotations.Annotation(
CircuitName(circuit.name),
classOf[BlackBoxSourceHelper],
BlackBoxTargetDir(optionsManager.targetDirName).serialize
BlackBoxTargetDirAnno(optionsManager.targetDirName).serialize
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the above

)
))
)

val transforms = optionsManager.firrtlOptions.customTransforms

Expand All @@ -232,7 +232,7 @@ private[iotesters] object setupVerilatorBackend {
val verilogWriter = new FileWriter(verilogFile)

val compileResult = (new firrtl.VerilogCompiler).compileAndEmit(
CircuitState(chirrtl, ChirrtlForm, Some(annotationMap)),
CircuitState(chirrtl, ChirrtlForm, annotations),
customTransforms = transforms
)
val compiledStuff = compileResult.getEmittedCircuit
Expand All @@ -245,7 +245,7 @@ private[iotesters] object setupVerilatorBackend {
val cppHarnessWriter = new FileWriter(cppHarnessFile)
val vcdFile = new File(dir, s"${circuit.name}.vcd")
val emittedStuff = VerilatorCppHarnessGenerator.codeGen(
dut, CircuitState(chirrtl, ChirrtlForm, Some(annotationMap)), vcdFile.toString
dut, CircuitState(chirrtl, ChirrtlForm, annotations), vcdFile.toString
)
cppHarnessWriter.append(emittedStuff)
cppHarnessWriter.close()
Expand Down