DIY编程器网

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 83|回复: 0
打印 上一主题 下一主题

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

[复制链接]
跳转到指定楼层
楼主
发表于 2011-4-26 09:40:05 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
多功能波形发生器VHDL程序与仿真

--文件名:mine4.vhd。
--功能:实现4种常见波形正弦、三角、锯齿、方波(A、B)的频率、幅度可控输出(方波
--A的占空比也是可控的),可以存储任意波形特征数据并能重现该波形,还可完成
--各种波形的线形叠加输出。
--说明: SSS(前三位)和SW信号控制4种常见波形种哪种波形输出。4种波形的频率、
--幅度(基准幅度A)的调节均是通过up、down、set按键和4个BCD码置入器以及一
--个置入档位控制信号(ss)完成的(AMP的调节范围是0"5V,调节量阶为1/51V)。
--其中方波的幅度还可通过u0、d0调节输出数据的归一化幅值(AMP0)进行进一步
--细调(调节量阶为1/(51*255)V)。方波A的占空比通过zu、zp按键调节(调节
--量阶1/64*T)。系统采用内部存储器——RAM实现任意输入波形的存储,程序只支
--持键盘式波形特征参数置入存储,posting 为进入任意波置入(set)、清除(clr)状态
--控制信号,SSS控制存储波形的输出。P180为预留端口,
--最后修改日期:2004.3.26。
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity mine4 is
port(clk : in std_logic; --时钟信号输入
set, clr, up, down, zu, zd : in std_logic; --各个波形特征的调节触发信号
posting : in std_logic; --任意波键盘置入信号
  u0,d0,sw : in std_logic; --方波A、B的切换sw,和方波B的幅度调节按键
ss : in std_logic_vector( 3 downto 0 ); --档位选择信号
sss : in std_logic_vector( 4 downto 0 ); --波形选择信号
Data3, Data2, Data1,Data0 : in std_logic_vector(3 downto 0); --BCD码输入
  p180 : out std_logic; --预留接口
lcd : out std_logic_vector(7 downto 0); --显示输出
shift : out std_logic_vector(3 downto 0); --位码输出
dd, a : out std_logic_vector( 7 downto 0)); --波形、幅度数据输出
end mine4;
architecture behav of mine4 is
subtype word is std_logic_vector( 7 downto 0 );
type unit is array(63 downto 0) of word;
signal ram : unit;
signal qqq : integer range 0 to 250000000;
signal qq : integer range 0 to 78125000;
signal tmp : integer range 0 to 9999;
signal coun : integer range 0 to 78125000;
signal coun0 : integer range 0 to 250000000;
signal b : integer range 0 to 78125000;
signal c : integer range 0 to 500000000;
signal z, con : integer range 0 to 63;
signal f : std_logic_vector( 7 downto 0 );
signal amp, amp0, d : std_logic_vector(7 downto 0);
signal bcd0,bcd1,bcd2,bcd3 : integer range 0 to 9;
signal bcd01,bcd11,bcd21,bcd31 : integer range 0 to 9;
signal bcd00,bcd10,bcd20,bcd30 : integer range 0 to 9;
signal y : integer range 0 to 9;
signal addr : integer range 0 to 63;
begin
qq'0');
end loop;
end if;
end if;
else count4:=count4+1;
end if;
else
if set='1' then coun0 then
if sw='0' then
if coun31 then dd31 then dd3:=conv_integer(("111111"-f(5 downto 0))&"00");
else dd3:=conv_integer(f(5 downto 0)&"00"); --三角波波形数据dd3
end if;
end if;
if sss(0)='1' then
if addr0 then z"00000000" then amp0"00000000" then amp9999999 then count:=count-10000000; bcd0999999 then count:=count-1000000; bcd199999 then count:=count-100000; bcd29999 then count:=count-10000; bcd399999 then counter:=counter-100000; bcd019999 then counter:=counter-10000; bcd11999 then counter:=counter-1000; bcd2199 then counter:=counter-100; bcd31 lcd(7 downto 1) lcd(7 downto 1) lcd(7 downto 1) lcd(7 downto 1) lcd(7 downto 1) lcd(7 downto 1) lcd(7 downto 1) lcd(7 downto 1) lcd(7 downto 1) lcd(7 downto 1) lcd(7 downto 1) d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d null;
end case;
end if;
end process;
p180<='1';
end behav;
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏 分享分享 支持支持 反对反对
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|文字版|手机版|DIY编程器网 ( 桂ICP备14005565号-1 )

GMT+8, 2025-8-15 19:43 , 耗时 0.234763 秒, 19 个查询请求 , Gzip 开启.

各位嘉宾言论仅代表个人观点,非属DIY编程器网立场。

桂公网安备 45031202000115号

DIY编程器群(超员):41210778 DIY编程器

DIY编程器群1(满员):3044634 DIY编程器1

diy编程器群2:551025008 diy编程器群2

QQ:28000622;Email:libyoufer@sina.com

本站由桂林市临桂区技兴电子商务经营部独家赞助。旨在技术交流,请自觉遵守国家法律法规,一旦发现将做封号删号处理。

快速回复 返回顶部 返回列表