Posts that will make you a better VHDL designer, regardless of the tools you use.

You can easily subscribe to this blog by clicking this rss icon: Syndicate content

Be careful with VHDL operator precedence

I was recently writing some tests for our VHDL expression evaluator and was amazed by the the result of evaluting -16 ** 2.
I expected 256, but it wasn't.

Can you guess the output of running this process?

     process is
          report "-5 mod (-3) : " & integer'image(-5 mod (-3));
          report "(-5) mod (-3) : " & integer'image((-5) mod (-3));
          report "-(5 mod (-3)) : " & integer'image(-(5 mod (-3)));
          report "-16 ** 2 : " & integer'image(-16 ** 2);

To "to" or to "downto"... Ranges in VHDL

Most VHDL designers write 'something downto something' in their code all the time. But what does this downto actually mean. And what is the difference with to?

The keywords downto and to specify the direction of ranges in VHDL. downto is descending (going down); to is ascending (going up).

Ranges in Arrays

When used in arrays, downto corresponds to little endian. This means that the least significant bit is stored at the lowest position.

"Use" and "Library" in VHDL

Beginning VHDL engineers, and advanced engineers too, can get confused about the exact scope of a use clause and a library clause in VHDL. They usually show up at the top of a file, which would make you think that they are visible in the entire file. Unfortunately, the truth is a bit more complex.

First a small disclaimer: we've read the VHDL Language Reference Manual more thoroughly than 99.99% of all engineers you are ever going to meet (and more than what will make even a die-hard language geek happy).

Writing Finite State Machines in VHDL

Set up your code generator in Sigasi

In many projects, some of the VHDL code is generated in one way or another. For instance, many projects manage their register map in one master file and generate their VHDL packages and C headers using some kind of tool (either commercial or an in house script).
This article deals with integrating such a script in the Sigasi Pro development environment, so that your generated files are always up to date.