From 2ab5c0c511b2907cfe0356790e840b5be9d8a11b Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Sat, 13 Apr 2024 18:11:01 +0300 Subject: [PATCH] fix(sevenseg): correctly calculate digit switch frequency --- projects/chisel-practice/src/main/scala/blinky/SevenSeg.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/chisel-practice/src/main/scala/blinky/SevenSeg.scala b/projects/chisel-practice/src/main/scala/blinky/SevenSeg.scala index bc7c3e5..a86c8dd 100644 --- a/projects/chisel-practice/src/main/scala/blinky/SevenSeg.scala +++ b/projects/chisel-practice/src/main/scala/blinky/SevenSeg.scala @@ -38,7 +38,7 @@ class SevenSegHexDisplay(numDigits: Int, digitDivideBy: Int) extends Module { ) val maxCounter: Int = digitDivideBy; - val (_, counterWrap) = Counter(true.B, digitDivideBy / 2) + val (_, counterWrap) = Counter(true.B, digitDivideBy) when(counterWrap) { currentDigit := (currentDigit + 1.U) % numDigits.asUInt @@ -85,7 +85,7 @@ class SevenSegTop( object SevenSegVerilog extends App { ChiselStage.emitSystemVerilogFile( - new SevenSegTop(4, 6, 270_000, 2_700_000, 0xffff), + new SevenSegTop(4, 6, 135_000, 2_700_000, 0xffff), args = Array("--target-dir", "generated/blinky"), firtoolOpts = Array( "--disable-all-randomization",