VHDL 伪随机序列发生器
答案:1 悬赏:10 手机版
解决时间 2021-11-25 03:14
- 提问者网友:温柔港
- 2021-11-24 04:39
VHDL 伪随机序列发生器
最佳答案
- 五星知识达人网友:忘川信使
- 2021-11-24 05:39
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity PRSG is
port (reset,clk:in std_logic;
sel:in std_logic_vector(1 downto 0);
dout:out std_logic_vector(7 downto 0));
end PRSG;
architecture behavioral of PRSG is
signal ddout:std_logic_vector(7 downto 0);
signal temp:std_logic;
begin
process(sel)
begin
if reset='1' then
ddout<="00000000";
elsif clk'event and clk='1' then ------这里改下就行了
case sel is
when"00"=>ddout<="01010001";
when"01"=>ddout<="00110001";
when"10"=>ddout<="10001001";
when others=>ddout<="01111001";
end case;
temp<=ddout(0) xor ddout(3);
dout(0)<=ddout(1);
dout(1)<=ddout(2);
dout(2)<=ddout(3);
dout(3)<=ddout(4);
dout(4)<=ddout(5);
dout(5)<=ddout(6);
dout(6)<=ddout(7);
dout(7)<=ddout(7) xor temp;
end if;
end process;
end behavioral;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity PRSG is
port (reset,clk:in std_logic;
sel:in std_logic_vector(1 downto 0);
dout:out std_logic_vector(7 downto 0));
end PRSG;
architecture behavioral of PRSG is
signal ddout:std_logic_vector(7 downto 0);
signal temp:std_logic;
begin
process(sel)
begin
if reset='1' then
ddout<="00000000";
elsif clk'event and clk='1' then ------这里改下就行了
case sel is
when"00"=>ddout<="01010001";
when"01"=>ddout<="00110001";
when"10"=>ddout<="10001001";
when others=>ddout<="01111001";
end case;
temp<=ddout(0) xor ddout(3);
dout(0)<=ddout(1);
dout(1)<=ddout(2);
dout(2)<=ddout(3);
dout(3)<=ddout(4);
dout(4)<=ddout(5);
dout(5)<=ddout(6);
dout(6)<=ddout(7);
dout(7)<=ddout(7) xor temp;
end if;
end process;
end behavioral;
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯