pl_fsk2.vhd

来自「用vhdl写的fpga移频键控程序」· VHDL 代码 · 共 48 行

VHD
48
字号
library ieee;
use ieee.std_logic_arith.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity PL_FSK2 is
port(
	clk      :in std_logic;	--系统时钟
	start    :in std_logic;	--同步信号
	M_S      :in std_logic;	--调制信号
	B_S      :out std_logic	--Demodulate signal
	);          
end PL_FSK2;

architecture behav of PL_FSK2 is
signal q : integer range 0 to 11;	--分频计数器
signal regs : std_logic;	--寄存器 
signal cnt  : integer range 0 to 5; 	--计数器
begin
	process(clk)	--对系统时钟进行q分频
	begin
		if clk'event and clk='1' then 
			regs <= M_S;	--在clk信上升沿时,x信号对中间信号xx赋值
			if start = '0' then 
				q <= 0;	--if语句完成Q的循环计数
			elsif q = 11 then 
				q <= 0;
			else q <= q+1;
			end if;
		end if;
	end process;
	
	process(regs,q)	--此进程完成FSK解调
	begin 
		if q = 11 then 
			cnt <= 0;	--m计数器清零
		elsif q = 10 then 
			if cnt <= 3 then 
				B_S <= '0';	--if语句通过对m大小,来判决y输出的电平
			else 
				B_S <= '1';
			end if;
		elsif  regs'event and regs='1'then 
			cnt <= cnt+1;	--计xx信号的脉冲个数
		end if;
	end process;
end behav;

⌨️ 快捷键说明

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