...
- Users may wish to conceal IP when working in the UCM on a Windows target, More and more users build models in the Windows version of HYPERSIM and would like to verify the result offline first.
- In this case, knowing how to create a library on a Windows target becomes necessary.
- Note that the variable {HYPERSIM_DIR} is in this case the installation directory of HYPERSIM. By default, it should be something like: C:\OPAL-RT\HYPERSIM\hypersim_R6.0.XX.oYYY
- Note that the variable {TOOLS_MINGW} is in this case the installation directory of HYPERSIM. By default, it should be something like C:\OPAL-RT\HYPERSIM\tools\MinGW\X.X.X
- Note that the library paths are absolute. Each time the library file path is changed (it is moved or the simulation is used on another computer), the paths in the .def file must be updated.
...
- Open a command-line window and go to the directory where your C code is located
- Generate the .o file by replacing 'test' below with your filename
{HYPERSIMTOOLS_DIR}\Windows\MinGW\bin\MINGW}/bin/gcc -c test.c -o test.o
- Generate the dll file using the following command.
- By convention, the DLL file should be lib{name of your lib}.dll.
- In this case the library name is test. The .lib file name is
{HYPERSIMTOOLS_DIR}\Windows\MinGW\bin\MINGW}/bin/gcc -shared -o libtest.dll test.o
...
=libtest.dll:
UCM_SIMULATION_LIBRARIES_WINDOWS = -LC:/Users/user_name/test_code/ -llibtest
- Then in the Definitions section, add the function you want to import. In this case, the function is myFunc
...
- Open a command-line window and go to the directory where your C code resides
- Generate the .o file by replacing test with your filename
{HYPERSIMTOOLS_DIRMINGW}\Windows\MinGW\bin\ gcc -c test.c -o test.o
- Generate the lib file using the following, replacing libtest and test as required
{HYPERSIMTOOLS_DIRMINGW}\Windows\MinGW\bin\ar -rcs libtest.lib test.o
...
%% BEGIN AFTER VOLTAGE CALCULATION -- Enter code ->...
out12 = myFunc(in12);
LINUX Target: Using a Dynamic/Static Library to Hide IP
...
in the User-Coded Model
- Get the C and head file ready.
- The C file contains the intellectual property, and the head file calls the function in the C file.
- For example, the C code below contains an add function which we want to hide.
...
- If you want to use a dynamic library, type command gcc -shared -o xxx.so xxx.o (xxx.so is the name of the dynamic library file, and xxx.o is the objective file you just created)
- The dynamic library xxx.so is created
- If you want to use a static library, type command ar rcs xxx.a xxx.o (xxx.a is the name of the static library file, and xxx.o is the objective file you just created)
- The static library xxx.a is created
...