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

Commit

Permalink
ICE40Top: reimplement ubtnReset.
Browse files Browse the repository at this point in the history
  • Loading branch information
kivikakk committed May 23, 2024
1 parent 3e12771 commit 3d5f928
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/main/scala/ee/hrzn/chryse/platform/ice40/ICE40Top.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class ICE40Top[Top <: Module](
resetTimerReg := resetTimerReg + 1.U
}

var ubtn_reset: Option[Bool] = None
private val finalReset = noPrefix {
// TODO (iCE40): this no longer works. :)
if (platform.asInstanceOf[IceBreakerPlatform].ubtnReset) {
val io_ubtn = IO(Input(Bool()))
reset | ~io_ubtn
ubtn_reset = Some(Wire(Bool()))
reset | ~ubtn_reset.get
} else {
reset
}
Expand Down Expand Up @@ -75,6 +75,15 @@ class ICE40Top[Top <: Module](
clki := io

case _ =>
if (name == "ubtn" && ubtn_reset.isDefined) {
if (res.ioInst.isDefined) {
throw new Exception("ubtnReset requested but ubtn used in design")
}
ios += name -> res.pinId.get
val io = IO(res.makeIo()).suggestName(name)
ubtn_reset.get := io
}

if (res.ioInst.isDefined) {
ios += name -> res.pinId.get
val io = IO(res.makeIo()).suggestName(name)
Expand Down

0 comments on commit 3d5f928

Please sign in to comment.