Reduces CPU cycles to 2 clock cycles for faster testing/simulation
This commit is contained in:
@@ -20,7 +20,7 @@ class ZzTop(file: String = "", sim: Boolean = true) extends Module {
|
||||
val b = Output(UInt(5.W))
|
||||
})
|
||||
|
||||
val clkg = Module(new ClockGen(12, sim)) // ~ 10 MHz
|
||||
val clkg = Module(new ClockGen(2, sim)) // ~ 10 MHz
|
||||
// clock et reset sont les signaux implicites
|
||||
clkg.io.clk_in1 := clock
|
||||
clkg.io.reset := reset
|
||||
|
||||
@@ -49,10 +49,13 @@ class ZzTopAllSpec
|
||||
trace: ListBuffer[String]
|
||||
): Unit = {
|
||||
var cycles = 0
|
||||
dut.clock.step(12) // Attente d'un cycle proc (12 cycles systeme)
|
||||
val clock_per_cpucycle = 2;
|
||||
dut.clock.step(
|
||||
clock_per_cpucycle
|
||||
) // Attente d'un cycle proc (clock_per_cpu cycles systeme)
|
||||
// Attendre une écriture dans x31
|
||||
while (!dut.io.valid_x31.get.peek().litToBoolean && cycles < timeout) {
|
||||
dut.clock.step(12) // Attente d'un cycle proc
|
||||
dut.clock.step(clock_per_cpucycle) // Attente d'un cycle proc
|
||||
cycles += 1
|
||||
trace += f"Attente $cycles cycles"
|
||||
}
|
||||
|
||||
@@ -43,10 +43,13 @@ class ZzTopSpec extends AnyFreeSpec with Matchers with ChiselSim {
|
||||
trace: ListBuffer[String]
|
||||
): Unit = {
|
||||
var cycles = 0
|
||||
dut.clock.step(12) // Attente d'un cycle proc (12 cycles systeme)
|
||||
val clock_per_cpucycle = 2;
|
||||
dut.clock.step(
|
||||
clock_per_cpucycle
|
||||
) // Attente d'un cycle proc (clock_per_cpucycle cycles systeme)
|
||||
// Attendre une écriture dans x31
|
||||
while (!dut.io.valid_x31.get.peek().litToBoolean && cycles < timeout) {
|
||||
dut.clock.step(12) // Attente d'un cycle proc
|
||||
dut.clock.step(clock_per_cpucycle) // Attente d'un cycle proc
|
||||
cycles += 1
|
||||
trace += f"Attente $cycles cycles"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user