insertv.vhd

来自「实现HDB3编码,使用VHDL语言」· VHDL 代码 · 共 32 行

VHD
32
字号
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity insertv is
  port( clk  :  in  std_logic;
        clr  :  in  std_logic;
     codein  :  in  std_logic;
     codeoutv : out std_logic_vector(1 downto 0));
end;
 
architecture one of insertv is
  signal count0 : integer:=0;
   begin
 process(clk,clr)
   begin
  if clk'event and clk='1' then
     if clr='1' then 
        codeoutv<="00";count0<=0;
     else
        case codein is
           when '1'=>codeoutv<="01";count0<=0;
           when '0'=>if(count0=3) then 
                        codeoutv<="11";count0<=0;
                     else
                        count0<=count0+1;codeoutv<="00";
                     end if;
           when others=>codeoutv<="00";count0<=count0;
        end case;
      end if;
   end if;
 end process;
end;

⌨️ 快捷键说明

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