Skip to content

Commit

Permalink
Adding companion main class to generate GCD.v verilog source
Browse files Browse the repository at this point in the history
  • Loading branch information
Martoni committed Mar 7, 2024
1 parent 7f426ed commit a4415ab
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/scala/gcd/GCD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package gcd

import chisel3._
import circt.stage.ChiselStage

/**
* Compute GCD using subtraction method.
Expand Down Expand Up @@ -32,3 +33,14 @@ class GCD extends Module {
io.outputGCD := x
io.outputValid := y === 0.U
}

/**
* Generate Verilog sources and save it in file GCD.v
*/
object GCD extends App {
val verilog_src = ChiselStage.emitSystemVerilog(
new GCD(),
firtoolOpts = Array("-disable-all-randomization",
"-strip-debug-info"))
os.write(os.pwd / "GCD.v", verilog_src)
}

0 comments on commit a4415ab

Please sign in to comment.