📄 convolutional_encoder.vhd
字号:
library ieee;
use ieee.std_logic_1164.all;
entity convolutional_encoder is
port(
clk:in std_logic;
data:in std_logic;
notready:in std_logic;
datai_1:out std_logic;
dataq_1:out std_logic;
control:buffer std_logic);
end;
architecture encoder_arch of convolutional_encoder is
signal shift:std_logic_vector(8 downto 0);
signal nextcount:std_logic_vector(3 downto 0);
begin
process(clk,notready)
begin
if notready='1' then
shift<="000000000";
elsif clk'event and clk='1' then
shift(0)<=shift(1);
shift(1)<=shift(2);
shift(2)<=shift(3);
shift(3)<=shift(4);
shift(4)<=shift(5);
shift(5)<=shift(6);
shift(6)<=shift(7);
shift(7)<=shift(8);
shift(8)<=data;
end if;
end process;
process(notready,clk,control)
begin
if notready='1' then
nextcount<="0000";
elsif clk'event and clk='1' then
if control='1' then
nextcount<="0000";
else
case nextcount is
when "0000"=>nextcount<="0001";
when "0001"=>nextcount<="0011";
when "0011"=>nextcount<="0010";
when "0010"=>nextcount<="0110";
when "0110"=>nextcount<="0111";
when "0111"=>nextcount<="0101";
when "0101"=>nextcount<="0100";
when "0100"=>nextcount<="1100";
when "1100"=>nextcount<="1101";
when "1101"=>nextcount<="1111";
when "1111"=>nextcount<="1110";
when "1110"=>nextcount<="1010";
when "1010"=>nextcount<="1011";
when "1011"=>nextcount<="1001";
when "1001"=>nextcount<="1000";
when "1000"=>nextcount<="0000";
when others=>nextcount<="XXXX";
end case;
end if;
end if;
end process;
process(notready,nextcount)
begin
if notready='1' then
control<='0';
elsif nextcount="1111" then
control<='1';
end if;
end process;
process(shift)
begin
datai_1<=shift(8) xor shift(7) xor shift(6) xor shift(5) xor shift(3) xor shift(1) xor shift(0);
end process;
process(shift)
begin
dataq_1<=shift(8) xor shift(6) xor shift(5) xor shift(4) xor shift(0);
end process;
end encoder_arch;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -