⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 word.vhd

📁 这个是相当不错的EDA编程
💻 VHD
字号:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY word IS
    PORT (   
             clk : in STD_LOGIC;            
             Set : IN  STD_LOGIC_VECTOR(3 DOWNTO 0);
             cnt : in integer range 0 to 3;
             Fword : IN  STD_LOGIC_VECTOR(7 DOWNTO 0);
             Pword : IN  STD_LOGIC_VECTOR(7 DOWNTO 0);
             P    : out  STD_LOGIC_VECTOR(9 DOWNTO 0);
             F    : out  STD_LOGIC_VECTOR(31 DOWNTO 0)
             
               );

END word;
ARCHITECTURE behav OF word IS
signal temp_set:   STD_LOGIC_VECTOR(3 DOWNTO 0);
signal temp_F  :   STD_LOGIC_VECTOR(31 DOWNTO 0);
signal temp_P  :   STD_LOGIC_VECTOR(9 DOWNTO 0);

BEGIN
temp_set<=Set;
process(clk,cnt,set)
begin
case temp_set is
	when "1110" => case cnt is
	                    when 0 =>  temp_F(20 DOWNTO 13)<="00000001";
 	                               temp_F(31 DOWNTO 21)<="00000000000";
 	                               temp_F(12 DOWNTO 0)<="0000000000000" ;
 	                               temp_P( 9 DOWNTO 2)<=Pword ;
 	                               temp_P( 1 DOWNTO 0)<="00"  ;
	                    when 1 =>  temp_F(21 DOWNTO 14)<="00000001";
 	                               temp_F(31 DOWNTO 22)<="0000000000";
 	                               temp_F(13 DOWNTO 0)<="00000000000000" ;
 	                               temp_P( 9 DOWNTO 2)<=Pword ;
 	                               temp_P( 1 DOWNTO 0)<="00"  ;
                        when others=> null;
                   end case;

	when "1101" => case cnt is
	                    when 0 =>  temp_F(22 DOWNTO 15)<="00000001";
 	                               temp_F(31 DOWNTO 23)<="000000000";
 	                               temp_F(14 DOWNTO 0)<="000000000000000" ;
 	                               temp_P( 9 DOWNTO 2)<=Pword ;
 	                               temp_P( 1 DOWNTO 0)<="00"  ;
	                    when 1 =>  temp_F(23 DOWNTO 16)<="00000001";
 	                               temp_F(31 DOWNTO 24)<="00000000";
 	                               temp_F(15 DOWNTO 0)<="0000000000000000" ;
 	                               temp_P( 9 DOWNTO 2)<=Pword ;
 	                               temp_P( 1 DOWNTO 0)<="00"  ;
                        when others=> null;
                   end case;

	when "1011" => case cnt is
	                    when 0 =>  temp_F(24 DOWNTO 17)<="00000001";
 	                               temp_F(31 DOWNTO 25)<="0000000";
 	                               temp_F(16 DOWNTO 0)<="00000000000000000" ;
 	                               temp_P( 9 DOWNTO 2)<=Pword ;
 	                               temp_P( 1 DOWNTO 0)<="00"  ;
	                    when 1 =>  temp_F(25 DOWNTO 18)<="00000001";
 	                               temp_F(31 DOWNTO 26)<="000000";
 	                               temp_F(17 DOWNTO 0)<="000000000000000000" ;
 	                               temp_P( 9 DOWNTO 2)<=Pword ;
 	                               temp_P( 1 DOWNTO 0)<="00"  ;
                        when others=> null;
                  end case;

	when "0111" => case cnt is
	                    when 0 =>  temp_F(26 DOWNTO 19)<="00000001";
 	                               temp_F(31 DOWNTO 27)<="00000";
 	                               temp_F(18 DOWNTO 0)<="0000000000000000000" ;
 	                               temp_P( 9 DOWNTO 2)<=Pword ;
 	                               temp_P( 1 DOWNTO 0)<="00"  ;
	                    when 1 =>  temp_F(27 DOWNTO 20)<="00000001";
 	                               temp_F(31 DOWNTO 28)<="0000";
 	                               temp_F(19 DOWNTO 0)<="00000000000000000000" ;
 	                               temp_P( 9 DOWNTO 2)<=Pword ;
 	                               temp_P( 1 DOWNTO 0)<="00"  ;
                        when others=> null;
                   end case;
   
    when others => null;
   end case;
end process;

END behav;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -