chisel – Why do poked values change on last clock cycle in chiseltest, thus failing asserts?

I’ve tried adding some asserts to my code, but these asserts fail when testing my module,
even though I’ve poked the values accordingly. Interestingly, according to some prints, the value changes value in the last simulated cycle, as shown by this minimal example:

package stack_overflow_demo

import chisel3._
import chisel3.tester._
import org.scalatest.FreeSpec
import chisel3.experimental.BundleLiterals._

class AssertFail extends Module {
    val io = IO(new Bundle {
        val input = Input(UInt(2.W))

    printf("%dn", io.input) // prints 3 and then 0

    assert(io.input === 3.U) // fails, apparently on the second cycle

class AssertTest extends FreeSpec with ChiselScalatestTester {
    "break" in {
        test(new AssertFail) { dut =>

I basically want to understand why that happens and also if I can keep these asserts active in my code or if I have to remove them alltogether.

(The actual code is part of an RISC-V decoder that can not manage the “C” compressed instruction-extension, so for simulation I tried to assert the lowest two bits to be 11)

Thank you!