def test_2_3_flip_banks(): t_len = 3 s_len = 2 input_type = ST_SSeq(s_len, ST_TSeq(t_len, 0, ST_Tombstone())) output_type = ST_TSeq(t_len, 0, ST_SSeq(s_len, ST_Tombstone())) graph = build_input_output_graph(input_type, output_type) fixed_graph = assign_banks(graph) check_banks(fixed_graph, s_len, t_len)
def test_T40_S6_T20_banks(): t_len_1 = 40 t_len_2 = 20 s_len = 6 input_type = ST_TSeq(t_len_1, 0, ST_SSeq(s_len, ST_TSeq(t_len_2, 0, ST_Tombstone()))) output_type = ST_TSeq(t_len_2, 0, ST_TSeq(t_len_1, 0, ST_SSeq(s_len, ST_Tombstone()))) graph = build_input_output_graph(input_type, output_type) fixed_graph = assign_banks(graph) check_banks(fixed_graph, s_len, t_len_1 * t_len_2)
def test_shared_sseq_2_tseq_3_1_diff_2_3_flip_banks(): no = 2 ni = 3 ii = 0 nii = 2 input_type = ST_SSeq( no, ST_TSeq(3, 1, ST_TSeq(ni, ii, ST_SSeq(nii, ST_Int())))) output_type = ST_SSeq( no, ST_TSeq(3, 1, ST_SSeq(nii, ST_TSeq(ni, ii, ST_Int())))) graph = build_input_output_graph(input_type, output_type) fixed_graph = assign_banks(graph) check_banks(fixed_graph, no * nii, (3 + 1) * (3 + 0))
def test_T2_1_S2_T2_banks(): t_len_1 = 2 i_len_1 = 1 t_len_2 = 2 s_len = 2 input_type = ST_TSeq(t_len_1, i_len_1, ST_SSeq(s_len, ST_TSeq(t_len_2, 0, ST_Tombstone()))) output_type = ST_TSeq( t_len_2, 0, ST_TSeq(t_len_1, i_len_1, ST_SSeq(s_len, ST_Tombstone()))) graph = build_input_output_graph(input_type, output_type) fixed_graph = assign_banks(graph) check_banks(fixed_graph, s_len, (t_len_1 + i_len_1) * t_len_2)
def test_different_port_widths_banks(): input_type = ST_TSeq(2, 2, ST_SSeq(2, ST_Int())) output_type = ST_SSeq(4, ST_TSeq(1, 3, ST_Int())) graph = build_input_output_graph(input_type, output_type) fixed_graph = assign_banks(graph) check_banks(fixed_graph, 4, 4)
def test_tseq_2_0_tseq_3_2_sseq_1_to_tseq_2_8_sseq_3_banks(): input_type = ST_TSeq(2, 0, ST_TSeq(3, 2, ST_SSeq(1, ST_Int()))) output_type = ST_TSeq(2, 8, ST_SSeq(3, ST_Int())) graph = build_input_output_graph(input_type, output_type) fixed_graph = assign_banks(graph) check_banks(fixed_graph, 3, 10)