Encrypted IP Support
Support for encrypting / decrypting IPs (IEEE 1735-2023)
AMIQ tools support IEEE 1735-2023 (v3) standard. You can encrypt SystemVerilog / Verilog code with the dvt_encrypt.sh utility and you can use the encrypted files in DVT IDE, DVT MCP, Verissimo and Specador.
Note
Decryption is supported only on Linux (amd64 and arm64).
IEEE 1735 license management is not supported.
IEEE 1735 rights management is not implemented.
Information for IP users
To use an encrypted IP follow these steps:
Contact the IP vendor and request an IP distribution encrypted for AMIQ tools.
The vendor will send the encrypted IP together with a dvtlmd license increment corresponding to the key used for encryption. If the IP is encrypted using the built-in public key you can also obtain the dvtlmd license increment from AMIQ.
Add the dvtlmd license increment in the dvtlmd FlexLM license file.
Use the encrypted IP in AMIQ’s tools.
Information for IP vendors
To encrypt an IP for AMIQ tools follow these steps:
Decide if the IP will be encrypted using the built-in public key or a Vendor/IP specific public key based on your security requirements.
If the built-in public key is used, request AMIQ to send you the corresponding dvtlmd license increment to be able to test the encryption.
If a Vendor/IP specific public key is used, request AMIQ to generate it. You will receive a public key and its corresponding dvtlmd license increment.
Add the dvtlmd license increment in the dvtlmd FlexLM license file.
Encrypt the IP using dvt_encrypt.sh following the best practices for selecting which code to encrypt.
Test that the resulting IP can be compiled in AMIQ’s tools.
Send the encrypted IP to the user.
If the built-in public key is used, tell the user to request the corresponding dvtlmd license increment from AMIQ.
If a Vendor/IP specific public key is used, you must send the corresponding dvtlmd license increment to the IP users.
Support for IPs encrypted for other tools
The DVT compiler safely skips encrypted regions of code that are not encrypted for DVT IDE. Ideally IP source code should be compiled without errors by any third party tools. However, some IPs may not be properly encrypted, and lead to false errors. Most of the time this happens due to:
Asymmetric encryption - for example when endmodule or endif is inside the encrypted code while the corresponding module or ifdef is outside the encrypted region. In this situation DVT may signal errors for mismatched language tokens, for example “Unexpected token ‘endmodule’”. Furthermore some of the types may end up being compiled in the wrong scope altogether.
Public encrypted API - for example when the definition of a macro, class, or function is encrypted while still being referenced outside the encrypted region.
Note
How come a simulator works fine in such cases? Because as simulator decrypts the code if you have the proper licenses.
To restore full or partial functionality you can employ one or more of the following solutions:
Kindly ask the IP provider to fix the encryption issues. The SystemVerilog language provides dedicated constructs for this type of encapsulation, such as forward typedefs and extern methods placed in non-encrypted header files.
Instruct DVT to automatically close scopes in encrypted files. The automatic closing of scopes will take place in all files that contain encrypted code and whose full path matches the provided pattern.
+dvt_encrypted_code_auto_close+/path/pattern/*
+dvt_encrypted_code_auto_close+not+/path/pattern/to/exclude/*
Instruct DVT to automatically define non-existing API. These functions and fields that are accessed within the specified files will be automatically defined with the appropriate signature.
The definition will be placed in the closest scope which is defined in a file containing encrypted code.
+dvt_encrypted_code_auto_api+/path/pattern/*
+dvt_encrypted_code_auto_api+not+/path/pattern/to/exclude/*
Macros whose name matches the macro regular expression are automatically defined at project level.
+dvt_encrypted_code_auto_macro+name_regex
Note
All +dvt_encrypted_code_auto inclusion directives are applied first, followed by the exclusion (_not) patterns. Any number of such directives can be specified. The directives are global.
Particularly for Synopsys encrypted IPs, instruct DVT to load a predefined set of macro definitions and waivers using the following directives:
+dvt_auto_snps_vip_macros Generate and load in each invocation .dvt/auto_snps_vip_macros.svh file. It contains dummy definitions for macros which are commonly used but not defined or encrypted in Synopsis IPs.
+dvt_auto_snps_vip_waivers Generate and load .dvt/auto_snps_vip_waivers.xml file. It contains waivers for problems commonly encountered when working with encrypted Synopsis IPs.
As a last resort, you can manually fix the encryption
The encrypted code can be fixed on a case by case basis, for example by adding the missing endmodule, endclass, `endif etc, declaring dummy prototypes of the missing API (classes, functions, fields and so on).
To avoid changing the original files, you will have to substitute the original broken files with the fixed ones.
Start by choosing a suitable directory to store the DVT substitute files. Often, they can be used across projects, so the directory should be outside of any DVT project directory in particular. You can define an environment variable to point to the chosen directory, like $DVT_FIXES.
For every file that needs to be fixed do:
Copy the file to $DVT_FIXES as is.
Modify
$DVT_FIXES/filewith the necessary fixes.- Tell DVT to use
$DVT_FIXES/fileas a substitute to file.This means adding to the default.build the following All Build Directives :+dvt_file_substitute+/path/to/file=$DVT_FIXES/file
Having done the above, DVT will use the substitute files and offer valuable functionality, like hyperlinks, type hierarchy, references in the now correctly compiled code.
Note
The +dvt_file_substitute directive accepts only absolute paths as arguments. Environment variable can be used to define the absolute paths. Regular expressions are not supported.
Encryption best practices
When selecting code to encrypt, follow these best practices to keep the encrypted output compatible with tools that cannot decrypt it.
Do not break scoping with encryption.
✗ Wrong
`pragma protect begin
int vip_class_variable;
task vip_task();
endtask : vip_task
endclass
`pragma protect end
✓ Correct
class vip_class;
`pragma protect begin
int vip_class_variable;
task vip_task();
endtask : vip_task
`pragma protect end
endclass
Do not encrypt macro declarations if used in unencrypted code.
✗ Wrong
`pragma protect begin
`define VIP_PUBLIC_MACRO(param1, param2) ((param1)+(param2))
`pragma protect end
class vip_class;
int x, y, s;
function foo();
// NOT OK because the declaration of macro 'VIP_PUBLIC_MACRO' is encrypted
s = `VIP_PUBLIC_MACRO(x, y);
endfunction
endclass
✓ Correct
`define VIP_PUBLIC_MACRO(param1, param2) ((param1)+(param2))
class vip_class;
int x, y, s;
function foo();
// OK because the declaration of macro 'VIP_PUBLIC_MACRO'
// is not encrypted
x = `VIP_PUBLIC_MACRO(x, y);
endfunction
endclass
Do not encrypt variable declarations if used in unencrypted code.
✗ Wrong
class vip_class1;
`pragma protect begin
bit enabled;
int state;
`pragma protect end
endclass
class vip_class2;
vip_class1 c;
function main();
// NOT OK because the declaration of ‘enabled' is
// declared inside encrypted code
c.enabled = 1;
endfunction;
endclass
✓ Correct
class vip_class1;
bit enabled;
`pragma protect begin
// OK because it is used only inside encrypted code
int state;
`pragma protect end
endclass
class vip_class2;
vip_class1 c;
function main();
// OK because the declaration 'enabled' is not encrypted
c.enabled = 1;
`pragma protect begin
// OK because it is declared and used inside encrypted regions
c.state = 1;
`pragma protect end
endfunction;
endclass
Use extern to declare tasks and functions if used in unencrypted code.
✗ Wrong
class vip_class1;
`pragma protect begin
function void vip_function();
endfunction
`pragma protect end
endclass
class vip_class2;
vip_class1 c;
function main();
// NOT OK because the declaration of vip_function is encrypted
c.vip_function();
endfunction
endclass
✓ Correct
class vip_class1;
extern function void vip_function();
endclass
`pragma protect begin
function void vip_class1::vip_function();
endfunction
`pragma protect end
class vip_class2;
vip_class1 c;
function main();
// OK because the extern declaration of 'vip_function'
// is not encrypted
c.vip_function();
endfunction;
endclass
Use typedef for type declarations if used in unencrypted code.
✗ Wrong
`pragma protect begin
class vip_class1;
endclass
`pragma protect end
class vip_class2;
// NOT OK because the declaration of vip_class1 is encrypted
vip_class1 c;
endclass
✓ Correct
typedef class vip_class1;
`pragma protect begin
class vip_class1;
endclass
`pragma protect end
class vip_class2;
// OK because the declaration of vip_class1 is not encrypted
vip_class1 c;
endclass