mirror of
https://github.com/supleed2/cordic.git
synced 2024-12-22 21:55:50 +00:00
Add info to testbench debug output
This commit is contained in:
parent
4ac4c5266a
commit
ef78c48a8a
|
@ -12,9 +12,10 @@ async def test_new_cordic(dut):
|
||||||
await Timer(1, units='ps')
|
await Timer(1, units='ps')
|
||||||
e_sin = 32768 * (sin((cycle * pi) / (2**15)) + 1)
|
e_sin = 32768 * (sin((cycle * pi) / (2**15)) + 1)
|
||||||
error = e_sin - dut.o_sin.value
|
error = e_sin - dut.o_sin.value
|
||||||
if abs(error) > 4:
|
if abs(error) > 2:
|
||||||
dut._log.info("cycle %d: expected %d, got %d, error %d"
|
dut._log.info("cycle %5d, rev %d, inv %d, expected %5d, got %5d, error %d"
|
||||||
% (cycle, e_sin, dut.o_sin.value, error))
|
% (cycle, (cycle & 0x4000) != 0, (cycle & 0x8000) != 0, e_sin, dut.o_sin.value, error))
|
||||||
diff += abs(error)
|
diff += abs(error)
|
||||||
|
|
||||||
dut._log.info("Testbench finished, average error %f" % (diff / 65536))
|
dut._log.info("Testbench finished, average error %f" % (diff / 65536))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue