项目10ASK编码器与译码器设计.doc
文本预览下载声明
项目十 ASK编码器与译码器设计
班级:09电信 姓名:曾珍 学号:33
实训目标
设计m序列发生器;
设计ASK编码器;
设计ASK译码器;
在
实训内容
根据系统框图完成信号发生器的设计。
在
使用示波器观察ASK译码器的输出波形,将此波形与ASK编码器的输入波形进行比较,看ASK编译码是否成功,并记录波形的频率以及幅值。
实训数据
画出所设计的系统原理图,并附上每个模块的程序代码。
M序列发生器
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity mser is
port( clk : in std_logic;
load : in std_logic;
mserout : out std_logic);
end mser;
architecture one of mser is
signal msecom : std_logic_vector(3 downto 0);
begin
process(clk)
begin
if clkevent and clk = 1 then
if load = 0 then
msecom = 0110;
mserout = msecom(3);
else
msecom(3 downto 1) = msecom(2 downto 0);
msecom(0) = msecom(3) xor msecom(0);
mserout = msecom(3);
end if;
end if;
end process;
end one;
译码器
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity askcode is
generic(cnthigh : integer:= 3;
cntperiod : integer:= 7);
port(clk : in std_logic;
datain : in std_logic;
askcodeout : out std_logic);
end askcode;
architecture behave of askcode is
signal fsig : std_logic;
signal cnt : integer range 0 to 255;
begin
process(clk)
begin
if clkevent and clk = 1 then
if cnt = cnthigh then
fsig = 1;
cnt = cnt + 1;
elsif cnt = cntperiod then
fsig = 0;
cnt = cnt + 1;
cnt = 0;
else
cnt = cnt + 1;
end if;
end if;
end process;
process(clk)
begin
if clkevent and clk = 1 then
if datain = 1 then
askcodeout = fsig;
else
askcodeout = 0;
end if;
end if;
end process;
end behave;
编码器
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity askdec is
generic
(cntperiod : integer:= 7);
port(clk : in std_logic;
askcodein : in std_logic;
dataout : out std_logic);
end askdec;
architecture behave of askdec is
signal cnt :integer range 0 to 255;
signal datacom : std_logic_vector(1 downto 0);
signal datareg : std_logic;
begin
process(clk)
begin
if clkevent and clk = 1 then
datacom = askcodein datacom(1);
end if;
end process;
process(clk)
beg
显示全部