新闻  |   论坛  |   博客  |   在线研讨会
一些原码(转9)
ednchina | 2009-09-20 12:08:35    阅读:965   发布文章

MASK调制VHDL程序

--文件名:PL_MASK
--功能:基于VHDL硬件描述语言,对基带信号进行MASK调制
--说明:这里MASK中的M为4
--最后修改日期:2004.2.13
library ieee;
use ieee.std_logic_arith.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity PL_MASK is
port(clk :in std_logic; --系统时钟
start :in std_logic; --开始调制信号
x :in std_logic; --基带信号
y :out std_logic_vector(7 downto 0)); --8位DAC数据
end PL_MASK;
architecture behav of PL_MASK is
signal q:integer range 0 to 7; --计数器
signal qq:integer range 0 to 3; --计数器
signal xx:std_logic_vector(3 downto 0); --并行数据寄存器
signal yy:std_logic_vector(7 downto 0); --8位DAC数据寄存器
begin
process(clk) --此进程完成基带信号的串并转换,完成4位并行数据到8位DAC数据的译码
begin
if clk'event and clk='1' then
if start='0' then q<=0;
elsif q=0 then q<=1;xx(3)<=x;
if xx(3)='1' then yy<=xx&"1111"; --if语句完成4位并行数据到8位DAC数据转换
elsif xx(2)='1' then yy<=xx&"1011";
elsif xx(1)='1' then yy<=xx&"0111";
elsif xx(0)='1' then yy<=xx&"0011";
else yy<=xx&"0000";
end if;
elsif q=2 then q<=3;xx(2)<=x;
elsif q=4 then q<=5;xx(1)<=x;
elsif q=6 then q<=7;xx(0)<=x;
else q<=q+1;
end if;
end if;
end process;
process(clk) --对8位DAC数据进行ASK调制
begin
if clk'event and clk='1' then
if start='0' then qq<=0;
elsif qq<2 then qq<=qq+1;y<="00000000";
elsif qq=2 then qq<=3;y<=yy;
else qq<=0;
end if;
end if;
end process;
end behav;

*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。

参与讨论
登录后参与讨论
edn的世界
最近文章
一些原码(转18)
2009-09-20 12:17:17
一些原码(转16)
2009-09-20 12:16:07
一些原码(转16)
2009-09-20 12:14:35
推荐文章
最近访客