From d6e962d5b4df637adfb706ae18ac70bd67fe28cd Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Wed, 22 Nov 2023 08:30:39 -0600 Subject: tb: add test_mat --- tb/top/test_mat.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tb/top/test_mat.py (limited to 'tb') diff --git a/tb/top/test_mat.py b/tb/top/test_mat.py new file mode 100644 index 0000000..1531e9c --- /dev/null +++ b/tb/top/test_mat.py @@ -0,0 +1,28 @@ +from array import array +import itertools, struct, random + +import cocotb +from cocotb.clock import Clock +from cocotb.triggers import Combine, ClockCycles, FallingEdge, RisingEdge, Timer, with_timeout +from cocotb_bus.drivers import BitDriver +from cocotb_bus.drivers.avalon import AvalonMaster, AvalonMemory + +@cocotb.test() +async def fp_mat_mul(dut): + await cocotb.start(Clock(dut.clk, 2).start()) + + dut.rst_n.value = 1 + await Timer(1) + dut.rst_n.value = 0 + await Timer(1) + dut.rst_n.value = 1 + + for i in range(32): + await cmd.write(i, int.from_bytes(struct.pack('