在这个 甚高密度脂蛋白项目,完整 协处理器 在VHDL中设计和实现了用于加密应用程序的软件。
如前所述 Verilog / 甚高密度脂蛋白 在项目中,协处理器提供了标准指令和专用于安全性的专用功能单元。协处理器的设计和实现 甚高密度脂蛋白,但ALU单元中的N位加法器是在Verilog中实现的。
协处理器的框图如下:

首先,让我们实现协处理器的组合逻辑单元。以下是组合逻辑单元的框图:

组合逻辑单元的主要模块(例如ALU,移位单元和非线性查找操作)已发布在以前的文章中:
甚高密度脂蛋白中的ALU设计
甚高密度脂蛋白中的移位器设计
甚高密度脂蛋白中的非线性查找实现
协处理器的指令集架构如下:
0。添加:ABUS + BBUS-> RESULT1. SUB:ABUS-BBUS-> RESULT
2. AND:ABUS& BBUS -> RESULT
3.或:ABUS |巴士-> RESULT
4. XOR:ABUS ^ BBUS-> RESULT
5.不:〜ABUS-> RESULT
6. MOV:ABUS-> RESULT
7. NOP:无操作
8. ROR8:结果<= SHIFTINPUT(7降至0)&SHIFTINPUT(15至8);
9. ROR4:结果<= SHIFTINPUT(3降至0)&SHIFTINPUT(15降至4);
10. SLL8:结果<= SHIFTINPUT(7降至0) & "00000000";
11. LUT:结果<= LOOKUP TABLE实现的输出
推荐的 甚高密度脂蛋白项目:
1. 什么是FPGA? 甚高密度脂蛋白如何在FPGA上工作
2. FIFO存储器的VHDL代码
3. FIR滤波器的VHDL代码
4. 8位微控制器的VHDL代码
5. 矩阵乘法的VHDL代码
6. 开关尾环计数器的VHDL代码
7. FPGA上数字闹钟的VHDL代码
8. 8位比较器的VHDL代码
9. 如何使用VHDL将文本文件加载到FPGA中
10. D触发器的VHDL代码
11. 完整加法器的VHDL代码
12. 具有可变占空比的VHDL中的PWM发生器
13. ALU的VHDL代码
14. 带测试平台的计数器的VHDL代码
15. 16位ALU的VHDL代码
16. 甚高密度脂蛋白中的移位器设计
17. 甚高密度脂蛋白中的非线性查找表实现
18. 甚高密度脂蛋白中的密码协处理器设计
19 Verilog和VHDL:通过示例解释
20 FPGA上时钟分频器的VHDL代码
21 如何生成时钟使能信号而不是创建另一个时钟域
22 甚高密度脂蛋白代码,用于反跳FPGA上的按钮
23。 交通信号灯控制器的VHDL代码
24 用于简单2位比较器的VHDL代码
25岁 单端口RAM的VHDL代码
22 甚高密度脂蛋白代码,用于反跳FPGA上的按钮
23。 交通信号灯控制器的VHDL代码
24 用于简单2位比较器的VHDL代码
25岁 单端口RAM的VHDL代码
26 使用FSM的停车场系统的VHDL代码
27。 甚高密度脂蛋白编码与软件编程
协处理器组合逻辑单元的VHDL代码:
library IEEE; use IEEE.STD_LOGIC_1164.ALL; -- fpga4student.com: FPGA projects, Verilog projects, 甚高密度脂蛋白项目 -- 甚高密度脂蛋白项目: Cryptographic 协处理器 Design in 甚高密度脂蛋白 -- 甚高密度脂蛋白 code for Combinational Logic unit of the 协处理器 entity structural_VHDL is port ( A_BUS: in std_logic_vector(15 downto 0); B_BUS: in std_logic_vector(15 downto 0); CTRL: in std_logic_vector(3 downto 0); 结果: out std_logic_vector(15 downto 0) ); end structural_VHDL; architecture Behavioral of structural_VHDL is component non_linear_lookup is port ( LUTIN: in std_logic_vector(7 downto 0); LUTOUT: out std_logic_vector(7 downto 0) ); end component non_linear_lookup; component shifter is generic ( N: integer:=16 ); Port ( SHIFTINPUT : in STD_LOGIC_VECTOR(N-1 downto 0); SHIFT_Ctrl : in STD_LOGIC_VECTOR(3 downto 0); SHIFTOUT: out STD_LOGIC_VECTOR(N-1 downto 0) ); end component shifter; component ALU is port ( ABUS: in std_logic_vector(15 downto 0); BBUS: in std_logic_vector(15 downto 0); ALUctrl: in std_logic_vector(3 downto 0); ALUOUT: out std_logic_vector(15 downto 0) ); end component ALU; signal tmp_out1,tmp_out2,tmp_out3: std_logic_vector(15 downto 0); signal lut_out: std_logic_vector(7 downto 0); begin ------------- -- ALU Unit-- ------------- ALU_unit: ALU port map( ABUS => A_BUS, BBUS => B_BUS,ALUctrl => CTRL,ALUOUT => tmp_out1); ----------------- -- Shifter Unit-- ----------------- shifter_unit: shifter generic map ( N => 16) -- shifter port map( SHIFTINPUT => B_BUS, SHIFT_Ctrl => CTRL,SHIFTOUT => tmp_out2 ); ------------------------------------- -- Non-linear Lookup Operation Unit-- ------------------------------------- non_linear_lookup_unit: non_linear_lookup port map( LUTIN => A_BUS(7 downto 0), LUTOUT => lut_out); tmp_out3 <= A_BUS(15 downto 8) & lut_out; ----------------------- -- Control Logic Unit-- ----------------------- control_logic: process(CTRL,tmp_out1,tmp_out3,tmp_out2) begin case(CTRL(3 downto 3)) is when "0" => 结果 <= tmp_out1; when others => case(CTRL(1 downto 0)) is when "11" => 结果 <= tmp_out3; when others => 结果 <= tmp_out2; end case; end case; end process control_logic; end Behavioral;
寄存器文件的VHDL代码:
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.numeric_std.all; -- fpga4student.com: FPGA projects, Verilog projects, 甚高密度脂蛋白项目 -- 甚高密度脂蛋白项目: Cryptographic 协处理器 Design in 甚高密度脂蛋白 -- 甚高密度脂蛋白 code for 16x16 bit Register File( Read/Write Synchronous) entity register_file is port ( clock: in std_logic; -- clock reset: in std_logic; -- reset RdWEn: in std_logic; -- write enable signal RES : in std_logic_vector(15 downto 0); -- write value Ra,Rb,Rd: in std_logic_vector(3 downto 0); -- selected value of Registers Ra, Rb, Rd SRCa,SRCb: out std_logic_vector(15 downto 0) -- read value ); end register_file; architecture Behavioral of register_file is type mem_type is array(0 to 15) of std_logic_vector(15 downto 0); signal REG_FILE: mem_type :=( -- memory initialization 0 => x"0001", 1 => x"c505", 2 => x"3c07", 3 => x"4d05", 4 => x"1186", 5 => x"f407", 6 => x"1086", 7 => x"4706", 8 => x"6808", 9 => x"baa0", 10 => x"c902", 11 => x"100b", 12 => x"c000", 13 => x"c902", 14 => x"100b", 15 => x"B000", others => (others => '0') ); begin ---------------------------------- -- Write Operation (Synchronous)-- ---------------------------------- write_operation: process(clock) begin if(rising_edge(clock)) then if(RdWEn='1') then -- Write when RdWEn = '1' REG_FILE(to_integer(unsigned(Rd))) <= RES; end if; end if; end process; ---------------------------------- -- Read Operation (Synchronous)-- ---------------------------------- read_operation: process(clock) begin if(rising_edge(clock)) then if(reset='1') then SRCa <= x"0000"; SRCb <= x"0000"; else SRCa <= REG_FILE(to_integer(unsigned(Ra))); SRCb <= REG_FILE(to_integer(unsigned(Rb))); end if; end if; end process; end Behavioral;
完整协处理器的VHDL代码:
library IEEE; use IEEE.STD_LOGIC_1164.ALL; -- fpga4student.com: FPGA projects, Verilog projects, 甚高密度脂蛋白项目 -- 甚高密度脂蛋白项目: Cryptographic 协处理器 Design in 甚高密度脂蛋白 -- Complete Processor in 甚高密度脂蛋白 entity Co_Processor is port ( clock, reset: in std_logic; -- clock and reset CTRL: in std_logic_vector(3 downto 0); -- Control Opcode Ra, Rb, Rd: in std_logic_vector(3 downto 0) -- Ra, Rb: Source Registers, Rd: Destination Register ); end Co_Processor; architecture Behavioral of Co_Processor is
-- Register file in 甚高密度脂蛋白 component register_file is port ( clock: in std_logic; reset: in std_logic; RdWEn: in std_logic; RES : in std_logic_vector(15 downto 0); -- write value Ra,Rb,Rd: in std_logic_vector(3 downto 0); -- selected value of Registers Ra, Rb, Rd SRCa,SRCb: out std_logic_vector(15 downto 0) -- read value ); end component register_file;
-- Combinational logic in 甚高密度脂蛋白 component structural_VHDL is port ( A_BUS: in std_logic_vector(15 downto 0); B_BUS: in std_logic_vector(15 downto 0); CTRL: in std_logic_vector(3 downto 0); 结果: out std_logic_vector(15 downto 0) ); end component structural_VHDL; signal Write_Enable: std_logic; signal read_data1,read_data2,write_data:std_logic_vector(15 downto 0); signal ctrl_tmp: std_logic_vector(3 downto 0); signal Rd_tmp: std_logic_vector(3 downto 0); begin -- 16x 16-bit Register file in 甚高密度脂蛋白 Register_file_16x16: register_file port map( clock=> clock, reset => reset , RdWEn => Write_Enable, RES => write_data, Ra => Ra, Rb => Rb, Rd => Rd_tmp, SRCa => read_data1, SRCb => read_data2); -- Combinational logic in 甚高密度脂蛋白 Combinational_logic: structural_VHDL port map( A_BUS=>read_data1, B_BUS => read_data2, CTRL => ctrl_tmp, 结果 => write_data); --- input register 甚高密度脂蛋白 process(clock,reset) begin if(rising_edge(clock)) then if(reset = '1') then ctrl_tmp <= x"0"; Rd_tmp <= x"0"; else Rd_tmp <= Rd; ctrl_tmp <= CTRL; if(ctrl_tmp = "0111") then -- NOP Instruction -- DO not allow to write to the Register file Write_Enable <= '0'; else Write_Enable <= '1'; end if; end if; end if; end process; end Behavioral;
加密协处理器的VHDL Testbench代码:
LIBRARY ieee; USE ieee.std_logic_1164.ALL; -- fpga4student.com: FPGA projects, Verilog projects, 甚高密度脂蛋白项目 -- 甚高密度脂蛋白项目: Cryptographic 协处理器 Design in 甚高密度脂蛋白 -- 甚高密度脂蛋白 Testbench Code to verify the 协处理器 ENTITY test_program IS END test_program; ARCHITECTURE behavior OF test_program IS -- Component Declaration for the 协处理器 COMPONENT Co_Processor PORT( clock : IN std_logic; reset : IN std_logic; CTRL : IN std_logic_vector(3 downto 0); Ra : IN std_logic_vector(3 downto 0); Rb : IN std_logic_vector(3 downto 0); Rd : IN std_logic_vector(3 downto 0) ); END COMPONENT; --Inputs signal clock : std_logic := '0'; signal reset : std_logic := '0'; signal CTRL : std_logic_vector(3 downto 0) := (others => '0'); signal Ra : std_logic_vector(3 downto 0) := (others => '0'); signal Rb : std_logic_vector(3 downto 0) := (others => '0'); signal Rd : std_logic_vector(3 downto 0) := (others => '0'); -- Clock period definitions constant clock_period : time := 20 ns; BEGIN -- fpga4student.com: FPGA projects, Verilog projects, 甚高密度脂蛋白项目 -- 甚高密度脂蛋白项目: Cryptographic 协处理器 Design in 甚高密度脂蛋白 -- Instantiate the 协处理器 uut: Co_Processor PORT MAP ( clock => clock, reset => reset, CTRL => CTRL, Ra => Ra, Rb => Rb, Rd => Rd ); -- Clock process definitions clock_process :process begin clock <= '0'; wait for clock_period/2; clock <= '1'; wait for clock_period/2; end process; stim_proc: process begin -- hold reset state for 100 ns. reset <= '1'; Ra <= "0000"; Rb <= "0000"; Rd <= "0000"; CTRL <= "0111"; wait for 100 ns; reset <= '0';--- ADD R5,R4, R12 Ra <= "0101"; Rb <= "0100"; Rd <= "1100"; CTRL <= "0000"; wait for clock_period; Ra <= "0001"; --- XOR R1,R8,R7 Rb <= "1000"; Rd <= "0111"; CTRL <= "0100"; wait for clock_period; Ra <= "0001"; --- ROR4 R12,R0 Rb <= "1100"; Rd <= "0000"; CTRL <= "1001"; wait for clock_period; Ra <= "0001"; --- SLL8 R9,R3 Rb <= "1001"; Rd <= "0011"; CTRL <= "1010"; wait for clock_period; Ra <= "0000"; --- ADD R0,R7,R10 Rb <= "0111"; Rd <= "1010"; CTRL <= "0000"; wait for clock_period; Ra <= "0111"; --- SUB R7,R3,R12 Rb <= "0011"; Rd <= "1100"; CTRL <= "0001"; --- NOP -- CTRL <= "0111"; wait for clock_period; Ra <= "1100"; --- AND R12,R10,R9 Rb <= "1010"; Rd <= "1001"; CTRL <= "0010"; --- NOP -- CTRL <= "0111"; wait for clock_period; Ra <= "1001"; --- LUT R9,R2 Rb <= "1010"; Rd <= "0010"; CTRL <= "1011"; wait; end process; END;
密码协处理器的仿真波形:

甚高密度脂蛋白中的密码协处理器已使用VHDL测试平台进行了完整验证。您可以尝试许多不同的测试程序,以查看协处理器的工作方式。除了观察仿真波形外,还要查看寄存器文件的存储器内容,以了解指令如何影响寄存器文件。
您可能会这样:
1. 什么是FPGA? 甚高密度脂蛋白如何在FPGA上工作
2. FIFO存储器的VHDL代码
3. FIR滤波器的VHDL代码
4. 8位微控制器的VHDL代码
5. 矩阵乘法的VHDL代码
6. 开关尾环计数器的VHDL代码
7. FPGA上数字闹钟的VHDL代码
8. 8位比较器的VHDL代码
9. 如何使用VHDL将文本文件加载到FPGA中
10. D触发器的VHDL代码
11. 完整加法器的VHDL代码
12. 具有可变占空比的VHDL中的PWM发生器
13. ALU的VHDL代码
14. 带测试平台的计数器的VHDL代码
15. 16位ALU的VHDL代码
16. 甚高密度脂蛋白中的移位器设计
17. 甚高密度脂蛋白中的非线性查找表实现
18. 甚高密度脂蛋白中的密码协处理器设计
19 Verilog和VHDL:通过示例解释
20 FPGA上时钟分频器的VHDL代码
21 如何生成时钟使能信号而不是创建另一个时钟域
22 甚高密度脂蛋白代码,用于反跳FPGA上的按钮
23。 交通信号灯控制器的VHDL代码
24 用于简单2位比较器的VHDL代码
25岁 单端口RAM的VHDL代码
22 甚高密度脂蛋白代码,用于反跳FPGA上的按钮
23。 交通信号灯控制器的VHDL代码
24 用于简单2位比较器的VHDL代码
25岁 单端口RAM的VHDL代码
26 使用FSM的停车场系统的VHDL代码
27。 甚高密度脂蛋白编码与软件编程
我可以在哪个应用程序中使用此冰晶协处理器
回复删除密码学应用
删除此代码中使用哪种算法?
回复删除