Add info to testbench debug output

This commit is contained in:
Aadi Desai 2023-05-30 12:29:18 +01:00
parent 4ac4c5266a
commit ef78c48a8a
No known key found for this signature in database

View file

@ -12,9 +12,10 @@ async def test_new_cordic(dut):
await Timer(1, units='ps')
e_sin = 32768 * (sin((cycle * pi) / (2**15)) + 1)
error = e_sin - dut.o_sin.value
if abs(error) > 4:
dut._log.info("cycle %d: expected %d, got %d, error %d"
% (cycle, e_sin, dut.o_sin.value, error))
if abs(error) > 2:
dut._log.info("cycle %5d, rev %d, inv %d, expected %5d, got %5d, error %d"
% (cycle, (cycle & 0x4000) != 0, (cycle & 0x8000) != 0, e_sin, dut.o_sin.value, error))
diff += abs(error)
dut._log.info("Testbench finished, average error %f" % (diff / 65536))