Implement Tmin
Closes #93 (closed)
Merge request reports
Activity
1688 1688 1689 1689 return Schedule(self, algorithm="ASAP").schedule_time 1690 1690 1691 def dfs(self, graph, start, end): One may consider if this should be a "private" method (starting with _) and if it possibly should not be a class method, but a function. One can, e.g., define functions inside methods.
Or do one expect that this will be used for something else? I can imagine that it can be of interest to actually return the loops, but not sure I understand exactly what this does.
1761 ] 1762 if cycles == []: 1763 return -1 1764 op_and_latency = {} 1765 for op in self.operations: 1766 for lista in cycles: 1767 for element in lista: 1768 if op.type_name() not in op_and_latency: 1769 op_and_latency[op.type_name()] = op.latency 1770 t_l_values = [] 1771 for loop in cycles: 1772 loop.pop() 1773 time_of_loop = 0 1774 number_of_t_in_loop = 0 1775 for element in loop: 1776 if ''.join([i for i in element if not i.isdigit()]) == 't': ? (or maybe this should exactly match t, right?)
One may consider using a regular expression, but not sure if that is actually better performancewise.
'^t[0-9]+'
is probably the correct expression to check.
1766 for lista in cycles: 1767 for element in lista: 1768 if op.type_name() not in op_and_latency: 1769 op_and_latency[op.type_name()] = op.latency 1770 t_l_values = [] 1771 for loop in cycles: 1772 loop.pop() 1773 time_of_loop = 0 1774 number_of_t_in_loop = 0 1775 for element in loop: 1776 if ''.join([i for i in element if not i.isdigit()]) == 't': 1777 number_of_t_in_loop += 1 1778 for key, item in op_and_latency.items(): 1779 if key in element: 1780 time_of_loop += item 1781 if number_of_t_in_loop == 0 or number_of_t_in_loop == 1: What happens if some operation do not have latency set?
In general this looks good, but it would be good to add some tests.
In
test_sfg.m
you can add something like:class TestIterationPeriodBound: def test_single_accumulator(self, sfg_simple_accumulator): assert sfg_simple_accumulator.iteration_period_bound() == 2
sfg_simple_accumulator
is what is called a fixture, an SFG which is defined intest/fixtures/signal_flow_graph.py
. Have a look there and see if there are other SFGs that can be suitable. (Not sure if this one has latency set.)mentioned in merge request !451 (merged)
Included in !451 (merged)