在vhdl中完成了 library ieee; use ieee.std_logic_1164.all;
package max is
function max(a,b : in std_logic_vector) return std_logic_vector;
function max(a,b : in bit_vector) return bit_vector;
function max(a,b : in integer) return integer; end;
package body max is function max(a,b : in std_logic_vector) return std_logic_vector is begin if a>b then return a; else return b; end if; end max;
function max(a,b : in integer) return integer is begin if a>b then return a; else return b; end if; end max;
function max(a,b : in bit_vector) return bit_vector is begin if a>b then return a; else return b; end if; end max; end; 但不晓得怎么用啊。它应该怎么保存啊?还是直接就在后面跟主程序了。 |