From 550827217c135c2236c65c4f5444e0e7f5d710cd Mon Sep 17 00:00:00 2001 From: Aadi Desai <21363892+supleed2@users.noreply.github.com> Date: Tue, 30 May 2023 14:15:44 +0100 Subject: [PATCH] Output error from expected correctly, - means low --- test_saw2sin.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test_saw2sin.py b/test_saw2sin.py index a4cac2a..e0960e6 100644 --- a/test_saw2sin.py +++ b/test_saw2sin.py @@ -11,11 +11,10 @@ async def test_new_cordic(dut): dut.i_saw.value = cycle await Timer(1, units='ps') 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: - 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)) diff += abs(error) dut._log.info("Testbench finished, average error %f" % (diff / 65536)) -