我有一個與計數器的僞隨機數發生器的問題,以檢查我是否用不可約多項式消除。 geenrator正在工作沒有問題,但是如果我嘗試將它用作子模塊,則計數器不會生效。任何想法 ??需要一些幫助僞隨機數發生器
-- x^6 + x^5 + x^3 + x^2 + 1
Library IEEE;
use ieee.numeric_std.all;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_unsigned.all;
entity EPZG is
port (CLK: in std_logic;
EQ: out bit_vector(5 downto 0);
A : out bit);
end EPZG;
architecture behaviour of EPZG is
component Counter is port (CLK, RESET : in std_logic;
result: out bit_vector(5 downto 0));
end component;
signal SZ: bit;
signal SEQ : bit_vector(5 downto 0);
signal CNT_RESET : std_logic;
signal CNT_RESULT : bit_vector(5 downto 0);
begin
SZ <= '1';
PZG : process(CLK)
begin
CNT_RESET <= '1';
if (CLK'event and CLK ='1') then
SEQ(0) <= SZ xor SEQ(5);
SEQ(1) <= SEQ(0);
SEQ(2) <= SEQ(1) xor SEQ(5);
SEQ(3) <= SEQ(2) xor SEQ(5);
SEQ(4) <= SEQ(3);
SEQ(5) <= SEQ(4) xor SEQ(5);
end if;
end process PZG;
EQ <= SEQ;
CNT: Counter port map (CLK , RESET =>CNT_RESET,result =>CNT_RESULT);
end behaviour;
計數器代碼
圖書館IEEE; 使用IEEE.STD_LOGIC_1164.ALL; 使用ieee.std_logic_unsigned.all;
entity Counter is port (CLK, RESET : in std_logic; result: out bit_vector(5 downto 0)); end Counter; architecture BEHAVIOUR of Counter is signal pre_counter: std_logic_vector(5 downto 0); begin REG : process(CLK, RESET) begin if(CLK'event and CLK = '1') then if (RESET = '0') then pre_counter <= (others =>'0'); else pre_counter <= pre_counter +1 ; end if; end if; end process; result <= To_bitvector (pre_counter); end BEHAVIOUR;
「需要一些幫助」不是問題描述... – 2012-04-08 09:27:52
如果您也發佈計數器模塊的代碼,它可能會有所幫助。 – sonicwave 2012-04-08 09:44:28
我剛剛添加了計數器代碼 – user1320084 2012-04-08 09:53:39