电子文章 | 电子资料下载 | 家电维修 | 维修资料下载 | 加入收藏 | 全站地图
您现在所在位置:电子爱好者电子文章FPGA多功能波形发生器VHDL程序与仿真

多功能波形发生器VHDL程序与仿真

11-20 16:14:56 | http://www.5idzw.com | FPGA | 人气:518
标签:fpga是什么,fpga教程,fpga培训,http://www.5idzw.com 多功能波形发生器VHDL程序与仿真,http://www.5idzw.com

            end if;

          end if; 

        end if;

           if count1=12499999 then count1:=0;                       --调方波A的占空比

             if zu='1' then

            if z<63 then z<=z+1;

            else z<=63;

            end if;

          elsif zd='1' then

            if z>0 then z<=z-1;

            else z<=0;

            end if;

          end if;

           else count1:=count1+1;

           end if;

        if count0=3249999 then count0:=0;

--up、down对4种波形幅度调节,u0、d0进一步对方波进行幅度调节

             if u0='1' then

                  if amp0<"11111111" then amp0<=amp0+1;

                  else amp0<="11111111";

                  end if;

                elsif d0='1' then

                  if amp0>"00000000" then amp0<=amp0-1;

   else amp0<="00000000";

                  end if;

          elsif up='1' then

            if amp<"11111111" then amp<=amp+1;

            else amp<="11111111";

            end if;

          elsif down='1' then

            if amp>"00000000" then amp<=amp-1;

            else amp<="00000000";

            end if;

          end if;

        else count0:=count0+1;

        end if;

      end if;

end if;

end if;

end process;

a<=amp;                        --将幅值输出。

cov_a:process(clk,amp,amp0)        

--主要实现各波形幅度值到BCD码的转化,由于方波和其他三种波形的幅度调节方式、精

--度不同,因此对幅度的处理方式分两种:“sss="00010" or sw='1'”是判断输出波形是否为

--方波(A或B),bcd00,bcd10,bcd20,bcd30是本进程的输出。

variable count : integer range 0 to 50004225;

variable counter : integer range 0 to 500055;

variable count1,count0 : integer range 0 to 4999999;

begin

if rising_edge(clk) then

    if sss="00010" or sw='1' then count0:=0;                                   --方波

      if count1=4999999 then count1:=0; bcd0<=0; bcd1<=0; bcd2<=0; bcd3<=0;

count:=(conv_integer(amp))*(conv_integer(amp0))*769; --幅值运算

      elsif count1=4999900 then count1:=count1+1;

bcd00<=bcd0; bcd10<=bcd1; bcd20<=bcd2; bcd30<=bcd3;  --数据输出

      else count1:=count1+1;                         --二进制码到BCD码的数据转换

        if count>9999999 then count:=count-10000000; bcd0<=bcd0+1;

        elsif count>999999 then count:=count-1000000; bcd1<=bcd1+1;

        elsif count>99999 then count:=count-100000; bcd2<=bcd2+1;

        elsif count>9999 then count:=count-10000; bcd3<=bcd3+1;

上一页  [1] [2] [3] [4] [5] [6]  下一页

,多功能波形发生器VHDL程序与仿真
关于《多功能波形发生器VHDL程序与仿真》的更多文章