赞
踩
往往可以通过获取xilinx芯片的DNA,然后再进一步加密运算,就可以实现代码的加密。具体获取DNA的代码如下所示:
- module dna_read(
- input sys_clk,
- input rst_n,
- output [95:0] dna_read_data,
- output dna_read_vld
- );
-
- wire dna_dout;
- wire dna_read;
- wire dna_shift;
-
- DNA_PORTE2 #(
- .SIM_DNA_VALUE(96'h0)
- )
- DNA_PORTE2_inst (
- .DOUT(dna_dout),
- .CLK(sys_clk),
- .DIN(dna_dout),
- .READ(dna_read),
- .SHIFT(dna_shift)
- );
-
- reg [95:0] dna_reg = 0;
- reg [7:0] dna_cnt = 0;
-
- always@(posedge sys_clk or negedge rst_n)
- begin
- if(!rst_n)
- dna_cnt <= 0;
- else
- dna_cnt <= dna_cnt+1;
- end
- assign dna_read =(dna_cnt==8'd63)?1'b1:1'b0;
- assign dna_shift =((dna_cnt>=8'd100)&&(dna_cnt<=8'd195))?1'b1:1'b0;
-
- always@(posedge sys_clk or negedge rst_n)
- begin
- if(!rst_n)
- dna_reg <= 0;
- else
- dna_reg <= {dna_dout,dna_reg[95:1]};
- end
-
- assign dna_read_data =dna_reg;
- assign dna_read_vld =(dna_cnt==8'd196)?1'b1:1'b0;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。