mirror of
https://github.com/supleed2/cordic.git
synced 2024-12-22 13:45:50 +00:00
Output error from expected correctly, - means low
This commit is contained in:
parent
bbf9bf3f0c
commit
550827217c
|
@ -11,11 +11,10 @@ async def test_new_cordic(dut):
|
||||||
dut.i_saw.value = cycle
|
dut.i_saw.value = cycle
|
||||||
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 = float(dut.o_sin.value) - e_sin
|
||||||
if abs(error) > 2:
|
if abs(error) > 2:
|
||||||
dut._log.info("cycle %5d, rev %d, inv %d, expected %5d, got %5d, error %d"
|
dut._log.info("cycle %5d, rev %d, inv %d, expected %5d, got %5d, error %+.6f"
|
||||||
% (cycle, (cycle & 0x4000) != 0, (cycle & 0x8000) != 0, 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