使用modelsim的宏定义指令protect...
endprotect加密方式实现对代码的加密保护
1、开启modelsim的protect选项
2、代码中需要加密部分使用protect ...
endprotect
module test(
input clk,
input rst,
output data_out
);
reg [7:0]cnt;
`protect
always@(posedge clk or negedge rst)
if(!rst)
cnt <= 'd0;
else
cnt <= cnt + 1;
assign data_out = cnt[7];
`endprotect
endmodule
3、使用vlog +protect test.v 编译代码,在work库下即生成了加密后文件test.vp。