User Guide: DSim Using Compressed Files

Modified on Thu, 11 Jul at 11:43 AM

User Guide: DSim Using Compressed Files

DSim supports "transparent" compression: in certain contexts it will compress/decompress files on the fly.


The following types of compression are supported:


Suffix Compression program
.gz gzip
.bz2 bzip2
.xz xz
.Z compress

The compression/decompression is performed by launching the compression program in a child process. On a multi-core machine, the compression or decompression happens in parallel with model execution.


This requires that the compression program be installed. Due to patent issues, compress is typically not installed on many systems. The patents have expired, but compress is still rarely found since it has the worst performance of all the compressors.



Rules for Reading Files

If the filename being opened has a primary extension denoting compression, then the file is opened and decompressed.


If the filename being opened does not have a primary extension denoting compression and does not exist, but a file of the same name, plus an applicable extension exists, then that file will be opened and decompressed. e.g. if gates.vg does not exist, but gates.vg.gz does, then the latter will be opened and decompressed.


If the primary extension denotes a compression type, the secondary extension can be used to identify the intended language of the file. If no compression is specified, then the primary extension can be used to identify the intended language. Although the intended language can be explicitly specified using the Common Options.


See Input Filename Examples to see different combinations of extensions to indicate file type as well as compression types.



Rules for Writing Files

If the filename being opened has a primary extension denoting compression, then the file is opened and compressed.


If the filename being opened does not have a primary extension denoting compression, then the file is opened and written uncompressed. The existence of file(s) with a similar name does not alter behavior.



Caveats

If a file being opened for read does not exist, but there are multiple compressed versions using different compressors, then it is not defined which one will be opened.


Files opened using $fopen or $open using transparent compression will not support $fseek - you cannot seek on a compressed file, at least not easily.



Supported Contexts

Transparent compression is supported for the following operations:


  • Compile: reading in source files: either off the command line, or using include, or during library (-v/-y) scans
  • VCD waveform dump. Note that GTKWave can read in *.vcd.gz files directly.
  • $readmem/$writemem
  • System calls ($open/$fopen)
  • Reading SDF files.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article