Display Monitor and Strobe in SystemVerilog

Display Monitor and Strobe in SystemVerilog

I was adding in the ubiquitous "what is this code doing" debug statements to some SystemVerilog to trace what was happening and finally had a chance to consider deeply the application of: $monitor, $display and $strobe.  All three print to the display and all use the same syntax and formatting in their arguments.  The difference in the three is when they actually execute.  I read a pretty good starting article Verilog subtleties – $monitor vs. $display vs. $strobe that gave me a start to creating my own teaching version of their example.

You can check out the code below on github.

Using Squarespace and Embedding Syntax Highlighted Code with Emacs

Using Squarespace and Embedding Syntax Highlighted Code with Emacs

Squarespace has the ability to syntax highlight the following three source types:

  • html
  • css
  • javascript

in a very workable built in code block in their blogging system.  But, if you use another source type like SystemVerilog or Python you will have to figure out something else to get your source code syntax highlighted on Squarespace.

In the following post on Answers Squarespace, it mentions a method using the javascript helper Prism that can syntax highlight a lot of languages out of the box.  It actually looks really cool.  Sadly, SystemVerilog is not in their list of supported languages.

To handle something like SystemVerilog, or nearly every language, the solution I ended up with was using Emacs with the plugin htmlize.  The idea is that since Emacs already has great syntax highlighting for everything, you can export regions or whole files to raw HTML with that syntax highlighting intact.

Mentor Questa do versus source

Mentor Questa do versus source

The standard TCL command "source" is the common way to read in source of one file into the current environment - similar to an `include in Verilog.  Mentor Questa runs a TCL interpreter and adds a few custom features to the environment one of which is the command: "do".  For many uses the "do" and the "source" command will have identical output.  In fact, whatever can be done with "source" can be done with "do" - it is a superset of "source".  The "do" command does add at least two useful or at least interesting features.

SystemVerilog timescale Across Classes Illustrated

SystemVerilog timescale Across Classes Illustrated

Mixing of `timescale(s) causes problems if you are trying to pass delays as realtime types.  The realtime type was never meant to be treated this way.  realtime is actually a standard real type but with only local knowledge of the meaning of the units of time.  When you pass a realtime value into a class in a different package all you get is that real type value and no units.

Software Deprecate Versus Depreciate

Software Deprecate Versus Depreciate

I used to work with a guy who would quite often correct me on my use of the word deprecate in the context of software.  I would say "I think that software function is deprecated and should not be used anymore."  (Deprecated pronounced dep-re-kate-ed).  He would respond "no, that software function is depreciated". (Depreciated pronounced de-pre-she-ate-ed).

 

We have the two words:

  • deprecated
  • depreciated

Just one letter different, but the pronunciation is quite a bit different.  I kept saying the word my way and he would say it his.  His reasoning was that deprecate was a synonym for defecate; which is incorrect.

What is the correct word to use in the context of software?  Read the rest of the post for the full answer.

Using TCL cmdline library with Interactive Tools

Using TCL cmdline library with Interactive Tools

Most tools in EDA (Electronic Design Automation) have an interactive TCL (Tool Command Language) interface.  Some examples are Mentor Questa, Cadence Incisive, Cadence RTL Compiler, and many of the IBM EDA tools.  A common problem is that the TCL language does not come shipped with a command line parser.  TCL assumes you will just use positional arguments or you will come up with your own parsing package.

The Standard TCL Library (TCLLIB) has many routine libraries; including a very useful command line parser.  Unfortunately, it is not always installed by default or included with the EDA implementation of TCL.  For a good intro into the use of the command line parsing library available from TCLLIB, you should check out a post from Hai's Blog on how to use the TCLLIB cmdline library.

I took the the example from Hai's Blog and wrapped it to make it work in a reusable way within EDA tools and show some examples below of its use below.  Since EDA tools already have the TCL interpreter running you would want to have the TCL arguments be wrapped around procedures and not the arguments to program itself.

SystemVerilog Package Globals instead of `include

SystemVerilog Package Globals instead of `include

I had used other programming languages before working with System Verilog.  So when I started looking at System Verilog code for the first time, I was perplexed why there were all of these `includes all over - even in purely object oriented verification logic.

There is a problem and proposed solution I would like to share.  Using packages instead of `include to store constants.  I wrote the example both ways: package and `include; so you can see something that I see typically done with `include done with packages.  

Simulation Performance Metrics with time

Simulation Performance Metrics with time

I was trying to get a metric for the performance penalty of simulating with and without a model parameter.  The parameter was believed to be responsible for a performance difference of 10% to 15%, but after looking at the data more I became intrigued.  Since no one had really deep dived into this and shown more than a few data points on performance it was time to get serious about simulation performance comparisons.

FTDI FT2232 MPSSE Basics

FTDI FT2232 MPSSE Basics

I started a project working on interfacing with the Future Technology Devices International Ltd. (FTDI) USB FT2232H Mini Module via their D2XX device driver.  This device hooks up to a computer through a standard USB port and has a series of pins that can be used to interface with JTAG, I2C, and whatever serial like protocol you want.  I had been using the Application Note AN_135 FTDI MPSSE Basics provided by the manufacturer and noticed that their Example Program (Chapter 5), which is very good, was not available for download, but only printed in pieces in their Application Note.  As I went through the Application Note, I was writing out the example along with their comments and had a few minor corrections to get it working in a Linux environment.

I am making my transcription of the Example Program and corrections available on GitHub below.

Accessing Mentor FlexLM License Server via SSH Port Forwarding

Accessing Mentor FlexLM License Server via SSH Port Forwarding

Your FlexLM License server might be behind a firewall that makes it unaccessible even if you are VPNed into that network.  The FlexLM server could be only listening to machines on a certain subnet of addresses or have some other reason to communicate with only certain machines.  That firewall makes things like my post Installing Mentor Questa on Ubuntu much more difficult to complete if you wanted to run something like Mentor Questa on your remote machine.

This is my recipe that will allow you to do the necessary ssh forwarding to be able to communicate with a FlexLM server as if you were at a machine on its native network.

Installing Mentor Questa on Ubuntu

Installing Mentor Questa on Ubuntu

I use Mentor Questa a lot and when I am at work the visual lag of interacting with the GUI is almost imperceptible.  But, when I am working remotely that visual lag is, of course, more noticeable. One possible solution that reduces the lag considerably compared to VNC, NX, or Windows Remote Desktop is to run Questa natively on your local computer.

The first problem you will run into is that Questa is only officially supported on Redhat and SUSE Linux.  (It is also supported on Microsoft Windows too, but who really does serious engineering work on Windows?)  So, if Questa is only supported on two commercial Linux variants are we stuck on installing Redhat at home from the corporate install?  Fortunately, no.

You can install Mentor Questa on Ubuntu Linux.  I'll go through installing it on Ubuntu 12.04.3 64bit.

Using Emacs to Debug Verilog Compiles in Mentor Questa

Using Emacs to Debug Verilog Compiles in Mentor Questa

I hadn't used Emacs to compile and parse errors for Mentor Questa before and decided to see what that would be like.  Making Emacs understand how the simulator works and spits out errors involves extending Emacs to know how to launch your Verilog simulator and how to interpret the console messages.  The built in Emacs compilation mode is not terrible and at least gives a starting point for compiling and debugging standard languages and custom ones. This is how to do it with Mentor Questa.

Merging SystemVerilog Covergroups for Efficiency

Merging SystemVerilog Covergroups for Efficiency

In the previous blog post, we were merging covergroups and, in all cases, keeping track of the covergroup instances "INST" (the Mentor Questa notation) data as well.  This is perfectly fine if you have only a few repeated instances. But, what if you have thousands of instances in your design - the covergroup data can get bloated.