VHDL还可以做函数,呵呵。以前做些简单的逻辑电路,还真没见过做函数的。下面的程序对吗?Function filter(reg : std_logic_vector; clr,d : std_logic)
return std_logic_vector is
variable rg : std_logic_vector(1 downto 0);
Begin
if clr = '1' then
return "00";
end if;
rg := reg;
if d = '1' then
rg := not rg(0) & rg(1);
end if;
return rg;
End filter;