📄 demodulation.vhd
字号:
LIBRARY ieee ;
USE ieee.std_logic_1164.all ;
entity demodulation is
port(clk :in std_logic; --系统时钟
start :in std_logic; --同步信号
x :in std_logic; --调制信号
y :out std_logic); --基带信号
end demodulation;
architecture behav of demodulation is
signal q:integer range 0 to 7; --计数器
signal xx:std_logic_vector(2 downto 0); --加法器
signal yyy:std_logic_vector(1 downto 0); --2位并行基代信号寄存器
signal yy:std_logic_vector(2 downto 0); --寄存xx数据
begin
process(clk)
begin
if clk'event and clk='1' then
if start='0' then q<=0;
elsif q=0 then q<=1;yy<=xx; y<=yyy(0); --把加法计数器的数据送入yy寄存器
if x='0' then xx<="001"; --调制信号x为低电平时,送入加法器的数据"001"
else xx<="000";
end if;
elsif q=2 then q<=3;
if x='0' then xx<=xx+"001"; --调制信号x为低电平时,送入加法器的数据"001"
end if;
elsif q=4 then q<=5; y<=yyy(1);
if x='0' then xx<=xx+"010"; --调制信号x为低电平时,送入加法器的数据"010"
end if;
elsif q=6 then q<=7;
if x='0' then xx<=xx+"011"; --调制信号x为低电平时,送入加法器的数据"011"
end if;
else q<=q+1;
end if;
end if;
end process;
process(yy) --此进程根据yy寄存器里的数据进行译码
begin
if clk='1' and clk'event then
if yy="101" then yyy<="00"; --yy寄存器"101"对应基带码"00"
elsif yy="011" then yyy<="01"; --yy寄存器"011"对应基带码"01"
elsif yy="010" then yyy<="10"; --yy寄存器"010"对应基带码"10"
elsif yy="100" then yyy<="11"; --yy寄存器"100"对应基带码"11"
else yyy<="00";
end if;
end if;
end process;
end behav;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -