Thought Leadership

Qrun-ing Optimized Build Flows in Questasim

By Neil Johnson

Qrun-ing with Questasim

For Questasim users, qrun will be a welcome surprise. Admittedly, I’ve never been a huge fan of the 3-step Questasim flow of vlog, vopt and vsim. On one hand it does give you intimate access to the simulator that customers can use to optimize their usage. On the flip side, that level of control requires a lot of knowledge and understanding that presents challenges to new users.

My personal list of complaints with the 3-step flow is that it has three steps! I want one step and that’s what qrun gives me. Another pet peeve was always vsim running the GUI by default instead of batch mode. For me, running with the GUI has always been the exception so having batch as the default mode for qrun makes my life easier. Tied for third place are a few other little quirks, like needing to specify a name for the optimized image out of vopt, the obligatory two command vsim tcl input of -do “run -all; quit”, routing verilog and VHDL source files to the right compiler executable (i.e. vlog or vcom) and some switch redundancy between steps.

In short, qrun eliminates a lot of the manual command line construction and linkage required in the 3-step flow. Effectively, it makes qrun the friendly front-end I always wished Questasim had. For that reason, new users want to start with qrun instead of the 3-step flow. No question.

For long-time users, qrun is a streamlined version of the 3-step flow so I recommend making the transition. Even for power users pushing Questasim to the limits, the added ease-of-use will be compelling enough to change.

Qrun-ing an Optimized Build Flow

Let’s get back to the discussion around build flows and the incremental build options I introduced a few weeks ago. In that post we had five options – lump sum, partitioned compile, parallel compile, pre-optimized design units (PDU) and elaboration flow. For those same five options, let’s get to the details of how they’re done with qrun.

Lump Sum Build

The lump sum build isn’t exactly notable, but it does give me a chance to highlight the simplicity of the qrun interface relative to the 3-step flow. Assuming a single design file list and testbench file list, just feed them into qrun as-is; that does all of compile, optimize and simulate without any other input required.

qrun -f tb_files.f -f design_files.f

Partitioned Compile

Breaking a design and testbench into multiple libraries is something that our customers do regularly. For that, the old 3-step flow would require vlib and vlog/vcom for each library. For qrun, we need similar instructions but less information with the -makelib/-end switches.

qrun -makelib tb_lib -f tb_files.f -end \
     -makelib design_lib -f design_files.f -end

Parallel Compile

Now a big step forward where we can parallelize the compile and distribute it across multiple cores. Adding the -parallel switch to the command line turns on parallel compile. From there, qrun determines dependencies and an optimal number of cores for compilation then launches the jobs to match the dependencies.

qrun -makelib tb_lib -f tb_files.f -end \
     -makelib design_lib -f design_files.f -end \
     -parallel

Pre-optimized Design Units (PDUs)

The interface to the PDU flow is similar to the partitioned library compilation. Use the -makepdu/-end switches to specify the PDU libraries and hierarchies, then qrun optimizes that PDU as an independent entity.

qrun -makelib tb_lib -f tb_files.f -end \
     -makelib design_lib -f design_files.f -end \
     -makepdu design_top design_lib.top -L design_lib -end \
     -parallel

Elaboration Flow

The elaboration flow is two steps. The first step produces an elaboration file through the addition of the -elab switch. From there, the elab file is used for simulation only in subsequent calls to qrun. The more sims you run, the more the elaboration flow saves you.

qrun -makelib tb_lib -f tb_files.f -end \
     -makelib design_lib -f design_files.f -end \
     -makepdu design_top design_lib.top -L design_lib -end \
     -parallel \
     -elab elab.output -do “quit”
qrun -load_elab elab.output -do “run -all; quit”

Incremental Compile/Optimize

Another feature of qrun worth mentioning is an incremental compile and optimize. Incremental compile and optimize is integral to the way qrun processes file input. Files are only re-compiled if they change; PDUs are only rebuilt if dependencies change. This is another out-of-the-box convenience upgrade relative to the 3-step flow. Incremental compile is available in the 3-step flow, but with qrun it’s on by default.

Qrun Command to Rule Them All

That’s the end of our qrun crash course. For new Questasim users I’ll reiterate that qrun is where you want to start. Ease-of-use and default options are both improved to the point qrun provides a much stronger first impression than the 3-step flow. For long time users, hopefully I’ve made a compelling case for moving into qrun from the 3-step flow. Not mandatory, but I do think you will find it much friendlier so worth a look.

-neil

Leave a Reply

This article first appeared on the Siemens Digital Industries Software blog at https://blogs.sw.siemens.com/verificationhorizons/2021/07/07/qrun-ing-optimized-build-flows-in-questasim/