-
Notifications
You must be signed in to change notification settings - Fork 643
Open
Description
Type of issue: Bug Report
Please provide the steps to reproduce the problem:
- Put this in
build.sbt
scalaVersion := "2.13.18"
scalacOptions ++= Seq(
"-encoding", "UTF-8",
)
val chiselVersion = "7.5.0"
addCompilerPlugin("org.chipsalliance" % "chisel-plugin" % chiselVersion cross CrossVersion.full)
libraryDependencies += "org.chipsalliance" % "chisel_2.13" % chiselVersion
libraryDependencies += "org.chipsalliance" % "chisel-plugin_2.13.18" % chiselVersion- And this in
src/main/scala/Fail.scala:
import chisel3._
import chisel3.util._
import chisel3.simulator.EphemeralSimulator._
import scala.language.reflectiveCalls
object Fail extends App {
// Print test duration on pass when using simulate()
def simulate[T <: chisel3.RawModule](dut: => T)(body: (T) => Unit): Unit = {
val start = System.currentTimeMillis()
chisel3.simulator.EphemeralSimulator.simulate(dut)(body)
val end = System.currentTimeMillis()
val duration = end - start
println(s"PASS ($duration ms)")
}
class Incrementer(bitWidth: Int) extends Module {
val io = IO(new Bundle {
val a = Input(UInt(bitWidth.W))
val c = Input(Bool())
val out = Output(UInt((bitWidth+1).W))
})
io.out := Mux(io.c, io.a.zext.asUInt + 1.U, io.a.zext.asUInt)
}
def randomIncrementerTest(
bitWidth: Int,
numberOfTests: Int
): Unit = {
simulate(new Incrementer(bitWidth)) { c =>
// val rand = new scala.util.Random(987654321L)
for (i <- 1 to numberOfTests) {
val a = BigInt(1) //BigInt(bitWidth, rand)
c.io.a.poke(a.U)
c.io.c.poke(1.B)
c.io.out.expect((a+1).U((bitWidth+1).W))
c.io.c.poke(0.B)
c.io.out.expect(a.U((bitWidth+1).W))
if (i % 100 == 0) println(s"Progress $i of $numberOfTests")
}
println("Loop done.")
}
println("Success!")
}
randomIncrementerTest(8, 2802)
randomIncrementerTest(8, 2803)
}- Run
sbt run - Observe that the first call terminates successfully while the second call hangs at
Loop done..
What is the current behavior?
The simulation with 2802 inputs finishes in ~3s on my machine, the simulation with 2803 inputs hangs.
What is the expected behavior?
The simulation would take slightly longer, but would still complete within seconds.
Please tell us about your environment:
- Chisel: 7.5.0
- sbt: 1.11.4
- Java: 21.0.9
- Scala: 2.13.18
- OS: Linux 6.8.0-90-generic # 91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 14:14:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Other Information
What is the use case for changing the behavior?
Metadata
Metadata
Assignees
Labels
No labels