--正弦波、三角波、锯齿波
if count0=4999999 then counter:=conv_integer(amp)*1961;
count0:=0; bcd01<=0; bcd11<=0; bcd21<=0; bcd31<=0;
elsif count0=4999000 then bcd00<=bcd01; bcd10<=bcd11; bcd20<=bcd21;
bcd30<=bcd31; count0:=count0+1;
else count0:=count0+1;
if counter>99999 then counter:=counter-100000; bcd01<=bcd01+1;
elsif counter>9999 then counter:=counter-10000; bcd11<=bcd11+1;
elsif counter>999 then counter:=counter-1000; bcd21<=bcd21+1;
elsif counter>99 then counter:=counter-100; bcd31<=bcd31+1;
else null;
end if;
end if;
end if;
end if;
end process;
process(clk) --输出波形幅度(峰-峰值)数据译码动态显示
variable count : integer range 0 to 499999;
begin
if rising_edge(clk) then
if count<=124999 then y<=bcd00; count:=count+1; shift<="0111"; lcd(0)<='0';
elsif count<=249999 then y<=bcd10; count:=count+1; shift<="1011";lcd(0)<='1';
elsif count<=374999 then y<=bcd20; count:=count+1; shift<="1101";lcd(0)<='1';
elsif count<499999 then y<=bcd30; count:=count+1; shift<="1110";lcd(0)<='1';
elsif count=499999 then y<=bcd30; count:=0; shift<="1110";lcd(0)<='1';
end if;
end if;
case y is --7段码译码
when 0 => lcd(7 downto 1)<="0000001";
when 1 => lcd(7 downto 1)<="1001111";
when 2 => lcd(7 downto 1)<="0010010";
when 3 => lcd(7 downto 1)<="0000110";
when 4 => lcd(7 downto 1)<="1001100";
when 5 => lcd(7 downto 1)<="0100100";
when 6 => lcd(7 downto 1)<="0100000";
when 7 => lcd(7 downto 1)<="0001111";
when 8 => lcd(7 downto 1)<="0000000";
when 9 => lcd(7 downto 1)<="0000100";
when others => lcd(7 downto 1)<="0000001";
end case;
end process;
ym:process(clk) --正弦波在一个周期内时域上的64个采样点的波形数据
begin
if rising_edge(clk) then
case f is
when "00000000"=> d<="11111111" ; when "00000001"=> d<="11111110" ;
when "00000010"=> d<="11111100" ;when "00000011"=> d<="11111001" ;
when "00000100"=> d<="11110101" ; when "00000101"=> d<="11101111" ;
when "00000110"=> d<=&quo