//Compile the simulatorvalcompiled=SimConfig.withWave.allOptimisation.compile(rtl=newStreamFifo(dataType=Bits(32bits),depth=32))//Run the simulationcompiled.doSimUntilVoid{dut=>valqueueModel=mutable.Queue[Long]()dut.clockDomain.forkStimulus(period=10)SimTimeout(1000000*10)//Push data randomly and fill the queueModel with pushed transactionsvalpushThread=fork{dut.io.push.valid#=falsewhile(true){dut.io.push.valid.randomize()dut.io.push.payload.randomize()dut.clockDomain.waitSampling()if(dut.io.push.valid.toBoolean&&dut.io.push.ready.toBoolean){queueModel.enqueue(dut.io.push.payload.toLong)}}}//Pop data randomly and check that it match with the queueModelvalpopThread=fork{dut.io.pop.ready#=truefor(i<-0until100000){dut.io.pop.ready.randomize()dut.clockDomain.waitSampling()if(dut.io.pop.valid.toBoolean&&dut.io.pop.ready.toBoolean){assert(dut.io.pop.payload.toLong==queueModel.dequeue())}}simSuccess()}}