Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Commit

Permalink
CxxsimTask: add build hooks.
Browse files Browse the repository at this point in the history
  • Loading branch information
kivikakk committed May 28, 2024
1 parent 51db26e commit 6d32c46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package ee.hrzn.chryse.platform.cxxrtl

import scala.sys.process._
import chisel3.experimental.ExtModule

import scala.sys.process._

final case class CXXRTLOptions(
platforms: Seq[CXXRTLPlatform],
blackboxes: Seq[Class[_ <: ExtModule]] = Seq(),
cxxFlags: Seq[String] = Seq(),
ldFlags: Seq[String] = Seq(),
pkgConfig: Seq[String] = Seq(),
buildHooks: Seq[() => Any] = Seq(),
) {
lazy val allCxxFlags: Seq[String] = cxxFlags ++ pkgConfig.flatMap(
Seq("pkg-config", "--cflags", _).!!.trim.split(' '),
Expand Down
5 changes: 4 additions & 1 deletion src/main/scala/ee/hrzn/chryse/tasks/CxxsimTask.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import chisel3._
import circt.stage.ChiselStage
import ee.hrzn.chryse.ChryseApp
import ee.hrzn.chryse.ChryseAppStepFailureException
import ee.hrzn.chryse.ExampleApp.cxxrtlOptions
import ee.hrzn.chryse.platform.Platform
import ee.hrzn.chryse.platform.cxxrtl.BlackBoxGenerator
import ee.hrzn.chryse.platform.cxxrtl.CXXRTLOptions
Expand Down Expand Up @@ -41,12 +42,14 @@ object CxxsimTask extends BaseTask {
Files.createDirectories(Paths.get(buildDir, platform.id))
if (runOptions.force) {
println(s"Cleaning build dir $buildDir/${platform.id}")
FileUtils.deleteDirectory(Paths.get(buildDir, platform.id).toFile());
FileUtils.deleteDirectory(Paths.get(buildDir, platform.id).toFile())
Files.createDirectories(Paths.get(buildDir, platform.id))
}

val name = chryse.name

appOptions.buildHooks.foreach(_())

val verilogPath = s"$buildDir/${platform.id}/$name.sv"
val verilog =
ChiselStage.emitSystemVerilog(
Expand Down

0 comments on commit 6d32c46

Please sign in to comment.