Code encryption is very important to IP and plays a role in protecting intellectual property. VCS provides code encryption capabilities, and of course, code that uses VCS encryption can only be used in VCs.
Method 1: The code is added to the compiler code protection directives, the code between the instructions will be encrypted, VCS encryption using the AES128 algorithm.
For Verilog code, the compiler directive is: ' protect128/' ENDPROTECT128;VHDL is--protect128/--endprotect128. Method 1 provides precise control over the code that you want to encrypt.
Take a simple counter code COUNTER.V for example, before encrypting:
' Timescale 1ns/10psModuleCounter (inputCLK,inputReset,inputEnable,Output Reg[3:0] count); ' Protect128 always@(PosedgeAlor Posedgereset)begin if(reset)beginCount<=4'B0; End Else if(enable)beginCount<= count+1'B1; End End' endprotect128Endmodule
To compile the source code using VCS:
VCs +v2k-protect128 counter.v
#对于verilog代码, VCs can be replaced with Vlogan command, VHDL code, VCS can be replaced by Vhdlan
Get the encrypted code COUNTER.VP, as follows:
' Timescale 1ns/10psModuleCounter (inputCLK,inputReset,inputEnable,Output Reg[3:0] count); ' protected128p=o! (8k9"Z (9u*$ XQ) X ' (23xps9d"AYL7"[email protected] (BI. Xq%kk3.&<_=a7b:yt<exa,aP>"o8>=h+5=.<//lj2$ji3r*&c;3+? H589",? _8'[email protected] (u2p[u!=i\/\k/'?br9c_p[y#n+ko$c'e=>6t6 (my>%a:0_mx^6%5:j #7 (6?-bvsm9&'#3\+ -2bh+?#0WP^i"tkl,=p#fy17^u) Pt? S3mo&fw/1it#p (F) t2-iiv;*lv ' Cu/:,<>it^2#0xa_ 'p$ ([[6%!] Kb"FQM-?! 8saa! M40]13*<f (<d0 () [$]k"3>N\2IYQ=,1Z=X,4X]?P ' endprotected128Endmodule
By default,. VP and Source code in the same directory, you can use the-putprotect128 command to instruct a directory to store the encrypted code.
Method 2: Use the vcs command parameter:
-AUTOPROTECT128: The code that encrypts the entire module includes a list of ports, leaving only the module name, using the following method:
VCs +v2k-autoprotect128 counter.v
The resulting encryption code is:
' Timescale 1ns/10psModulecounter ' protected128pf4^7ab<l6->upq]o['e/8:^.! 2P'7=\,) (x=_e0\nv;_"<z&\35 (=/hqcf#b> $UPw7$? Y.'_o.8/x*zq.^yqw&7p2 "Bf94*_. M=/? Ey:!? &THI\;>J) ze[z (\tflt. UMP! Pj]ji'y1k "EK (91we=o4w0'[Vwsdb93n/n*v:/u+\/,!=f6 (@J4TP &?/! L?"ds=Pb_zv8cj32'=: #10STRA4LV_ ^+ (j_-.$3uvbii:@m,5-y,*^;^_,,u%3wig%hw*e=p/:D NGO"u^ HUKYGT2; Mwx[q8ju*? ys%@=* $ZCW (hu0n8cc2k&+6+a&l%<<&-n]h/PXO#E4,U0] -^aj0_^0pt$-"#+ $H 6x6k+) E1^0jv%4;1f-3za8+]gfdd0:l"LI[SP-ZZ) Tsfekp84&a[p<w4pr7g&4n6j[,og (L"++ho,];6w ' K?%xc0jxvl&0#^*b,_' endprotected128Endmodule
-auto2protect128: Keep the list of ports and UDP, the resulting encryption code is as follows:
' Timescale 1ns/10psModuleCounter (inputCLK,inputReset,inputEnable,Output Reg[3:0] count); ' Protected128pd# -/! xjba!* ($N 0s>[email protected]) =CZ1LG,,-) LAXQ'i_x;/bt+yyn9t%8v\^ *[email protected]P[-h_ow#e"^5+,&9>h+2=&ii*y?-ai5! $NX) P;%i 6; Zpz==ona4:,? R4yyj\? DFPl'$YOC%jo>) X5a0qs4./-q (2.7y^[email protected]:l,i "q>) qzw (9fowk%<us>yx0=^p ^" @6up_yf6z29dw4p#-$*,6(ljm04_-^='a\m;5%? V!_s?__wd>&12.>. oj[9t_-mut% #RP0?>8+,wi&ny-u&m9&hj4k9+zt<$>py j8fe+9>&8s"2=m' endprotected128Endmodule
-AUTO3PROTECT128: Similar to-auto2protect128, only the parameters defined by the Verilog parameter are preserved.
VCS emulator encryption Code method