]> jspc29.x-matter.uni-frankfurt.de Git - trbnet.git/commitdiff
added min/max functions to TrbNetStd
authorJan Michel <j.michel@gsi.de>
Wed, 2 Oct 2013 13:54:53 +0000 (15:54 +0200)
committerJan Michel <j.michel@gsi.de>
Wed, 2 Oct 2013 13:54:53 +0000 (15:54 +0200)
trb_net_std.vhd

index fda449c4c410ff965f5b327dd8a84c6461631327..58921a9569255745037111da739626c6dbc97f2f 100644 (file)
@@ -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;