標題: CPSK調制VHDL程序及仿真 [打印本頁]
作者: wang1587170 時間: 2018-1-7 22:56
標題: CPSK調制VHDL程序及仿真
8.11.6 CPSK調制VHDL程序及仿真
1. CPSK調制VHDL程序
--文件名:PL_CPSK
--功能:基于VHDL硬件描述語言,對基帶信號進行調制
--最后修改日期:
library ieee;
use ieee.std_logic_arith.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity PL_CPSK is
port(clk :in std_logic; --系統(tǒng)時鐘
start :in std_logic; --開始調制信號
x :in std_logic; --基帶信號
y :out std_logic); --已調制輸出信號
end PL_CPSK;
architecture behav of PL_CPSK is
signal q:std_logic_vector(1 downto 0); --2位計數(shù)器
signal f1,f2:std_logic; --載波信號
begin
process(clk) --此進程主要是產生兩重載波信號f1,f2
begin
if clk'event and clk='1' then
if start='0' then q<="00";
elsif q<="01" then f1<='1';f2<='0';q<=q+1;
elsif q="11" then f1<='0';f2<='1';q<="00";
else f1<='0';f2<='1';q<=q+1;
end if;
end if;
end process;
process(clk,x) --此進程完成對基帶信號x的調制
begin
if clk'event and clk='1' then
if q(0)='1' then
if x='1' then y<=f1; --基帶信號x為‘1’時,輸出信號y為f1
else y<=f2; --基帶信號x為‘0’時,輸出信號y為f2
end if;
end if;
end if;
end process;
end behav;
2. CPSK調制VHDL程序仿真圖及注釋
CPSK調制VHDL程序仿真圖及注釋如圖8.11.10所示。
CPSK調制VHDL程序仿真全圖
注:a.載波信號f1、f2是通過系統(tǒng)時鐘clk 分頻得到的,且滯后系統(tǒng)時鐘一個clk。
b.調制輸出信號y滯后載波一個clk;滯后系統(tǒng)時鐘兩個clk。
(b)CPSK調制VHDL程序仿真全局部放大圖
圖8.11.10 CPSK調制VHDL程序仿真圖及注釋
8.11.8 CPSK解調VHDL程序及仿真
1. CPSK解調VHDL程序
--文件名:PL_CPSK2
--功能:基于VHDL硬件描述語言,對CPSK調制的信號進行解調
--最后修改日期:
library ieee;
use ieee.std_logic_arith.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity PL_CPSK2 is
port(clk :in std_logic; --系統(tǒng)時鐘
start :in std_logic; --同步信號
x :in std_logic; --調制信號
y :out std_logic); --基帶信號
end PL_CPSK2;
architecture behav of PL_CPSK2 is
signal q:integer range 0 to 3;
begin
process(clk) --此進程完成對CPSK調制信號的解調
begin
if clk'event and clk='1' then
if start='0' then q<=0;
elsif q=0 then q<=q+1; --在q=0時,根據(jù)輸入信號x的電平來進行判決
if x='1' then y<='1';
else y<='0';
end if;
elsif q=3 then q<=0;
else q<=q+1;
end if;
end if;
end process;
end behav;
2. CPSK解調VHDL程序仿真圖及注釋
CPSK解調VHDL程序仿真圖及注釋如圖8.11.13所示。
(a)CPSK解調VHDL程序仿真全圖
注:a.當q=0時,根據(jù)x的電平來進行對判決。
b.輸出信號y滯后輸入信號x一個clk。
(b)CPSK解調VHDL程序仿真局部放大圖
圖8.11.13 CPSK解調VHDL程序仿真圖及注釋
8.11.10絕對碼-相對碼轉換VHDL程序及仿真
1. 絕對碼-相對碼轉換VHDL程序
--文件名:PL_DPSK
--功能:基于VHDL硬件描述語言,對基帶信號進行絕對碼到相對碼的轉換
--最后修改日期:
library ieee;
use ieee.std_logic_arith.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity PL_DPSK is
port(clk :in std_logic; --系統(tǒng)時鐘
start :in std_logic; --開始轉換信號
x :in std_logic; --絕對碼輸入信號
y :out std_logic); --相對碼輸出信號
end PL_DPSK;
architecture behav of PL_DPSK is
signal q:integer range 0 to 3; --分頻器
signal xx:std_logic; --中間寄存信號
begin
process(clk,x) --此進程完成絕對碼到相對碼的轉換
begin
if clk'event and clk='1' then
if start='0' then q<=0; xx<='0';
elsif q=0 then q<=1; xx<=xx xor x;y<=xx xor x; --輸入信號與前一個輸出信號進行異或
elsif q=3 then q<=0;
else q<=q+1;
end if;
end if;
end process;
end behav;
2. 絕對碼-相對碼轉換程序仿真圖及注釋
絕對碼-相對碼轉換程序仿真圖及注釋如圖8.11.16所示。
注:a.在q=0時,輸出信號y是輸入信號x與中間寄存信號xx異或。
b.輸出信號y滯后于輸入信號x一個clk。
圖8.11.16 絕對碼-相對碼轉換程序仿真圖及注釋
8.11.12 相對碼-絕對碼轉換VHDL程序及仿真
1. 相對碼-絕對碼轉換VHDL程序
--文件名:PL_DPSK2
--功能:基于VHDL硬件描述語言,對基帶碼進行相對碼到絕對碼的轉換
--最后修改日期:
library ieee;
use ieee.std_logic_arith.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity PL_DPSK2 is
port(clk :in std_logic; --系統(tǒng)時鐘
start :in std_logic; --開始轉換信號
x :in std_logic; --相對碼輸入信號
y :out std_logic); --絕對碼輸出信號
end PL_DPSK2;
architecture behav of PL_DPSK2 is
signal q:integer range 0 to 3; --分頻
signal xx:std_logic; --寄存相對碼
begin
process(clk,x) --此進程完成相對碼到絕對碼的轉換
begin
if clk'event and clk='1' then
if start='0' then q<=0;
elsif q=0 then q<=1;
elsif q=3 then q<=0; y<=xx xor x; xx<=x; --輸入信號x與前一輸入信號xx進行異或
else q<=q+1;
end if;
end if;
end process;
end behav;
2. 相對碼-絕對碼轉換VHDL程序仿真圖及注釋
相對碼到絕對碼的轉換程序仿真圖及注釋如圖8.11.19所示。
(a)相對碼到絕對碼的轉換程序仿真全圖
b.輸出信號y滯后于輸入信號x 一個基帶碼長(4個clk)。
(b)相對碼到絕對碼的轉換程序仿真局部放大圖
圖8.11.19 相對碼到絕對碼的轉換程序仿真圖及注釋
歡迎光臨 (http://www.torrancerestoration.com/bbs/) |
Powered by Discuz! X3.1 |