附上部分程序,关键点用粗体显示。
process(clk_1k)
FUNCTION b_to_s7(bcd8421:INTEGER RANGE 0 TO 9) RETURN STD_LOGIC_VECTOR IS
VARIABLE smg7: STD_LOGIC_VECTOR(7 DOWNTO 0);
BEGIN
CASE bcd8421 IS --计算输出值
WHEN 0 => smg7:="11111100"; --abcdefgh
WHEN 1 => smg7:="01100000";
WHEN 2 => smg7:="11011010";
WHEN 3 => smg7:="11110010";
WHEN 4 => smg7:="01100110";
WHEN 5 => smg7:="10110110";
WHEN 6 => smg7:="10111110";
WHEN 7 => smg7:="11100000";
WHEN 8 => smg7:="11111110";
WHEN 9 => smg7:="11110110";
END CASE;
RETURN smg7;--定义了一个函数,b-to-s7.
END b_to_s7;
VARIABLE keys:INTEGER RANGE 0 TO 127 :=0; --消抖累加器--
begin
if clk_1k='1' then
data_o<=b_to_s7(cnt);--cnt是定义的一个整型的信号,范围是0-9;请问此处是不是函数的调用? |