LFSR的VHDL实现
我在下面编写了在ISE上实现LFSR的Vhdl代码和测试台代码。 我从ISE上的这个路径中获取LFSR代码。 语言模板——VHDL——合成结构——编码示例--- 计数器--LFSR 我的问题是在simulink(isim)中,我总是要面对out\U lfsr的“U”符号。 你能帮帮我吗 vhdl代码:LFSR的VHDL实现,vhdl,lfsr,Vhdl,Lfsr,我在下面编写了在ISE上实现LFSR的Vhdl代码和测试台代码。 我从ISE上的这个路径中获取LFSR代码。 语言模板——VHDL——合成结构——编码示例--- 计数器--LFSR 我的问题是在simulink(isim)中,我总是要面对out\U lfsr的“U”符号。 你能帮帮我吗 vhdl代码: library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; use IEEE.std_logi
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
use IEEE.std_logic_unsigned.all;
entity lfsr is
port(rst,clk,clk_en:in std_logic;
out_lfsr: inout std_logic_vector(31 downto 0);
init_value:in std_logic_vector(31 downto 0)
);
end lfsr;
architecture Behavioral of lfsr is
begin
process(clk)
begin
if ( clk'event and clk ='1') then
if (rst = '1') then
out_lfsr <= init_value;
elsif clk_en='1' then
out_lfsr(31 downto 1) <= out_lfsr(30 downto 0) ;
out_lfsr(0) <= not(out_lfsr(31) XOR out_lfsr(21) XOR out_lfsr(0));
end if;
end if;
end process;
end Behavioral;
IEEE库;
使用IEEE.std_logic_1164.all;
使用IEEE.numeric_std.all;
使用IEEE.std_logic_unsigned.all;
实体lfsr是
端口(rst、clk、clk)在标准逻辑中;
输出lfsr:inout标准逻辑向量(31到0);
初始值:标准逻辑向量(31到0)
);
结束lfsr;
lfsr的行为体系结构
开始
过程(clk)
开始
如果(clk'事件和clk='1'),则
如果(rst='1'),则
首先,
时钟=>clk,
clk_en=>clk_en,
out\u lfsr=>out\u lfsr,
初始值=>初始值
);
--时钟进程定义
clk_流程:流程
开始
clk您必须在其他位置重置此块才能使其工作。复位时,它将输入值加载到输出
reset_p: process begin
rst <= '1';
wait for 10 * clk_period;
rst <= '0';
wait;
end process;
reset\u p:过程开始
rst您必须在其他位置重置此块才能使其工作。复位时,它将输入值加载到输出
reset_p: process begin
rst <= '1';
wait for 10 * clk_period;
rst <= '0';
wait;
end process;
reset\u p:过程开始
rst
entity lfsr is
port(
rst,clk,clk_en:in std_logic;
out_lfsr: out std_logic_vector(31 downto 0);
init_value: in std_logic_vector(31 downto 0)
);
end lfsr;
architecture Behavioral of lfsr is
signal s_out_lfsr : std_logic_vector(31 downto 0);
begin
process(clk)
begin
if ( clk'event and clk ='1') then
if (rst = '1') then
s_out_lfsr <= init_value;
elsif clk_en='1' then
s_out_lfsr(31 downto 1) <= s_out_lfsr(30 downto 0) ;
s_out_lfsr(0) <= not(s_out_lfsr(31) XOR s_out_lfsr(21) XOR s_out_lfsr(0));
end if;
end if;
end process;
out_lfsr <= s_out_lfsr;
end Behavioral;