test case update

This commit is contained in:
joshua
2024-03-28 13:04:02 -07:00
parent 08d7721e11
commit d8f9359fae
4 changed files with 15 additions and 11 deletions

View File

@@ -35,7 +35,7 @@ SRCS += $(DPI_DIR)/float_dpi.cpp
SRCS += $(SIM_DIR)/common/rvfloats.cpp
SRCS += ./main.cpp
RTL_SRCS += $(RTL_DIR)/fpu/VX_tensor_core.sv
RTL_SRCS += $(RTL_DIR)/fpu/VX_tensor_dpu.sv
RTL_SRCS += $(RTL_DIR)/fpu/VX_tensor_tb.sv
TOP = VX_tensor_tb

View File

@@ -33,7 +33,7 @@ $(PROJECT).dump: $(PROJECT).elf
$(PROJECT).bin: $(PROJECT).elf
$(CP) -O binary $(PROJECT).elf $(PROJECT).bin
$(PROJECT).elf: $(SRCS)
$(PROJECT).elf: $(SRCS) $(DEPS)
$(CC) $(CFLAGS) $(SRCS) $(LDFLAGS) -o $(PROJECT).elf
run-rtlsim: $(PROJECT).bin

View File

@@ -86,8 +86,9 @@ expected_A = expected['A_array']
expected_B = expected['B_array']
expected_C = expected['C_array']
expected_C = expected_C + expected_A @ expected_B
print(expected_C - C_array)
print(expected_C[0:8, 0:8])
print(C_array[0:8, 0:8])
print((expected_C - C_array)[0:8, 0:8])
assert np.allclose(expected_A, A_array)
assert np.allclose(expected_B, B_array)

View File

@@ -1,12 +1,15 @@
import numpy as np
# A_array = np.random.rand(16, 8)
# B_array = np.random.rand(8, 16)
A_array = np.zeros((16, 8))
B_array = np.zeros((8, 16))
A_array[0,:] = 1.0
B_array[:,0] = 1.0
A_array = np.random.rand(16, 8)
B_array = np.random.rand(8, 16)
C_array = np.random.rand(16, 16)
# A_array = np.zeros((16, 8))
# B_array = np.zeros((8, 16))
# A_array[0,:] = 1.0
# B_array[:,4] = 1.0
# C_array = np.zeros((16, 16))
# for i in range(16):
# for j in range(16):
# C_array[i,j] = i * 16 + j
with open('a_matrix.h', 'w') as f:
for i in range(A_array.shape[0]):