From 5580dc74eccffc1ce396b32b419e1dda064a81ec Mon Sep 17 00:00:00 2001 From: Mikael Henriksson <mike.zx@hotmail.com> Date: Tue, 9 May 2023 14:35:35 +0200 Subject: [PATCH] add max and min lifetime plot test, and multi-read memory variable test (closes #245) --- b_asic/resources.py | 20 ++++--- .../test_max_min_lifetime_bar_plot.png | Bin 0 -> 11016 bytes test/test_resources.py | 55 +++++++++++++++++- 3 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 test/baseline/test_max_min_lifetime_bar_plot.png diff --git a/b_asic/resources.py b/b_asic/resources.py index 208c0239..8ad13879 100644 --- a/b_asic/resources.py +++ b/b_asic/resources.py @@ -550,8 +550,8 @@ class ProcessCollection: else bar_start % self._schedule_time ) bar_end = ( - bar_end - if bar_end == self._schedule_time + self.schedule_time + if bar_end and bar_end % self._schedule_time == 0 else bar_end % self._schedule_time ) if show_markers: @@ -564,8 +564,8 @@ class ProcessCollection: ) for end_time in process.read_times: end_time = ( - end_time - if end_time == self._schedule_time + self.schedule_time + if end_time and end_time % self.schedule_time == 0 else end_time % self._schedule_time ) _ax.scatter( # type: ignore @@ -583,15 +583,19 @@ class ProcessCollection: color=_WARNING_COLOR, ) elif process.execution_time == 0: - # Execution time zero, don't draw the bar - pass + # Execution time zero, draw a slim bar + _ax.broken_barh( # type: ignore + [(PAD_L + bar_start, bar_end - bar_start - PAD_L - PAD_R)], + (bar_row + 0.55, 0.9), + color=bar_color, + ) elif bar_end > bar_start: _ax.broken_barh( # type: ignore [(PAD_L + bar_start, bar_end - bar_start - PAD_L - PAD_R)], (bar_row + 0.55, 0.9), color=bar_color, ) - else: # bar_end < bar_start + else: # bar_end <= bar_start _ax.broken_barh( # type: ignore [ ( @@ -1224,7 +1228,7 @@ class ProcessCollection: Forward-Backward Register Allocation [1]. [1]: K. Parhi: VLSI Digital Signal Processing Systems: Design and - Implementation, Ch. 6.3.2 + Implementation, Ch. 6.3.2 Parameters ---------- diff --git a/test/baseline/test_max_min_lifetime_bar_plot.png b/test/baseline/test_max_min_lifetime_bar_plot.png new file mode 100644 index 0000000000000000000000000000000000000000..1c42a415a67107e00e5aa19325c24b0e8995b4de GIT binary patch literal 11016 zcmeHtc{tST|M!O?Nu-prW-0qfk$p>+A-f^lw5S-e8~fHGQK&&8vhT}O_OXnprjTtg zB8<p3w(Ps-o^wv;d!9d@=X(D5Ug!7Eb6ptBhtK`F@AvXr-VsIy+J_lA7$FEc4A;4A z0ztH)5JW>}pa;K^>HIzhUgW(ruX>rf-tqFe;c*+%zv1O}*VXGT>gH+h+a8`MSC<Pg zS(udgX$LPaH%|pgN$0;WfVq0uOAatHgoA%_&`rnE6M|T7P(Nw%RC7@fB#MS#RyXra zo*fJbWLv4*`?V(c?QYfG`y&~r52n#6alnwzw4P<qCYj2)6;zbF?O)DSmasxOTE7(? zF?Q-G_~`kDVV7-2p5=1kk*x)x>t?5EJzRzR_!Gjd9zq;~vY6YkDZ{+a8!&DMAGS73 ztOP2pKA&lwSxDTOnW<k&`S#x3mUJ8}t@ZH|4!l6plC-BGC{${{8u-DEAryT5bOfS- zpr?EgEd-s^fc8VsxknHK1YKvMIRZfqC;$H+{9kwJ%6$@Da!W>Mp7;Dvv5~MK!MzrC z0D_WfNoa(*d5%Gff(Wc_{OU=X1*VyyI%^aPg-ihZZP3(~qS#aIX^(AL*bm-&c!>|* zm75w|(A{koQ}|ZmXvE~8&v4J18%=Bs`)gqYY5x()<tEk1u#lNy{Ix+Gx^RoD@-gH~ z&&<1eIP8+Hfx&7O#{mEH$5s`0^T)<+4P8~%lH3jpUO!N`5Thf=56>|ie&<K#1Sfj# zzjmVV1zhM-XGNrAd`}fJ;f8LR0zbU}>Iq{mtfOJ)p^$XmU3JOYW05}Hb;k`iJAE%E z^?_?wuKtQA-F``IEbcAD&=(J4b;A?N6DGs(9V~lk>_hzuY217Z!d$d2H=l0PKxEZG z6$1ai6q~VRG|gGAb=^(ke74Md&+d?dCT`3F<y8^aYrC16n|-(?E2t(b&TI-Nj+(({ znSViA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rE<}CA` zwE|~}1z`dRTr}0F1gs4VNNAF-h16Yi9V#*s9z*+mjRYdx7wQUM$+}()aEanw1}+^? zw*gV@<aDh~2eTDas{XLyPKD=$f$~DbKERhPOiVCf5ef0}h_!(Ep*pJdgr4fs1d}ef zYN7x`XjFHJt>Q-l!3n%6MO*`X{Rs^BIkN!TtD3LhT3#J+Elf*O1Hk~&tMurxV=Kk3 zL3$Xkl^zQxU}^f#RZmEJj$erpE4>YDec&slmf)rfa44{~RPO+cbsPr@1~2dYjj)P; zm~eHl>~HSO*9Fd;Jv$A?0D8CP@z-P}IHIO^)`lmxIbM$AO2DzJNL+oR#v8bB4~M3V zqv3M8U;sppYZb@j>4KX&OO;Hh4nn0<Nwrp{c8vLr8+;?}cEAnje`^=6;5{>m7Wo>@ z+CY2;980h{(@9PxRA;x4im5U(E{zgm)^O6EAg=6oJ+_vKhKQ?I^T6~O;NSsQ6P2m3 z`Fph|Pz+o}*ced&mSM6$1p!#Aadi4_qBIIaRaRcV1_I0ZuPKTaKvV7c@$pF=>}#@- zu-Uv)pLwxWK8T@YUdp`#yn#jnT2HB#XIa3Si~egROR5?%8m(9hEB?j`88)#5FYF5f zap6DnmOzD;)aZV4LZV>p<B{Ybpa>BU%YHZVQB_p5#z=e5T>YAOfsk2nH%ZFwksu0y zHYuWg`|D!&(N8iV>W`=fsn3ufkfS1j@{<8v7pGr8K5{5{<&m;!UT^+*BI!lo_Q?Zv z6<kSbxVNv|u}8Grb$E!<mBdY=`C|am^M3&B{P(2eUDfzeu~&=d$Lv5shv1q9mrE{P HzyH4g2QuVF literal 0 HcmV?d00001 diff --git a/test/test_resources.py b/test/test_resources.py index 6248c41c..6751879f 100644 --- a/test/test_resources.py +++ b/test/test_resources.py @@ -1,4 +1,3 @@ -import pickle import re import matplotlib.pyplot as plt @@ -145,3 +144,57 @@ class TestProcessCollectionPlainMemoryVariable: simple_collection.remove_process(new_proc) assert len(simple_collection) == 7 assert new_proc not in simple_collection + + @pytest.mark.mpl_image_compare(style='mpl20') + def test_max_min_lifetime_bar_plot(self): + fig, ax = plt.subplots() + collection = ProcessCollection( + { + # Process starting exactly at scheudle start + PlainMemoryVariable(0, 0, {0: 0}, "S1"), + PlainMemoryVariable(0, 0, {0: 5}, "S2"), + # Process starting somewhere between schedule start and end + PlainMemoryVariable(2, 0, {0: 0}, "M1"), + PlainMemoryVariable(2, 0, {0: 5}, "M2"), + # Process starting at the schedule end + PlainMemoryVariable(5, 0, {0: 0}, "E1"), + PlainMemoryVariable(5, 0, {0: 5}, "E2"), + }, + schedule_time=5, + ) + collection.plot(ax) + return fig + + def test_multiple_reads_exclusion_greaph(self): + # Initial collection + p0 = PlainMemoryVariable(0, 0, {0: 3}, 'P0') + p1 = PlainMemoryVariable(1, 0, {0: 2}, 'P1') + p2 = PlainMemoryVariable(2, 0, {0: 2}, 'P2') + p3 = PlainMemoryVariable(3, 0, {0: 3}, 'P3') + collection = ProcessCollection({p0, p1, p2, p3}, 5, cyclic=True) + exclusion_graph = collection.create_exclusion_graph_from_ports( + read_ports=1, + write_ports=1, + total_ports=1, + ) + for p in [p0, p1, p2, p3]: + assert p in exclusion_graph + assert exclusion_graph.degree(p0) == 2 + assert exclusion_graph.degree(p1) == 2 + assert exclusion_graph.degree(p2) == 0 + assert exclusion_graph.degree(p3) == 2 + + # Add multi-read process + p4 = PlainMemoryVariable(0, 0, {0: 1, 1: 2, 2: 3, 3: 4}, 'P4') + collection.add_process(p4) + exclusion_graph = collection.create_exclusion_graph_from_ports( + read_ports=1, + write_ports=1, + total_ports=1, + ) + for p in [p0, p1, p2, p3, p4]: + assert p in exclusion_graph + assert exclusion_graph.degree(p0) == 3 + assert exclusion_graph.degree(p1) == 3 + assert exclusion_graph.degree(p2) == 1 + assert exclusion_graph.degree(p3) == 3 -- GitLab