17.2.5 Simulating Your Design

To simulate your design outside of Libero (that is, using your own simulation environment and simulator), perform the following steps:
  1. Design Files
    1. Pre-Synthesis simulation:
      • Import your RTL into your simulation project.
      • For each Component Manifests Report.
        • Import each file under HDL source files for all Synthesis and Simulation tools into your simulation project.
      • Compile these files as per your simulator's instructions.
    2. Post-synthesis simulation:
      • Import your post-synthesis *.edn or *.vm netlist (generated in Synthesizing Your Design) into your simulation project and compile it.
    3. Post-layout simulation:
      • First, complete implementing your design (see Implementing Your Design). Make sure that your final Libero project is in post-layout state.
      • Double-click Generate BackAnnotated Files in the Libero Design Flow window. It generates two files:
        <project directory>/designer/<root>/<root>_ba.v/vhd <project directory>/designer/<root>/<root>_ba.sdf 
      • Import both of these files into your simulation tool.
  2. Stimulus and Configuration files:
    1. For each Component Manifests Report:
      • Copy all files under the Configuration files to be used for all Simulation tools and Stimulus Files for all Simulation Tools sections to the root directory of your Simulation project.
    2. Make sure that any Tcl files in the preceding lists (in step 2.a) are executed first, before the start of simulation.
    3. For SmartFusion 2 only:
      • Review the subsystem.bfm file. Based on your usage of the MDDR, FDDR, or SerDes, make sure that the following lines are present (or absent) in the subsystem.bfm file — their presence indicates that the Component is used in your design. Absence indicates that the Component is not used:
        #----------------------------------- # Peripheral Initialization #-------------------------------------#define USE_MDDR #define USE_FDDR #efine USE_SERDESIF_0 #define USE_SERDESIF_1 #define USE_SERDESIF_2 # define USE_SERDESIF_3 
    4. ENVM_init.mem: If you use the eNVM (SmartFusion 2 or IGLOO 2), or if you use IGLOO 2 and use MDDR, FDDR, or SerDes, you must use the pa4mssenvmgen.exe to generate the ENVM_init.mem file, regardless of whether or not you use eNVM. The pa4mssenvmgen executable takes all the peripheral *init.reg files and the ENVM.cfg file as inputs through a Tcl script file and outputs the ENVM_init.mem file required for simulations. This ENVM_init.mem file is required for component initialization in simulation. This file must be copied to the simulation folder prior to the simulation run. An example showing the pa4mssenvmgen executable usage is provided in the following steps.
    5. UPROM.mem: If you use RTG4 uPROM, you must use the pa4rtupromgen.exe to generate the UPROM.mem file. The pa4rtupromgen executable takes the UPROM.cfg file as inputs through a Tcl script file and outputs the UPROM.mem file required for simulations. This file must be copied to the simulation folder prior to the simulation run. An example showing the pa4rtupromgen executable usage is provided in the following steps.
    6. UPROM.mem (PolarFire): If you use the PolarFire uPROM core in your design with the option Use content for simulation enabled for one or more data storage clients that you wish to simulate, you must use the executable pa4rtupromgen (pa4rtupromgen.exe on windows) to generate the UPROM.mem file. The pa4rtupromgen executable takes the UPROM.cfg file as inputs through a Tcl script file and outputs the UPROM.mem file required for simulations. This UPROM.mem file must be copied to the simulation folder prior to the simulation run. An example showing the pa4rtupromgen executable usage is provided in the subsequent steps below. The UPROM.cfg file will be available in the directory <Project>/component/work/<uPROM component name>/<uPROM instance name> in the Libero project you used to generate the PolarFire uPROM component.
    7. snvm.mem (PolarFire): If you use the PolarFire System Services core in your design and configured the sNVM tab in the core with the option Use content for simulation enabled for one or more clients that you wish to simulate, a snvm.mem file is automatically generated to the directory <Project>/component/work/<PolarFire System Services component name>/<uPROM instance name> in the Libero project you used to generate the PolarFire System Services component. This snvm.mem file must be copied to the simulation folder prior to the simulation run.
  3. Create a working folder and a sub-folder named simulation under the working folder.

    The pa4mssenvmgen and pa4rtupromgen executable expect the presence of the simulation sub folder in the working folder and the *.tcl script (steps 5 and 7) is placed in the simulation sub folder.

  4. For SmartFusion 2 and IGLOO 2 devices, copy all the component *init.reg files and the ENVM.cfg file from the first Libero project (for component generation) into the working folder. Examples of component *init.reg files are:
    1. MDDR_init.reg
    2. FDDR_init.reg
    3. SERDESIF_0_init.reg
    4. SERDESIF_1_init.reg
    5. SERDESIF_2_init.reg
    6. SERDESIF_3_init.reg

    For RTG4, copy the UPROM.cfg file from the first Libero project created for component generation (or the UPROM.cfg file with any modified/updated contents) into the working folder.

    For PolarFire, copy the UPROM.cfg file from the first Libero project created for component generation into the working folder.

  5. For an IGLOO 2 device: Paste the following commands in a *.tcl script and place it in the simulation folder created in step 3.
    Sample*.tcl for IGLOO 2 devices set_device -fam <family_name> -die <internal_die_name> -pkg <internal_pkg_name> set_mddr_reg -path <path_to_MDDR_register_file/MDDR_init.reg> set_fddr_reg -path <path_to_FDDR_register_file/FDDR_init.reg> set_serdesif0_reg -path <path_to_SERDESIF_0_register_file/SERDESIF_0_init.reg> set_serdesif1_reg -path <path_to_SERDESIF_1_register_file/SERDESIF_1_init.reg> set_serdesif2_reg -path <path_to_SERDESIF_2_register_file/SERDESIF_2_init.reg> set_serdesif3_reg -path <path_to_SERDESIF_3_register_file/SERDESIF_3_init.reg> set_input_cfg -path <path_to_ENVM_configuration_file/ENVM.cfg> set_sim_mem -path <path_to_ENVM_Initialization_File/ENVM_init.mem> gen_sim -use_init true 

    For the proper internal name to use for the die and package, see the *.prjx file of the first Libero project (used for component generation).

    For IGLOO 2 device, the argument use_init must be set to true for the gen_sim command if any of the *init.reg files are used.

    Not all *init.reg in the example *.tcl may be needed. Include the reg file paths for only those peripherals used in the design.

    The set_sim_mem command specifies the path to the output file ENVM_init.mem that is generated upon execution of the script file with the pa4mssenvmgen executable.

  6. At the command prompt or cygwin terminal, go to the working directory created in step 3. Execute the pa4mssenvmgen command with the-script option and pass to it the *.tcl script created in step 5.
    For Windows®:
    <Libero_SoC_release_installation>/designer/bin/pa4mssenvmgen.exe \
     --script./simulation/<Tcl_script_name>.tcl
    For Linux®:
    <Libero_SoC_release_installation>/bin/pa4mssenvmgen 
    --script./simulation/<tcl_script_name>.tcl
  7. SmartFusion 2 device: Paste the following commands in a *.tcl script and place it in the simulation folder created in step 3.
    Sample *.tcl for SmartFusion 2 devices
    set_device -fam <family> -die <internal_die_name> -pkg <internal_pkg_name>
    set_input_cfg -path <path_to_ENVM.cfg> 
    set_sim_mem -path <path_to_ENVM_Initialization_File/ENVM_init.mem> 
    gen_sim -use_init false
    

    For the proper internal name to use for the die and package, see the *.prjx file of the first Libero project (used for component generation).

    The argument use_init must be set to false for SmartFusion 2.

    For SmartFusion 2 device, the set_mddr_reg, set_fddr_reg, and set_serdesif(x)_reg commands are not needed. All the peripheral register initialization information/data required to run simulations is a part of the *_init.bfm files (listed in the Component Manifests reports of each component), which must be copied from the first Libero SoC project (used for component generation) to the top level directory of your simulation project (outside of Libero SoC).

    Use the set_sim_mem command to specify the path to the output file ENVM_init.mem that is generated upon execution of the script file with the pa4mssenvmgen executable.

  8. At the command prompt or cygwin terminal, go to the working directory created in step 1. Execute the pa4mssenvmgen command with the-script option and pass to it the *.tcl script created in step 7.
    For Windows:
    <Libero_SoC_release_installation>/designer/bin/pa4mssenvmgen.exe \
     --script./simulation/<Tcl_script_name>.tcl
    For Linux:
    Libero_SoC_release_installation>/bin/pa4mssenvmgen
     --script./simulation/<tcl_script_name>.tcl
  9. RTG4: Paste the following commands in a *.tcl script and place it in the simulation folder created in step 3.
    Sample *.tcl for RTG4 devices to generate URPOM.mem file from UPROM.cfg
    set_device -fam <family> -die <internal_die_name> -pkg <internal_pkg_name> 
    set_input_cfg -path <path_to_UPROM.cfg> 
    set_sim_mem -path <path_to_UPROM_Initialization_File/UPROM.mem> 
    gen_sim -use_init false 
    

    For the proper internal name to use for the die and package, see the *.prjx file of the first Libero project (used for component generation).

    For RTG4, there is a provision to simulate the UPROM by specifying the UPROM.cfg file using the set_input_cfg command.

    Use the set_sim_mem command to specify the path to the output file UPROM.mem that is generated upon execution of the script file with the pa4rtupromgen executable.

  10. At the command prompt or cygwin terminal, go to the working directory created in step 3. Execute the pa4mssenvmgen command with the-script option and pass to it the *.tcl script created in step 9.
    For Windows:
    <Libero_SoC_release_installation>/designer/bin/pa4rtupromgen.exe
     --script./simulation/<Tcl_script_name>.tcl 
    For Linux:
    <Libero_SoC_release_installation>/bin/pa4rtupromgen
     --script./simulation/<tcl_script_name>.tcl
  11. PolarFire: Paste the following commands in a *.tcl script and place it in the simulation folder created in step 3.
    Sample *.tcl for PolarFire devices to generate URPOM.mem file from UPROM.cfg
    set_device -fam <family> -die <internal_die_name> -pkg <internal_pkg_name> 
    set_input_cfg -path <path_to_UPROM.cfg> 
    set_sim_mem -path <path_to_UPROM_Initialization_File/UPROM.mem> 
    gen_sim -use_init false 
    

    For the proper internal name to use for the die and package, see the *.prjx file of the first Libero project (used for component generation).

    The argument use_init must be set to false for PolarFire.

    Use the set_sim_mem command to specify the path to the output file UPROM.mem that is generated upon execution of the script file with the pa4rtupromgen executable.

  12. At the command prompt or cygwin terminal, go to the working directory created in step 3. Execute the pa4mssenvmgen command with the-script option and pass to it the *.tcl script created in step 11.
    For Windows:
    <Libero_SoC_release_installation>/designer/bin/pa4rtupromgen.exe --script./simulation/<Tcl_script_name>.tcl 
    For Linux:
    <Libero_SoC_release_installation>/bin/pa4rtupromgen --script./simulation/<tcl_script_name>.tcl
  13. For SmartFusion 2 and IGLOO 2 devices, after successful execution of the pa4mssenvmgen executable, check that the ENVM_init.mem file is generated in the location specified in the set_sim_mem command in the *.tcl script.

    For RTG4, after successful execution of the pa4rtupromgen executable, check that the UPROM.mem file is generated in the location specified in the set_sim_mem command in the *.tcl script.

    For PolarFire, after successful execution of the pa4rtupromgen executable, check that the UPROM.mem file is generated in the location specified in the set_sim_mem command in the *.tcl script.

  14. For SmartFusion 2 and IGLOO 2 devices, copy the generated ENVM_init.mem file into the top level simulation project to run simulation (outside of Libero SoC).

    For RTG4, copy the generated UPROM.mem file into the top level simulation folder of your simulation project to run simulation (outside of Libero SoC).

    For PolarFire, to simulate the sNVM contents configured as a part of the PolarFire System Services core, copy the snvm.mem file from your first Libero project (used for component configuration) into the top level simulation folder of your simulation project to run simulation (outside of Libero SoC). To simulate UPROM contents, copy the generated UPROM.mem file into the top level simulation folder of your simulation project to run simulation (outside of Libero SoC).

Important: To simulate the functionality of SoC Components, download the pre-compiled SmartFusion 2/IGLOO 2, RTG4 or PolarFire simulation libraries and import them into your simulation environment as described here. For more details, see Appendix C—Importing Simulation Libraries into Simulation Environment.