Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 1 addition & 125 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,131 +13,7 @@ test-sw:
test/

test-hw:
# Activation_layers
# python3 scripts/build-components.py
python3 src/mase_components/activation_layers/test/fixed_gelu_tb.py
python3 src/mase_components/activation_layers/test/fixed_leaky_relu_tb.py
python3 src/mase_components/activation_layers/test/fixed_relu_tb.py
python3 src/mase_components/activation_layers/test/fixed_selu_tb.py
# python3 src/mase_components/activation_layers/test/fixed_sigmoid_tb.py
# python3 src/mase_components/activation_layers/test/fixed_softermax_1d_tb.py
# python3 src/mase_components/activation_layers/test/fixed_softermax_tb.py
# python3 src/mase_components/activation_layers/test/fixed_softmax_tb.py
python3 src/mase_components/activation_layers/test/fixed_softplus_tb.py
python3 src/mase_components/activation_layers/test/fixed_softsign_tb.py
python3 src/mase_components/activation_layers/test/fixed_tanh_tb.py
# python3 src/mase_components/activation_layers/test/softermax_global_norm_tb.py
# python3 src/mase_components/activation_layers/test/softermax_local_window_tb.py
# python3 src/mase_components/activation_layers/test/softermax_lpw_pow2_tb.py
# python3 src/mase_components/activation_layers/test/softermax_lpw_reciprocal_tb.py
# python3 src/mase_components/activation_layers/test/test_lint_activation_layers.py
# python3 src/mase_components/activation_layers/test/test_synth_activation_layers.py
# DEV mode (no intention to fix)
# python3 src/mase_components/activation_layers/test/fixed_elu_tb.py
# python3 src/mase_components/activation_layers/test/fixed_hardshrink_tb.py
# python3 src/mase_components/activation_layers/test/fixed_hardswish_tb.py
# python3 src/mase_components/activation_layers/test/fixed_logsigmoid_tb.py
# python3 src/mase_components/activation_layers/test/fixed_silu_tb.py
# python3 src/mase_components/activation_layers/test/fixed_softshrink_tb.py

# Cast
python3 src/mase_components/cast/test/fixed_cast_tb.py
python3 src/mase_components/cast/test/fixed_rounding_tb.py
python3 src/mase_components/cast/test/fixed_signed_cast_tb.py
# python3 src/mase_components/cast/test/fixed_unsigned_cast_tb.py

# Common
python3 src/mase_components/common/test/comparator_accumulator_tb.py
python3 src/mase_components/common/test/cut_data_tb.py
python3 src/mase_components/common/test/lut_tb.py
python3 src/mase_components/common/test/wrap_data_tb.py
# python3 src/mase_components/common/test/register_slice_tb.py
# python3 src/mase_components/common/test/test_lint_common.py
# DEV
# python3 src/mase_components/common/test/comparator_tree_tb.py
# python3 src/mase_components/common/test/single_element_repeat_tb.py

# Convolution_layers
python3 src/mase_components/convolution_layers/test/convolution_tb.py

# Inteface
python3 src/mase_components/interface/axi/test/test_lint_axi.py
# python3 src/mase_components/interface/axi/test/test_synth_axi.py

# Language models llmint8
python3 src/mase_components/language_models/llmint8/test/find_max_tb.py
python3 src/mase_components/language_models/llmint8/test/fixed_comparator_tree_layer_tb.py
python3 src/mase_components/language_models/llmint8/test/fixed_comparator_tree_tb.py
python3 src/mase_components/language_models/llmint8/test/quantized_matmul_tb.py
python3 src/mase_components/language_models/llmint8/test/quantizer_top_tb.py
python3 src/mase_components/language_models/llmint8/test/scatter_tb.py
# DEV
# python3 src/mase_components/language_models/llmint8/test/llm_int8_top_tb.py

# Linear layers
# Linear Layer - fixed_linear_layer DEBUG: use bias causes crash
python3 src/mase_components/linear_layers/fixed_linear_layer/test/fixed_linear_tb.py
# python3 src/mase_components/linear_layers/fixed_linear_layer/test/binary_activation_binary_linear_tb.py
# python3 src/mase_components/linear_layers/fixed_linear_layer/test/fixed_activation_binary_linear_tb.py
# Linear Layer - fixed_operators
python3 src/mase_components/linear_layers/fixed_operators/test/fixed_accumulator_tb.py
# python3 src/mase_components/linear_layers/fixed_operators/test/fixed_adder_tree_layer_tb.py
python3 src/mase_components/linear_layers/fixed_operators/test/fixed_adder_tree_tb.py
python3 src/mase_components/linear_layers/fixed_operators/test/fixed_dot_product_tb.py
python3 src/mase_components/linear_layers/fixed_operators/test/fixed_lut_index_tb.py
# python3 src/mase_components/linear_layers/fixed_operators/test/fixed_matmul_core_tb.py
python3 src/mase_components/linear_layers/fixed_operators/test/fixed_mult_tb.py
python3 src/mase_components/linear_layers/fixed_operators/test/fixed_range_augmentation_tb.py
# python3 src/mase_components/linear_layers/fixed_operators/test/fixed_range_reduction_tb.py
# Linear Layer - matmul
# python3 src/mase_components/linear_layers/matmul/test/chain_matmul_tb.py
# python3 src/mase_components/linear_layers/matmul/test/fixed_mamul_tb.py
# python3 src/mase_components/linear_layers/matmul/test/matmul_tb.py
# python3 src/mase_components/linear_layers/matmul/test/matrix_stream_transpose_tb.py
# python3 src/mase_components/linear_layers/matmul/test/transpose_tb.py
# DEV Linear Layer - binary_operators
python3 src/mase_components/linear_layers/binarized_operators/test/binary_activation_binary_adder_tree_layer_tb.py
# python3 src/mase_components/linear_layers/binarized_operators/test/binary_activation_binary_adder_tree_tb.py
# python3 src/mase_components/linear_layers/binarized_operators/test/binary_activation_binary_dot_product_tb.py
# python3 src/mase_components/linear_layers/binarized_operators/test/binary_activation_binary_matmul_core_tb.py
# python3 src/mase_components/linear_layers/binarized_operators/test/binary_activation_binary_mult_tb.py
# python3 src/mase_components/linear_layers/binarized_operators/test/binary_activation_binary_vector_mult_tb.py
# python3 src/mase_components/linear_layers/binarized_operators/test/fixed_activation_binary_dot_product_tb.py
# python3 src/mase_components/linear_layers/binarized_operators/test/fixed_activation_binary_mult_tb.py
# python3 src/mase_components/linear_layers/binarized_operators/test/fixed_activation_binary_vector_mult_tb.py
# python3 src/mase_components/linear_layers/binarized_operators/test/test_lint_binary_arith.py

# Memory
python3 src/mase_components/memory/test/fifo_tb.py
# python3 src/mase_components/memory/test/input_buffer_tb.py
python3 src/mase_components/memory/test/skid_buffer_tb.py
# python3 src/mase_components/memory/test/unpacked_fifo_tb.py
# python3 src/mase_components/memory/test/repeat_circular_buffer_tb.py
# python3 src/mase_components/memory/test/test_lint_memory.py

# Normalization_layers
python3 src/mase_components/normalization_layers/test/batch_norm_2d_tb.py
python3 src/mase_components/normalization_layers/test/group_norm_2d_tb.py
# DEV
# python3 src/mase_components/normalization_layers/test/channel_selection_tb.py
# python3 src/mase_components/normalization_layers/test/rms_norm_2d_tb.py
# python3 src/mase_components/normalization_layers/test/test_lint_norm.py

# Scalar operators
python3 src/mase_components/scalar_operators/fixed/test/fixed_isqrt_tb.py
python3 src/mase_components/scalar_operators/fixed/test/isqrt_sw.py
# python3 src/mase_components/scalar_operators/float/test/test_lint_float_arithmetic.py
# python3 src/mase_components/scalar_operators/fixed/test/fixed_nr_stage_tb.py
# python3 src/mase_components/scalar_operators/fixed/test/test_lint_fixed_math.py

# Systolic array
# python3 src/mase_components/systolic_arrays/test/test_lint_systolic_arrays.py

# Transformer_layers
python3 src/mase_components/transformer_layers/test/fixed_self_attention_head_tb.py
# python3 src/mase_components/transformer_layers/test/fixed_gqa_head_tb.py
# python3 src/mase_components/transformer_layers/test/fixed_self_attention_tb.py
# python3 src/mase_components/transformer_layers/test/test_lint_attention.py
time bash scripts/test-hardware.sh

reformat:
# format python files
Expand Down
146 changes: 146 additions & 0 deletions scripts/test-hardware.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
#!/usr/bin/env bash
# --------------------------------------------------------------------
# This is a script to test hardware components
# --------------------------------------------------------------------

set -o errexit
set -o pipefail
set -o nounset

# The absolute path to the directory of this script.
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
MASE=$SCRIPT_DIR/..

cd $MASE

run_test() {
echo "----------------- $1 -----------------"
time python3 $1 | (! grep " FAIL ") || exit 1
}

# Activation_layers
# run_test scripts/build-components.py
run_test src/mase_components/activation_layers/test/fixed_gelu_tb.py
run_test src/mase_components/activation_layers/test/fixed_leaky_relu_tb.py
run_test src/mase_components/activation_layers/test/fixed_relu_tb.py
run_test src/mase_components/activation_layers/test/fixed_selu_tb.py
# run_test src/mase_components/activation_layers/test/fixed_sigmoid_tb.py
# run_test src/mase_components/activation_layers/test/fixed_softermax_1d_tb.py
# run_test src/mase_components/activation_layers/test/fixed_softermax_tb.py
# run_test src/mase_components/activation_layers/test/fixed_softmax_tb.py
run_test src/mase_components/activation_layers/test/fixed_softplus_tb.py
run_test src/mase_components/activation_layers/test/fixed_softsign_tb.py
run_test src/mase_components/activation_layers/test/fixed_tanh_tb.py
# run_test src/mase_components/activation_layers/test/softermax_global_norm_tb.py
# run_test src/mase_components/activation_layers/test/softermax_local_window_tb.py
# run_test src/mase_components/activation_layers/test/softermax_lpw_pow2_tb.py
# run_test src/mase_components/activation_layers/test/softermax_lpw_reciprocal_tb.py
# run_test src/mase_components/activation_layers/test/test_lint_activation_layers.py
# run_test src/mase_components/activation_layers/test/test_synth_activation_layers.py
# DEV mode (no intention to fix)
# run_test src/mase_components/activation_layers/test/fixed_elu_tb.py
# run_test src/mase_components/activation_layers/test/fixed_hardshrink_tb.py
# run_test src/mase_components/activation_layers/test/fixed_hardswish_tb.py
# run_test src/mase_components/activation_layers/test/fixed_logsigmoid_tb.py
# run_test src/mase_components/activation_layers/test/fixed_silu_tb.py
# run_test src/mase_components/activation_layers/test/fixed_softshrink_tb.py

# Cast
run_test src/mase_components/cast/test/fixed_cast_tb.py
run_test src/mase_components/cast/test/fixed_rounding_tb.py
run_test src/mase_components/cast/test/fixed_signed_cast_tb.py
# run_test src/mase_components/cast/test/fixed_unsigned_cast_tb.py

# Common
run_test src/mase_components/common/test/comparator_accumulator_tb.py
run_test src/mase_components/common/test/cut_data_tb.py
run_test src/mase_components/common/test/lut_tb.py
run_test src/mase_components/common/test/wrap_data_tb.py
# run_test src/mase_components/common/test/register_slice_tb.py
# run_test src/mase_components/common/test/test_lint_common.py
# DEV
# run_test src/mase_components/common/test/comparator_tree_tb.py
# run_test src/mase_components/common/test/single_element_repeat_tb.py

# Convolution_layers
run_test src/mase_components/convolution_layers/test/convolution_tb.py

# Inteface
run_test src/mase_components/interface/axi/test/test_lint_axi.py
# run_test src/mase_components/interface/axi/test/test_synth_axi.py

# Language models llmint8
run_test src/mase_components/language_models/llmint8/test/find_max_tb.py
run_test src/mase_components/language_models/llmint8/test/fixed_comparator_tree_layer_tb.py
run_test src/mase_components/language_models/llmint8/test/fixed_comparator_tree_tb.py
run_test src/mase_components/language_models/llmint8/test/quantized_matmul_tb.py
run_test src/mase_components/language_models/llmint8/test/quantizer_top_tb.py
run_test src/mase_components/language_models/llmint8/test/scatter_tb.py
# DEV
# run_test src/mase_components/language_models/llmint8/test/llm_int8_top_tb.py

# Linear layers
# Linear Layer - fixed_linear_layer DEBUG: use bias causes crash
run_test src/mase_components/linear_layers/fixed_linear_layer/test/fixed_linear_tb.py
# run_test src/mase_components/linear_layers/fixed_linear_layer/test/binary_activation_binary_linear_tb.py
# run_test src/mase_components/linear_layers/fixed_linear_layer/test/fixed_activation_binary_linear_tb.py
# Linear Layer - fixed_operators
run_test src/mase_components/linear_layers/fixed_operators/test/fixed_accumulator_tb.py
# run_test src/mase_components/linear_layers/fixed_operators/test/fixed_adder_tree_layer_tb.py
run_test src/mase_components/linear_layers/fixed_operators/test/fixed_adder_tree_tb.py
run_test src/mase_components/linear_layers/fixed_operators/test/fixed_dot_product_tb.py
run_test src/mase_components/linear_layers/fixed_operators/test/fixed_lut_index_tb.py
# run_test src/mase_components/linear_layers/fixed_operators/test/fixed_matmul_core_tb.py
run_test src/mase_components/linear_layers/fixed_operators/test/fixed_mult_tb.py
run_test src/mase_components/linear_layers/fixed_operators/test/fixed_range_augmentation_tb.py
# run_test src/mase_components/linear_layers/fixed_operators/test/fixed_range_reduction_tb.py
# Linear Layer - matmul
# run_test src/mase_components/linear_layers/matmul/test/chain_matmul_tb.py
# run_test src/mase_components/linear_layers/matmul/test/fixed_mamul_tb.py
# run_test src/mase_components/linear_layers/matmul/test/matmul_tb.py
# run_test src/mase_components/linear_layers/matmul/test/matrix_stream_transpose_tb.py
# run_test src/mase_components/linear_layers/matmul/test/transpose_tb.py
# DEV Linear Layer - binary_operators
run_test src/mase_components/linear_layers/binarized_operators/test/binary_activation_binary_adder_tree_layer_tb.py
# run_test src/mase_components/linear_layers/binarized_operators/test/binary_activation_binary_adder_tree_tb.py
# run_test src/mase_components/linear_layers/binarized_operators/test/binary_activation_binary_dot_product_tb.py
# run_test src/mase_components/linear_layers/binarized_operators/test/binary_activation_binary_matmul_core_tb.py
# run_test src/mase_components/linear_layers/binarized_operators/test/binary_activation_binary_mult_tb.py
# run_test src/mase_components/linear_layers/binarized_operators/test/binary_activation_binary_vector_mult_tb.py
# run_test src/mase_components/linear_layers/binarized_operators/test/fixed_activation_binary_dot_product_tb.py
# run_test src/mase_components/linear_layers/binarized_operators/test/fixed_activation_binary_mult_tb.py
# run_test src/mase_components/linear_layers/binarized_operators/test/fixed_activation_binary_vector_mult_tb.py
# run_test src/mase_components/linear_layers/binarized_operators/test/test_lint_binary_arith.py

# Memory
run_test src/mase_components/memory/test/fifo_tb.py
# run_test src/mase_components/memory/test/input_buffer_tb.py
run_test src/mase_components/memory/test/skid_buffer_tb.py
# run_test src/mase_components/memory/test/unpacked_fifo_tb.py
# run_test src/mase_components/memory/test/repeat_circular_buffer_tb.py
# run_test src/mase_components/memory/test/test_lint_memory.py

# Normalization_layers
run_test src/mase_components/normalization_layers/test/batch_norm_2d_tb.py
run_test src/mase_components/normalization_layers/test/group_norm_2d_tb.py
# DEV
# run_test src/mase_components/normalization_layers/test/channel_selection_tb.py
# run_test src/mase_components/normalization_layers/test/rms_norm_2d_tb.py
# run_test src/mase_components/normalization_layers/test/test_lint_norm.py

# Scalar operators
run_test src/mase_components/scalar_operators/fixed/test/fixed_isqrt_tb.py
run_test src/mase_components/scalar_operators/fixed/test/isqrt_sw.py
# run_test src/mase_components/scalar_operators/float/test/test_lint_float_arithmetic.py
# run_test src/mase_components/scalar_operators/fixed/test/fixed_nr_stage_tb.py
# run_test src/mase_components/scalar_operators/fixed/test/test_lint_fixed_math.py

# Systolic array
# run_test src/mase_components/systolic_arrays/test/test_lint_systolic_arrays.py

# Transformer_layers
run_test src/mase_components/transformer_layers/test/fixed_self_attention_head_tb.py
# run_test src/mase_components/transformer_layers/test/fixed_gqa_head_tb.py
# run_test src/mase_components/transformer_layers/test/fixed_self_attention_tb.py
# run_test src/mase_components/transformer_layers/test/test_lint_attention.py

8 changes: 5 additions & 3 deletions src/mase_components/cast/test/fixed_signed_cast_tb.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,11 @@ def gen_rounding(cfg_list):
)
return l

cfg_list = [DEFAULT_CONFIG]
cfg_list = gen_width_change_configs(cfg_list)
cfg_list = gen_symmetric(cfg_list)
cfg_list = [
DEFAULT_CONFIG,
]
# cfg_list = gen_width_change_configs(cfg_list)
# cfg_list = gen_symmetric(cfg_list)
# Other rounding modes not supported yet
# cfg_list = gen_rounding(cfg_list)

Expand Down
8 changes: 5 additions & 3 deletions src/mase_components/common/test/comparator_accumulator_tb.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@ def signed_max_min_cfgs(cfglist: list):
"SIGNED": 0,
}

cfgs = [DEFAULT]
cfgs = width_cfgs(cfgs)
cfgs = depth_cfgs(cfgs)
cfgs = [
DEFAULT,
]
# cfgs = width_cfgs(cfgs)
# cfgs = depth_cfgs(cfgs)
cfgs = signed_max_min_cfgs(cfgs)

mase_runner(
Expand Down
7 changes: 5 additions & 2 deletions src/mase_components/common/test/comparator_tree_tb.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@ def signed_max_min_cfgs(cfglist: list):
"SIGNED": 0,
}

cfgs = size_cfgs([DEFAULT])
cfgs = signed_max_min_cfgs(cfgs)
cfgs = [
DEFAULT,
]
# cfgs = size_cfgs([DEFAULT])
# cfgs = signed_max_min_cfgs(cfgs)

mase_runner(
module_param_list=cfgs,
Expand Down
2 changes: 1 addition & 1 deletion src/mase_components/common/test/register_slice_tb.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from cocotb.triggers import FallingEdge
from cocotb.clock import Clock

debug = True
debug = False
logger = logging.getLogger("tb_signals")
if debug:
logger.setLevel(logging.DEBUG)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ def full_sweep():
parameter_list.append(parameters)
return parameter_list

parameter_list = full_sweep()
# parameter_list = [{"WIDTH": 7, "LUT_POW": 5}]
# parameter_list = full_sweep()
parameter_list = [{"WIDTH": 7, "LUT_POW": 5}]

mase_runner(module_param_list=parameter_list)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ def full_sweep():
parameter_list.append(parameters)
return parameter_list

parameter_list = full_sweep()
# parameter_list = [{"WIDTH": 2, "FRAC_WIDTH": 2}]
# parameter_list = full_sweep()
parameter_list = [{"WIDTH": 16, "FRAC_WIDTH": 8}]

mase_runner(module_param_list=parameter_list)

Expand Down
6 changes: 3 additions & 3 deletions src/mase_components/memory/test/fifo_tb.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ async def cocotb_test_soak(dut):
def test_fifo():
mase_runner(
module_param_list=[
{"DEPTH": 1},
{"DEPTH": 7},
# {"DEPTH": 1},
# {"DEPTH": 7},
{"DEPTH": 8},
{"DEPTH": 81},
# {"DEPTH": 81},
],
trace=True,
)
Expand Down
Loading