This article demonstrates a use case for the Verilog-A electro-optic co-simulation workflow using Lumerical CML Compiler to generate Verilog-A models for OptoCompiler. In This article, we demonstrate the process of building a photonic Verilog-A library for OptoCompiler using CML Compiler, and running simulations using PrimeSim HSPICE and PrimeSim SPICE.
For further information on setting up this workflow for a generic use case, including settings in CML Compiler, see the Photonic Verilog-A for OptoCompiler page.
Requirements
Prior to starting this example, follow the instructions in this Knowledge Base article to set up your software and environment. This example uses Lumerical products 2026 R1.2 release, and Synopsys 2026.03-SP1 release.
A test package is to this article, which contains necessary files. Download and extract this package prior to starting the example. Ensure that the full path to this package does not contain any white spaces, and ensure that you do not change the relative path of folders inside the package.
The extracted package contains the following directories.
- /Compact_Modeling/
- Contains the custom library to install and build using CML Compiler.
- /PAM4_Tranceiver_Example/
- Contains the PAM4 workbench to run simulations with PrimeSim.
Example summary
There are three key steps key steps for running an electro-optical co-simulation utilizing photonic Verilog-A with PrimeSim:
- Building the OptoCompiler photonic Verilog-A library using CML Compiler
- Running the simulation on OptoCompiler
- Display eye-diagram results using WaveView
Step 1 – Build photonic Verilog-A library in CML Compiler
In this step, we will build the custom library using CML Compiler for OptoCompiler
- Launch CML Compiler using the command
cmlc & - Redirect the Library Path of CML Compiler to the custom library folder in the downloaded package.
- Switch the toggle to Verilog-A on the top toolbar.
- Press Edit Library, and ensure that the Platform is Synopsys, and that Symbol Generation is checked. This makes generated models PrimeSim compatible, and generates symbols for import into OptoCompiler.
- Select all elements using the checkmark column in the Element Status Center, and press Build Tests->Build Tests + Prev Steps from the top toolbar to build the Verilog-A models. You can access this menu via the arrow beside the Build Tests button. Ensure that the build is successful by looking at the output.
- (Optional) Ensure that all elements are selected, and press Run Tests -> Run Test from the top toolbar. You can access this menu via the arrow beside the Run Tests button. Without addition settings, this runs the generated Verilog-A models with PrimeSim HSPICE to verify their accuracy, and may take some time.
Note: You can also use PrimeSim SPICE to verify the models. To do so, provide"qa_solver":"PSPICE"under the “verilogA” key in the library JSON file, which is found in<Compact_Modeling >/lumfoundry_template/lumfoundry_template.json.
Model generation is now complete, and you can find the generated artifacts for import under the Compact_Modeling /lumfoundry_template/artifacts/veriloga/models folder, and the symbols as well as the lib.defs file under Compact_Modeling /lumfoundry_template/artifacts/OptoCompiler_VerilogA. You will need to add these model files to OptoCompiler in the next step.
Step 2a – Setup and run simulation using PrimeSim HSPICE
- Navigate to the
/PAM4_Transceiver_Example/directory and launch OptoCompiler there withoptocompiler &. - Add the following libraries to OptoCompiler using the Library Definitions Editor if they are not already added:
- lumfoundry_template and lumfroundry_template_primitive: These were built using CML Compiler in the previous step and is found under
Compact_Modeling/artifacts/OptoCompiler_VerilogA - analogLib: This is included in the Synopsys software install and is found under
<Synopsys tools installation directory>/customcompiler/<version>/auxx/samples
- lumfoundry_template and lumfroundry_template_primitive: These were built using CML Compiler in the previous step and is found under
- Open the schematic view under the PAM4_Transceiver_Testbench cell in the PAM4_Transceiver library.
- Open the HSPICE_default view in the PAM4_Transceiver_TestBench cell. Click Setup->Simulator, and choose PrimeSim as the simulator.
- Click Setup->Model Files, ensure that the following is set and that there is no error indicated by a red box around the path.
- Press Simulation->Options to open the Simulation Options window, and set the Simulation Engine to PrimeWave HSPICE.
- Press More Options in the Simulation Options window from the previous step, set the Category to All, and set the variable DELMAX to 1e-11. This sets the maximum simulation time step.
- In the view window, set wavelength variables. These variables corresponds to the wavelengths for the photonic Verilog-A models and are named
wavelength<x>. For this example, setwavelength1andwavelength2to1.55u. - Add a transient analysis by right-clicking the analysis window in the top right of the view window and add a transient simulation as follows. The example workbench already adds this simulation.
- Setup output variables, it can either be an electrical signal, like the it is set up for
I_ph_hspiceandeye_hspice, or an optical signal likepower_hspice. You can only view optical signals for transient analyses.
Note: For optical signals, OptoCompiler uses the calculator expression ph. This expression uses the syntaxph(port, mode, portType, channel). The argumentsportandmodeare mandatory,portTypeandchannelare optional. The mode argument in this expression marks the mode name, by default, this is populated as te. This mode name is equivalent to mode identifiers in INTERCONNECT, such that te is equivalent to identifier 1, and tm is equivalent to identifier 2. If you do not have any TM sources in the schematic, no TM results will be available and attempting to plot them using tm as the second argument in ph will result in an error. For more information, please see the OptoCompiler documentation page Specifying Photonic Probe Using the PrimeWave RA Calculator.
- Click Simulation->Netlist and Run to run the simulation.
Simulation setup and running is now complete and you can now visualize the results.
Step 2b – Setup and run simulation using PrimeSim SPICE
The steps for using PrimeSim SPICE is nearly identical to that of using PrimeSim HSPICE, follow the instructions below for PrimeSim SPICE.
- Follow the steps above in the Step 2a section to open OptoCompiler, but open the SPICE_default view from the PAM4_Transceiver_Testbench cell in the PAM4_Transceiver library as follows.
- Continue to follow the steps above, except that in PrimeWave Simulation Options, select PrimeSim SPICE as a simulation engine, and set the Max Time Step to the desired maximum simulation time step.
- Continue to follow the steps above and run the simulation with PrimeSim SPICE.
Step 3 – Visualize results in WaveView
The procedure for this step is shared between PrimeSim HSPICE and PrimeSim SPICE.
After the simulation completes, a WaveView window automatically opens and displays the result. You can view the eye diagram by right-clicking on the plot and selecting Configure Eye. In the opened window, set the eye width as 8e-9 and eye shift as 3e-9.
After running both PrimeSim HSPICE and PrimeSim SPICE simulations, you can compare the eye diagrams and verify that they are identical. For further information on how to plot them on the same axis, see the WaveView User Guide.
See Also
Lumerical-OptoCompiler integration