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

Commit

Permalink
add sample top module
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaKarvandi committed Feb 23, 2024
1 parent f05e45d commit 6f5a6c9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 130 deletions.
73 changes: 0 additions & 73 deletions src/main/scala/gcd/DecoupledGCD.scala

This file was deleted.

57 changes: 0 additions & 57 deletions src/main/scala/gcd/GCD.scala

This file was deleted.

28 changes: 28 additions & 0 deletions src/main/scala/top.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package hwdbg

import chisel3._
import chisel3.util.Counter
import circt.stage.ChiselStage

class Blinky(freq: Int, startOn: Boolean = false) extends Module {
val io = IO(new Bundle {
val led0 = Output(Bool())
})
// Blink LED every second using Chisel built-in util.Counter
val led = RegInit(startOn.B)
val (_, counterWrap) = Counter(true.B, freq / 2)
when(counterWrap) {
led := ~led
}
io.led0 := led
}

object Main extends App {
// These lines generate the Verilog output
println(
ChiselStage.emitSystemVerilog(
new Blinky(1000),
firtoolOpts = Array("-disable-all-randomization", "-strip-debug-info")
)
)
}

0 comments on commit 6f5a6c9

Please sign in to comment.