找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 2557|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

CPSK調(diào)制VHDL程序及仿真

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:272961 發(fā)表于 2018-1-7 22:56 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
8.11.6 CPSK調(diào)制VHDL程序及仿真
1. CPSK調(diào)制VHDL程序
--文件名:PL_CPSK
--功能:基于VHDL硬件描述語言,對(duì)基帶信號(hào)進(jìn)行調(diào)制
--最后修改日期:
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)時(shí)鐘
     start    :in std_logic;           --開始調(diào)制信號(hào)
     x      :in std_logic;           --基帶信號(hào)
     y      :out std_logic);         --已調(diào)制輸出信號(hào)
end PL_CPSK;
architecture behav of PL_CPSK is
signal q:std_logic_vector(1 downto 0);  --2位計(jì)數(shù)器
signal f1,f2:std_logic;               --載波信號(hào)
begin
process(clk)                       --此進(jìn)程主要是產(chǎn)生兩重載波信號(hào)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)                        --此進(jìn)程完成對(duì)基帶信號(hào)x的調(diào)制        
begin
if clk'event and clk='1' then
   if q(0)='1' then
      if x='1' then y<=f1;             --基帶信號(hào)x為‘1’時(shí),輸出信號(hào)yf1
      else y<=f2;                   --基帶信號(hào)x為‘0’時(shí),輸出信號(hào)yf2
      end if;
   end if;
end if;
end process;
end behav;
2. CPSK調(diào)制VHDL程序仿真圖及注釋
CPSK調(diào)制VHDL程序仿真圖及注釋如圖8.11.10所示。
CPSK調(diào)制VHDL程序仿真全圖

注:a.載波信號(hào)f1f2是通過系統(tǒng)時(shí)鐘clk 分頻得到的,且滯后系統(tǒng)時(shí)鐘一個(gè)clk。
b.調(diào)制輸出信號(hào)y滯后載波一個(gè)clk;滯后系統(tǒng)時(shí)鐘兩個(gè)clk。
bCPSK調(diào)制VHDL程序仿真全局部放大圖
8.11.10 CPSK調(diào)制VHDL程序仿真圖及注釋
8.11.8 CPSK解調(diào)VHDL程序及仿真
1. CPSK解調(diào)VHDL程序
--文件名:PL_CPSK2
--功能:基于VHDL硬件描述語言,對(duì)CPSK調(diào)制的信號(hào)進(jìn)行解調(diào)
--最后修改日期:
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)時(shí)鐘
     start     :in std_logic;                --同步信號(hào)
     x       :in std_logic;                --調(diào)制信號(hào)
     y       :out std_logic);              --基帶信號(hào)
end PL_CPSK2;
architecture behav of PL_CPSK2 is
signal q:integer range 0 to 3;      
begin
process(clk)                              --此進(jìn)程完成對(duì)CPSK調(diào)制信號(hào)的解調(diào)
begin
if clk'event and clk='1' then
   if start='0' then q<=0;
   elsif q=0 then q<=q+1;               --q=0時(shí),根據(jù)輸入信號(hào)x的電平來進(jìn)行判決
      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解調(diào)VHDL程序仿真圖及注釋
CPSK解調(diào)VHDL程序仿真圖及注釋如圖8.11.13所示

aCPSK解調(diào)VHDL程序仿真全圖

注:a.當(dāng)q=0時(shí),根據(jù)x的電平來進(jìn)行對(duì)判決。
b.輸出信號(hào)y滯后輸入信號(hào)x一個(gè)clk。
bCPSK解調(diào)VHDL程序仿真局部放大圖
8.11.13 CPSK解調(diào)VHDL程序仿真圖及注釋
8.11.10絕對(duì)碼-相對(duì)碼轉(zhuǎn)換VHDL程序及仿真
1. 絕對(duì)碼-相對(duì)碼轉(zhuǎn)換VHDL程序
--文件名:PL_DPSK
--功能:基于VHDL硬件描述語言,對(duì)基帶信號(hào)進(jìn)行絕對(duì)碼到相對(duì)碼的轉(zhuǎn)換
--最后修改日期:
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)時(shí)鐘
     start    :in std_logic;         --開始轉(zhuǎn)換信號(hào)
     x      :in std_logic;          --絕對(duì)碼輸入信號(hào)
     y      :out std_logic);        --相對(duì)碼輸出信號(hào)
end PL_DPSK;
architecture behav of PL_DPSK is
signal q:integer range 0 to 3;         --分頻器
signal xx:std_logic;                --中間寄存信號(hào)   
begin
process(clk,x)                    --此進(jìn)程完成絕對(duì)碼到相對(duì)碼的轉(zhuǎn)換
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; --輸入信號(hào)與前一個(gè)輸出信號(hào)進(jìn)行異或
   elsif q=3 then q<=0;
   else q<=q+1;
   end if;
end if;
end process;
end behav;
2. 絕對(duì)碼-相對(duì)碼轉(zhuǎn)換程序仿真圖及注釋
絕對(duì)碼-相對(duì)碼轉(zhuǎn)換程序仿真圖及注釋如圖8.11.16所示。

注:a.q=0時(shí),輸出信號(hào)y是輸入信號(hào)x與中間寄存信號(hào)xx異或。
    b.輸出信號(hào)y滯后于輸入信號(hào)x一個(gè)clk。
8.11.16 絕對(duì)碼-相對(duì)碼轉(zhuǎn)換程序仿真圖及注釋
8.11.12 相對(duì)碼-絕對(duì)碼轉(zhuǎn)換VHDL程序及仿真
1. 相對(duì)碼-絕對(duì)碼轉(zhuǎn)換VHDL程序
--文件名:PL_DPSK2
--功能:基于VHDL硬件描述語言,對(duì)基帶碼進(jìn)行相對(duì)碼到絕對(duì)碼的轉(zhuǎn)換
--最后修改日期:
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)時(shí)鐘
     start  :in std_logic;          --開始轉(zhuǎn)換信號(hào)
     x    :in std_logic;          --相對(duì)碼輸入信號(hào)
     y    :out std_logic);        --絕對(duì)碼輸出信號(hào)
end PL_DPSK2;
architecture behav of PL_DPSK2 is
signal q:integer range 0 to 3;       --分頻
signal xx:std_logic;              --寄存相對(duì)碼
begin
process(clk,x)                   --此進(jìn)程完成相對(duì)碼到絕對(duì)碼的轉(zhuǎn)換
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;  --輸入信號(hào)x與前一輸入信號(hào)xx進(jìn)行異或
   else q<=q+1;
   end if;
end if;
end process;
end behav;
2. 相對(duì)碼-絕對(duì)碼轉(zhuǎn)換VHDL程序仿真圖及注釋
相對(duì)碼到絕對(duì)碼的轉(zhuǎn)換程序仿真圖及注釋如圖8.11.19所示。

a)相對(duì)碼到絕對(duì)碼的轉(zhuǎn)換程序仿真全圖

    b.輸出信號(hào)y滯后于輸入信號(hào)x 一個(gè)基帶碼長(zhǎng)(4個(gè)clk)。
b)相對(duì)碼到絕對(duì)碼的轉(zhuǎn)換程序仿真局部放大圖
8.11.19 相對(duì)碼到絕對(duì)碼的轉(zhuǎn)換程序仿真圖及注釋

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表