This is a continuation from the other question i asked : Instanciation of a class doesn't work (Chisel/Scala)
Actually, I wanna print the "result" variable. I wrote this command : sbt test, and I don't understand this error :
"chisel3.internal.ChiselException: Cannot reassign to read-only combinedTausworthe.b: OpResult[UInt<32>] "
This is the Test file
import chiseltest._
import org.scalatest.freespec.AnyFreeSpec
class combined_test extends AnyFreeSpec with ChiselScalatestTester {
"combinedTauswhore" in {
test(new combinedTausworthe() ){ c =>
//Initialisation
c.clock.step(1)
println(c.result)
c.clock.step(1)
println(c.result)
}
}
}
This is the class :
import chisel3._
class combinedTausworthe extends Module{
val io = IO(new Bundle {
})
val seed1 = RegInit(322769304.U(32.W))
val seed2 = RegInit(424235419.U(32.W))
val seed3 = RegInit(212119443.U(32.W))
var result= 0.U
var b = ((seed1 << 13)(31,0) ^ seed1)
seed1 := ((seed1 & 4294967294L.U) << 12)(31,0) ^ b
b := ((seed2 << 2)(31,0) ^ seed2) >> 25
seed2 := ((seed2 & 4294967294L.U) << 4)(31,0) ^ b
b := ((seed3<<3)(31,0) ^ seed3) >> 11
seed3 := ((seed3 & 4294967294L.U) <<17)(31,0) ^ b
result := (seed1 ^ seed2 ^ seed3)
}
object Main extends App {
}