From: Jan Michel Date: Wed, 2 Oct 2013 13:54:53 +0000 (+0200) Subject: added min/max functions to TrbNetStd X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=fb786152e952982ff9fd8484fd6c9379de227ab0;p=trbnet.git added min/max functions to TrbNetStd --- diff --git a/trb_net_std.vhd b/trb_net_std.vhd index fda449c..58921a9 100644 --- a/trb_net_std.vhd +++ b/trb_net_std.vhd @@ -172,7 +172,8 @@ package trb_net_std is function Log2( input:integer ) return integer; function count_ones( input:std_logic_vector ) return integer; - + function minimum (LEFT, RIGHT: INTEGER) return INTEGER; + function maximum (LEFT, RIGHT: INTEGER) return INTEGER; end package trb_net_std; @@ -302,6 +303,20 @@ package body trb_net_std is return conv_integer(temp); end function count_ones; - + +function minimum (LEFT, RIGHT: INTEGER) return INTEGER is + begin + if LEFT < RIGHT then return LEFT; + else return RIGHT; + end if; + end function; + +function maximum (LEFT, RIGHT: INTEGER) return INTEGER is + begin + if LEFT > RIGHT then return LEFT; + else return RIGHT; + end if; + end function; + end package body trb_net_std;