⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pl_fsk.vhd

📁 基于CPLD
💻 VHD
字号:
library ieee;
use ieee.std_logic_arith.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity PL_FSK is
port(clk     :in std_logic;         --系统时钟
     start   :in std_logic;         --开始调制信号
     x     :in std_logic;          --基带信号
     y     :out std_logic);        --调制信号
end PL_FSK;
architecture behav of PL_FSK is
signal q1:integer range 0 to 11;      --载波信号f1的分频计数器
signal q2:integer range 0 to 3;       --载波信号f2的分频计数器
signal f1,f2:std_logic;             --载波信号f1,f2
begin
process(clk)                     --此进程通过对系统时钟clk的分频,得到载波f1
begin
if clk'event and clk='1' then 
   if start='0' then q1<=0;
   elsif q1<=5 then f1<='1';q1<=q1+1; --改变q1后面的数字可以改变,载波f1的占空比
   elsif q1=11 then f1<='0';q1<=0;    --改变q1后面的数字可以改变,载波f1的频率
   else  f1<='0';q1<=q1+1;
   end if;
end if;
end process;
process(clk)                      --此进程通过对系统时钟clk的分频,得到载波f2
begin
if clk'event and clk='1' then
   if start='0' then q2<=0;
   elsif q2<=0 then f2<='1';q2<=q2+1; --改变q2后面的数字可以改变,载波f2的占空比
   elsif q2=1 then f2<='0';q2<=0;     --改变q2后面的数字可以改变,载波f2的频率
   else f2<='0';q2<=q2+1;
   end if;
end if;
end process;
process(clk,x)                    --此进程完成对基带信号的FSK调制
begin
if clk'event and clk='1' then 
   if x='0' then y<=f1;            --当输入的基带信号x='0'时,输出的调制信号y为f1
   else y<=f2;                  --当输入的基带信号x='1'时,输出的调制信号y为f2
   end if;
end if;
end process;
end behav;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -