3
votes

I am new to ghdl simulator,and using ghdl on windows. I have setup ghdl (ghdl-0.33-win32) on my computer and tried out simple adder code and it worked. I currently need to simulate some math equations where I have used David Bishop's fixed and floating point packages. When I include the library to my and compile it it gives error:

"fixed_pkg" not found in library "ieee"

or if I copied fixed_pkg_c files into my project file compile with work:

"fixed_pkg" not found in library "work"

Can someone show me the way (or the command set that I should follow) to include these fixed and float packages?

1
What command line do you use to call GHDL? Btw. GHDL 0.34 will be release in the next days. We still have a little problem in the release process, so the currently visible 0.34 version will be overwritten again with a newer file. => github.com/tgingold/ghdl/releasesPaebbels

1 Answers

2
votes

A ghdl-0.33-win32 installation provides partial support for the IEEE 1076-2008 revision of the VHDL standard.

This support includes David Bishop's fixed and floating point synthesis eligible libraries which are include in that revision (See IEEE Std 1076-2008, 16. Predefined language environment, 16.10 Fixed-point package and 16.11 Floating-point package). As accepted IEEE packages in that revision they are found in library IEEE.

The default revision supported by ghdl -is 93c (-1993 with support for mixed literal and expression boundaries in range indexes which is supported in later revisions of the standard).

Invoking ghdl with -2008 revision compliance is accomplished by using the --std=08 option to analysis (-a) and elaboration (-e) commands.

There is one distinction found using an mcode (just in time code) just in time code generation version of ghdl such as the Win32 distribution:

From the newest GHDL Documentation section on Invoking GHDL for the run command:

run -r

Runs/simulates a design. The options and arguments are the same as for the elaboration command.

  • GGC/LLVM: simply, the filename of the executable is determined and it is executed. Options are ignored. You may also directly execute the program. The executable must be in the current directory.
  • mcode: the design is elaborated and the simulation is launched. As a consequence, you must use the same options used during analysis.

In an mcode version such as distributed for Win32 the -e elaborate command is redundant and the run command (-r) must include the same options as for the analysis command (-a).

Unlike a GCC or LLVM version of ghdl an mcode version requires any pertinent options provided for elaboration to be provided for the run command instead.

For a GCC or LLVM ghdl implementation and a VHDL file and entity the commands for analyzing, elaborating and simulating an entity found in a file would be:

ghdl -a --std=08 vhdl_file_name
ghdl -e --std=08 entity_name
ghdl -r entity_name

The run command (-r) to simulate also allows selection of one of multiple architectures or a declared configuration.

For an mcode version of ghdl the elaboration command is ignored, there are neither object code files from analysis nor a separate executable produced, while there is a library file (for a working library named work and for -2008 this would be named work-obj08.cf by default) used to coordinate analysis order as required by the standard.

For an mcode version of ghdl the minimum commands would be:

ghdl -a --std=08 vhdl_file_name
ghdl -r --std=08 entity_name

Where the elaboration command is superfluous, elaboration preceding simulation with the run command and any valid elaboration options also shared with the analysis command must be passed to the run command.

To access for fixed_pkg package in the IEEE -2008 library using the --std=08 your entity or architecture must be within the scope of a context clause making the declarations found in fixed_pkg visible:

library ieee;
use ieee.fixed_pkg.all;

The use clause making declarations found in fixed_pkg visible.

Tristan has just released ghdl-0.34 which currently includes both a win32 mcode version (mingw32) and a 64 bit LLVM version (mingw64). The matching GHDL Documentation provides useful hints in color bar highlighted passages.

Because ghdl is open source it depends in large part on user feedback for correcting discrepancies both in operation and documentation.

Discrepancies can be reported as an issue (requires a github login). Issues reflecting lack of clarity in ghdl's documentation can lead to improvements.

GTKWave, a waveform viewer supporting GHDL's waveform format can be obtained from Sourceforge. ghdl also supports VCD and FST waveform dump file formats used by gtkwave as well.