What is the proper way to test a Chisel function not part of a Module that generates hardware constructs?
object Util {
def getSquare(vec2d: Vec[Vec[Bool]]) : Seq[Seq[Bool]] = {
val size = vec2d.size max vec2d(0).size
return Seq.fill(size, size) {Wire(Bool())}
}
}
How can I test this function? Because it isn't a Module, the standard Chisel test format complains.
In general you can only use code that generates chisel hardware constructs within a Module (literals are an exception). So the typical methodology would be to write a wrapper and see that the generated code contains what you expect. For example here's a little test of your function
You can also test your wrapper function with the chiseltest basic test harness, for example: