⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 encode2.vhd

📁 使用VHDL语言进行的数字锁相环的设计
💻 VHD
字号:
  -------------------------------------------------------------
  --Copyright (C), 2004- , Huangwei.                         --
  --File name:incode2(解码器)                                --
  --Author:huangwei       Version:1.0        Date:2004/11/24 --
  --Description:                                             --
  --该程序主要完成的功能是完成对破坏点的变换以及产生识别     --
  --HDB3数据流所需的信号——SF.                              --
  -------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity encode2 is

port(
     datain :in std_logic;              --数据输入信号
     count: in integer range 0 to 4;    --破坏点位置记录信号
     clk:in std_logic;                  --时钟输入

     dataout:out std_logic;             --变换后的数据输出
     sf:out std_logic                   --判断数据属于正负HDB3的判决信号
     );

end encode2;

architecture encode2_arc of encode2 is

signal s_sf:std_logic;
signal s_pf:std_logic;
signal outbuff:std_logic;

begin

process(clk,datain,count)

begin

if rising_edge(clk) then

    dataout <= outbuff;
    sf <=s_sf;

    if(count = 0) then      --正常数据传输

        outbuff <= datain;

        if (datain = '1')then    --正常数据传输过程中,判别信号正负的变化情况
            s_sf <= not s_sf;
            s_pf <= not s_pf;
        else
            s_sf <= s_sf;
            s_pf <= s_pf;
        end if;

    elsif(count = 1)then    --破环点处的数据变化以及信号正负的变化情况

        if ( s_pf = '0')then    --破环点间‘1’的个数是偶数,第一个‘0’改为‘1’;‘1’的正负性改变
            s_sf <=not s_sf;
            outbuff <= '1';
        else                    --破环点间‘1’的个数是奇数,第一个‘0’不变;1’的正负性不变
            outbuff <= '0';
        end if;

    elsif(count = 2) then       --破环点中第2,3个‘0’不变

        outbuff <= '0';

    elsif (count = 3) then

        outbuff <= '0';

    elsif(count = 4)then        --破环点中第四个‘0’变为‘1’

        outbuff <= '1';
        s_pf <= '0';

    end if;
    
end if;

end process;

end encode2_arc;
     

⌨️ 快捷键说明

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