Macro to automatically generate harness for pymtl
Opened this issue · 2 comments
Pymtl's stream
interface takes only one input and output msg bus (recv_msg
and send_msg
). To deal with this we currently pack multiple inputs into one using a test harness. It would be nice to have some macro such that we could specify inputs using a file (test.json
for example) with a format similar to the following (for the binary operator *
):
{
"file": "src/math/multiply.v",
"module": "Multiply",
"parameters": {
"Width": 32
},
"input": {
"left": [2, 4, 6],
"right": [3, 1, 5]
},
"expect": {
"out": [6, 4, 30]
}
}
Where keys in input
refer to the input port names of the original module, and expect
is the expected outputs, with the same formatting. This could generate a pymtl test harness that uses the stream interface to do the tests automatically. Then, the user would only maybe have to write a script to generate this json
file for randomized testing.
@tomaschoi03 in case you're interested.
iverilog
's -E
flag should be pretty useful here.