📄 sha1_top.vhd
字号:
E4<='0';SCEN1<='0';SWEN1<='0'; CW<=CW+1; SCEN4<='0';SWEN4<='0'; if COUNT=3 then AD1<="000";AD4<="000"; elsif COUNT=7 then AD1<="001";AD4<="001"; elsif COUNT=11 then AD1<="010";AD4<="010"; elsif COUNT=15 then AD1<="011";AD4<="011"; elsif COUNT=19 then AD1<="100";AD4<="100"; end if; visual_S0_current <= S39; elsif (CW = "11" and VIN = "110") then SCEN1<='1';SWEN1<='1'; SCEN4<='1';SWEN4<='1'; VIN<=VIN+1;COUNT<=COUNT+1; visual_S0_current <= S39; elsif (VIN = "111") then if (COUNT > 0 and COUNT < 20) then VIN<="000";CW<="00"; visual_S0_current <= S34; elsif (COUNT = 20) then VIN<="000";CW<="00"; COUNT<="00000"; visual_S0_current <= S15; else VIN<="000";CW<="00"; visual_S0_current <= S38; end if; else visual_S0_current <= S39; end if; when S20 => if (VIN = "000") then SCEN1<='0';SWEN1<='1';RAM1_4S<="00";VIN<=VIN+1; visual_S0_current <= S20; elsif (VIN = "001") then A_LOGA_CTRL<="00";NOT_CTRL<='0'; REGIN_CTRL<="100";E1<='1';VIN<=VIN+1; visual_S0_current <= S20; elsif (VIN = "010") then A_LOGA_CTRL<="01";NOT_CTRL<='0'; REGIN_CTRL<="100";E1<='0';VIN<=VIN+1; E2<='1'; visual_S0_current <= S20; elsif (VIN = "011") then A_LOGA_CTRL<="10";NOT_CTRL<='0'; REGIN_CTRL<="100";E2<='0';VIN<=VIN+1; E3<='1'; visual_S0_current <= S20; elsif (VIN = "100") then A_LOGA_CTRL<="11";NOT_CTRL<='0'; REGIN_CTRL<="100";E3<='0';VIN<=VIN+1; E4<='1'; visual_S0_current <= S20; elsif (VIN = "101") then E4<='0';VIN<=VIN+1;AD1<=AD1+1; visual_S0_current <= S20; elsif (VIN = "110") then SCEN4<='0';SWEN4<='0';VIN<=VIN+1; visual_S0_current <= S20; elsif (VIN = "111" and (CW = "00" or CW = "01" or CW = "10")) then SCEN1<='0';SWEN1<='1';AD4<=AD4+1;VIN<="000"; CW<=CW+1;SCEN4<='1';SWEN4<='1'; visual_S0_current <= S20; elsif (CW = "11") then VIN<="000";CW<="00"; SCEN4<='1';SWEN4<='1'; AD1<="000";AD4<="000"; visual_S0_current <= S8; else visual_S0_current <= S20; end if; when S44 => if (VIN = "000") then SCEN1<='0';SWEN1<='0';AD1<="111"; VIN<=VIN+1; visual_S0_current <= S44; elsif (VIN = "001") then SCEN1<='0';SWEN1<='1';AD1<="111"; VIN<=VIN+1;RAM1_4S<="00"; visual_S0_current <= S44; elsif (VIN = "010") then A_LOGA_CTRL<="10";REGIN_CTRL<="111"; E3<='1';VIN<=VIN+1; visual_S0_current <= S44; elsif (VIN = "011") then A_LOGA_CTRL<="11";REGIN_CTRL<="111"; E4<='1';VIN<=VIN+1;E3<='0'; visual_S0_current <= S44; elsif (VIN = "100") then SCEN1<='0';SWEN1<='1';AD1<="100"; RAM1_4S<="00";VIN<=VIN+1;E4<='0'; visual_S0_current <= S44; elsif (VIN = "101") then A_LOGA_CTRL<="00";NOT_CTRL<='0'; REGIN_CTRL<="100";E1<='1'; VIN<=VIN+1; visual_S0_current <= S44; elsif (VIN = "110") then A_LOGA_CTRL<="01";NOT_CTRL<='0'; REGIN_CTRL<="100";E2<='1';E1<='0'; VIN<=VIN+1; visual_S0_current <= S44; elsif (VIN = "111") then SCEN1<='0';SWEN1<='0';AD1<="100"; SCEN4<='0';SWEN4<='0';AD4<="100"; VIN<="000"; visual_S0_current <= S15; else visual_S0_current <= S44; end if; when S8 => if (VIN = "000") then SCEN1<='0';SWEN1<='1';AD1<="000"; SCEN4<='0';SWEN4<='1';AD4<="000"; RAM1_4S<="11";VIN<=VIN+1; visual_S0_current <= S8; elsif (VIN = "100") then E2<='0';SCEN1<='0';SWEN1<='0'; AD1<="111";VIN<=VIN+1; visual_S0_current <= S8; elsif (VIN = "010") then SCEN1<='0';SWEN1<='1';AD1<="010"; SCEN4<='0';SWEN4<='1';AD4<="011"; RAM1_4S<="11";VIN<=VIN+1;E1<='0'; visual_S0_current <= S8; elsif (VIN = "110") then A_LOGA_CTRL<="00";REGIN_CTRL<="011"; A_LOGB_CTRL<="01";E1<='1';VIN<=VIN+1; visual_S0_current <= S8; elsif (VIN = "001") then A_LOGA_CTRL<="00"; A_LOGB_CTRL<="10"; REGIN_CTRL<="011";E1<='1';VIN<=VIN+1; visual_S0_current <= S8; elsif (VIN = "011") then A_LOGA_CTRL<="01"; A_LOGB_CTRL<="00"; REGIN_CTRL<="011";E2<='1';VIN<=VIN+1; visual_S0_current <= S8; elsif (VIN = "101") then SCEN1<='0';SWEN1<='1';RAM1_4S<="00"; VIN<=VIN+1;AD1<="111"; visual_S0_current <= S8; elsif (VIN = "111") then VIN<="000";E1<='0'; visual_S0_current <= S9; else visual_S0_current <= S8; end if; when S12 => if (VIN = "000") then SCEN1<='0';SWEN1<='1';AD1<="000"; SCEN4<='0';SWEN4<='1';AD4<="001"; RAM1_4S<="11";VIN<=VIN+1; visual_S0_current <= S12; elsif (VIN = "001") then A_LOGA_CTRL<="01"; A_LOGB_CTRL<="11"; REGIN_CTRL<="011";E1<='1';VIN<=VIN+1; visual_S0_current <= S12; elsif (VIN = "100") then E2<='0';SCEN1<='0';SWEN1<='0'; AD1<="111";VIN<=VIN+1; visual_S0_current <= S12; elsif (VIN = "101") then SCEN1<='0';SWEN1<='1';RAM1_4S<="00"; VIN<=VIN+1;AD1<="111"; visual_S0_current <= S12; elsif (VIN = "110") then A_LOGA_CTRL<="00";REGIN_CTRL<="011"; A_LOGB_CTRL<="01";E4<='1';VIN<=VIN+1; visual_S0_current <= S12; elsif (VIN = "111") then VIN<="000";E4<='0'; visual_S0_current <= S44; elsif (VIN = "011") then A_LOGA_CTRL<="00";A_LOGB_CTRL<="11"; E2<='1';REGIN_CTRL<="011"; VIN<=VIN+1; visual_S0_current <= S12; elsif (VIN = "010") then SCEN1<='0';SWEN1<='1';AD1<="010"; SCEN4<='0';SWEN4<='1';AD4<="100"; E1<='0';VIN<=VIN+1;RAM1_4S<="11"; visual_S0_current <= S12; else visual_S0_current <= S12; end if; when S9 => if (VIN = "000") then SCEN1<='0';SWEN1<='1';AD1<="000"; SCEN4<='0';SWEN4<='1';AD4<="000"; RAM1_4S<="11";VIN<=VIN+1; visual_S0_current <= S9; elsif (VIN = "001") then A_LOGA_CTRL<="01"; A_LOGB_CTRL<="11"; REGIN_CTRL<="011";E2<='1';VIN<=VIN+1; visual_S0_current <= S9; elsif (VIN = "010") then SCEN1<='0';SWEN1<='1';AD1<="010"; SCEN4<='0';SWEN4<='1';AD4<="011"; RAM1_4S<="11";VIN<=VIN+1;E2<='0'; visual_S0_current <= S9; elsif (VIN = "011") then A_LOGA_CTRL<="10"; A_LOGB_CTRL<="01"; REGIN_CTRL<="011";E3<='1';VIN<=VIN+1; visual_S0_current <= S9; elsif (VIN = "100") then E3<='0';SCEN1<='0';SWEN1<='0'; AD1<="111";VIN<=VIN+1; visual_S0_current <= S9; elsif (VIN = "101") then SCEN1<='0';SWEN1<='1';RAM1_4S<="00"; VIN<=VIN+1;AD1<="111"; visual_S0_current <= S9; elsif (VIN = "110") then A_LOGA_CTRL<="01";REGIN_CTRL<="011"; A_LOGB_CTRL<="10";E2<='1';VIN<=VIN+1; visual_S0_current <= S9; elsif (VIN <= "111") then VIN<="000";E2<='0'; visual_S0_current <= S10; else visual_S0_current <= S9; end if; when S10 => if (VIN = "000") then SCEN1<='0';SWEN1<='0';AD1<="100"; VIN<=VIN+1; visual_S0_current <= S10; elsif (VIN = "001") then SCEN1<='0';SWEN1<='1';AD1<="100"; RAM1_4S<="00";VIN<=VIN+1; visual_S0_current <= S10; elsif (VIN = "010") then A_LOGA_CTRL<="00";REGIN_CTRL<="111"; E1<='1';VIN<=VIN+1; visual_S0_current <= S10; elsif (VIN = "011") then E1<='0';A_LOGA_CTRL<="01"; REGIN_CTRL<="111";E2<='1'; VIN<=VIN+1; visual_S0_current <= S10; elsif (VIN = "100") then SCEN1<='0';SWEN1<='0';AD1<="100"; SCEN4<='0';SWEN4<='0';AD4<="100"; VIN<=VIN+1;E2<='0'; visual_S0_current <= S10; elsif (VIN = "101") then SCEN1<='1';SWEN1<='1'; SCEN4<='1';SWEN4<='1'; VIN<=VIN+1; visual_S0_current <= S10; elsif (VIN = "110") then SCEN1<='0';SWEN1<='1';AD1<="000"; SCEN4<='0';SWEN4<='1';AD4<="001"; RAM1_4S<="11";VIN<="000"; visual_S0_current <= S11; else visual_S0_current <= S10; end if; when S11 => if (VIN = "000") then A_LOGA_CTRL<="00"; A_LOGB_CTRL<="10"; REGIN_CTRL<="011";E1<='1';VIN<=VIN+1; visual_S0_current <= S11; elsif (VIN = "001") then SCEN1<='0';SWEN1<='1';AD1<="010"; SCEN4<='0';SWEN4<='1';AD4<="100"; RAM1_4S<="11";VIN<=VIN+1;E1<='0'; visual_S0_current <= S11; elsif (VIN = "010") then A_LOGA_CTRL<="11"; A_LOGB_CTRL<="10"; REGIN_CTRL<="011";E2<='1';VIN<=VIN+1; visual_S0_current <= S11; elsif (VIN = "011") then E2<='0';SCEN1<='0';SWEN1<='0'; AD1<="111";VIN<=VIN+1; visual_S0_current <= S11; elsif (VIN = "100") then SCEN1<='0';SWEN1<='1';RAM1_4S<="00"; VIN<=VIN+1;AD1<="111"; visual_S0_current <= S11; elsif (VIN = "101") then A_LOGA_CTRL<="00";REGIN_CTRL<="011"; A_LOGB_CTRL<="01";E3<='1';VIN<=VIN+1; visual_S0_current <= S11; elsif (VIN = "110") then VIN<="000";E3<='0'; visual_S0_current <= S12; else visual_S0_current <= S11; end if; when others => SCEN1<='1';SWEN1<='1';AD1<="000"; SCEN2<='1';SWEN2<='1';SADDR2<="000"; SCEN4<='1';SWEN4<='1';AD4<="000"; A_LOGA_CTRL<="00";A_LOGB_CTRL<="00"; NOT_CTRL<='0';REGIN_CTRL<="000"; E1<='0';E2<='0';E3<='0';E4<='0'; RAM1_4S<="00";VIN<="000";CW<="00"; LUN<="00";COUNT<="00000";OV<='0'; BUSY<='0'; visual_S0_current <= S0; end case; end if; end process; SADDR1<=AD1; SADDR4<=AD4;end SHA1_CTRL;----------------------------------------------------
--
-- Library Name : SHA1_LEAST
-- Unit Name : SHA1_TIXI
-- Unit Type : Block Diagram
--
------------------------------------------------------
library ieee;use ieee.STD_LOGIC_1164.all;use ieee.STD_LOGIC_ARITH.all;use ieee.STD_LOGIC_UNSIGNED.all;entity SHA1_TIXI is port ( A_LOGA_CTRL : in std_logic_vector(1 downto 0 ); A_LOGB_CTRL : in std_logic_vector(1 downto 0 ); CLK : in std_logic; E1 : in std_logic; E2 : in std_logic; E3 : in std_logic; E4 : in std_logic; NOT_CTRL : in std_logic; OUT_Q : out std_logic_vector(127 downto 0 ); RAM1_4QQ : in std_logic_vector(127 downto 0 ); RAM1QQ : in std_logic_vector(127 downto 0 ); REGIN_CTRL : in std_logic_vector(2 downto 0 ); RST : in std_logic ); end SHA1_TIXI; architecture SHA1_TIXI of SHA1_TIXI is signal A_LOGA_Q : std_logic_vector(31 downto 0 ); signal A_LOGB_Q : std_logic_vector(31 downto 0 ); signal ADD_Q : std_logic_vector(31 downto 0 ); signal AND_Q : std_logic_vector(31 downto 0 ); signal CIRCLE1 : std_logic_vector(31 downto 0 ); signal CIRCLE30 : std_logic_vector(31 downto 0 ); signal CIRCLE5 : std_logic_vector(31 downto 0 ); signal NOT_Q : std_logic_vector(31 downto 0 ); signal NOT_QQ : std_logic_vector(31 downto 0 ); signal OR_Q : std_logic_vector(31 downto 0 ); signal RA1 : std_logic_vector(31 downto 0 ); signal RA2 : std_logic_vector(31 downto 0 ); signal RA3 : std_logic_vector(31 downto 0 ); signal RA4 : std_logic_vector(31 downto 0 ); signal RB1 : std_logic_vector(31 downto 0 ); signal RB2 : std_logic_vector(31 downto 0 ); signal RB3 : std_logic_vector(31 downto 0 ); signal RB4 : std_logic_vector(31 downto 0 ); signal REG1QQ : std_logic_vector(31 downto 0 ); signal REG2QQ : std_logic_vector(31 downto 0 ); signal REG3QQ : std_logic_vector(31 downto 0 ); signal REG4QQ : std_logic_vector(31 downto 0 ); signal REGIN_Q : std_logic_vector(31 downto 0 ); signal S86 : std_logic_vector(26 downto 0 ); signal S87 : std_logic_vector(4 downto 0 ); signal S88 : std_logic_vector(1 downto 0 ); signal S89 : std_logic_vector(29 downto 0 ); signal XOR_Q : std_logic_vector(31 downto 0 ); signal visual_C0_sum_int : std_logic_vector(32 downto 0 ); signal visual_C0_tmp_a : std_logic_vector(32 - 1 downto 0 ); signal visual_C0_tmp_b : std_logic_vector(32 - 1 downto 0 ); constant visual_C0_zero : std_logic_vector(32 - 1 downto 0 ) := (others => '0'); signal visual_C4_O : std_logic_vector(32 - 1 downto 0 ); signal visual_C15_O : std_logic_vector(32 - 1 downto 0 ); signal visual_C18_O : std_logic_vector(32 - 1 downto 0 ); signal visual_C20_Q : std_logic_vector(32 - 1 downto 0 ); signal visual_C21_Q : std_logic_vector(32 - 1 downto 0 ); signal visual_C22_Q : std_logic_vector(32 - 1 downto 0 ); signal visual_C23_Q : std_logic_vector(32 - 1 downto 0 ); signal visual_C25_O : std_logic_vector(32 - 1 downto 0 ); begin visual_C0_tmp_a <= (A_LOGA_Q(31 downto 0)); visual_C0_tmp_b <= (A_LOGB_Q(31 downto 0)); visual_C0_sum_int <= (unsigned('0' & visual_C0_tmp_a) + unsigned('0' & visual_C0_tmp_b)); ADD_Q(31 downto 0) <= (visual_C0_sum_int(32 - 1 downto 0)); AND_Q(31 downto 0) <= ( A_LOGA_Q(31 downto 0)) and ( A_LOGB_Q(31 downto 0));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -