本帖最后由 一只耳朵怪 于 2018-6-6 11:32 编辑
libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL; ----Uncomment the following library declaration if instantiating----any Xilinx primitives in this code.--libraryUNISIM;--useUNISIM.VComponents.all; entitygold is Port ( clk : in STD_LOGIC; en : in STD_LOGIC; g_out : out STD_LOGIC);endgold; architectureBehavioral of GOLD is signal m1_out,m2_out: STD_LOGIC; begin process(clk,en) variable reg1: STD_LOGIC_VECTOR(9 downto 0):="0011011011"; variable temp1: STD_LOGIC_VECTOR (9 downto 0):="0000000000"; begin if clk'event and clk = '1' then---------组合电路特征---------- if en='1' then m1_out<=reg1(0); temp1(0):= reg1(0) xor reg1(7); reg1(8 downto 0):=reg1(9 downto 1); reg1(9):=temp1(0); end if; end if; end process; process (clk,en) variable reg2: STD_LOGIC_VECTOR (9 downto 0):="1010010011"; variable temp2: STD_LOGIC_VECTOR (9 downto 0):="0000000000"; begin if clk'event and clk = '1' then if en='1' then m2_out<= reg2(0); temp2(0):= reg2(0) xor reg2(1)xorreg2(2)xor reg2(4)xor reg2(7)xor reg2(8); reg2(8 downto 0):=reg2(9 downto 1); reg2(9):=temp2(0); end if; end if; end process; g_out<= m1_out xor m2_out; endBehavioral;
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>