Note to ECE3485 students:
That and the documentation.
That and the documentation.
libHLS is a C-language library to aid in the construction of high-level synthesis systems. It is a library of data structures commonly used in such systems. The data structures are created, manipulated and destroyed by using functions from the library. Each data structure has a function interface for it.
Click on the link below to download XVCG source.
Shift-click on the appropriate link to download an pre-compiled XVCG binary. Click on the link below for the XVCG manual page.
gzip -c -d vcg-1.30-libHLS.tar.gz |
tar xvf -
Installing XVCG binary
Unpack and compile libHLS
gzip -c -d libHLS_v2.1.0.tar.gz | tar
xvf -
cd libHLS_v2.1.0/src
You are now ready to use libHLS . . .
gcc -g -I${LIBHLS_ROOT}/include {object/C-source
files} \
-L${LIBHLS_ROOT}/lib/${HOSTTYPE} -lHLS
-o {executable name}
where LIBHLS_ROOT is the location of the libHLS distribution. I like to use a Makefile to manage my applications. Here's an example of what a short application that uses libHLS would look like.
If you have XVCG installed at a location different from where your installation of libHLS expects it, you don't have to recompile libHLS. Simply set the XVCG environment variable to point to the new location. In csh or tcsh, the command would be:
setenv XVCG /directory/containing/XVCG/binary
The XVCG binary overrides the internal, compile-time setting of the XVCG binary location.
An example - Depth-First Search:
This program reads a graph and prints a list of nodes in depth-first search (DFS) order. The code is divided into two files: main.c is a wrapper that interfaces with the UNIX command line, and dfs.c is the file that contains the code for the DFS algorithm.
The program animates the order in which the nodes are visited by using the XVCG animation interface.
Here are some files you can give the dfs example as input graph files:
To run dfs without displaying graphs, add the "-nodisp" option to the dfs command line.
Debugging in libHLS
The object-oriented nature of libHLS makes debugging easy by breaking data-structures into compartments which can be debugged separately. I use "gdb" from within "xemacs" as my preferred debugging platform. Any UNIX C debugger should work though.
In addition, when libHLS is compiled with the -g flag set and NDEBUG not defined, the assert() function calls sprinkled through the code can trap illegal conditions that can cause errors early on. For those unfamiliar with assert, please read the UNIX manual page by doing a "man assert" (or "man -s 3c assert" on a Solaris platform). Assert checks for a condition to be true and halts the program if the check fails. It also issues a message "Assertion failed:" which includes the condition that failed and the file and line number in your code at which this happened. Most functions in libHLS have a "sanity check" section at the top of the function. The purpose is to verify the arguments to the functions are legal ones. If your program calls a libHLS function with illegal argument values, libHLS will issue an "assertion violation" and halt the program. If you're running in a debugger, like "gdb", this halts the program but does not exit. So you can now examine your program stack to see which condition was violated and why.
Asserts help catch bugs close to where they happen as opposed to 20 function calls down the line. Believe me, it makes debugging easier. For those who are wondering about performance hits taken by executing such checks, you'll be happy to know that compiling with the NDEBUG preprocessor variable defined removes all assert( ) calls from the code. So it's easy to compile an optimized version of your code.
/home/class/INSTR/ece3485/libHLS
on the ECE computer network. If you're running on a compatible platform, you should be able to use the library, include files, and XVCG binary installed there.
In fact, you should be able to download the files of the DFS example above into a directory and compile it directly without any further modifications. When you write your own application, be sure to point LIBHLS_ROOT (or your equivalent Makefile variable) to the install directory mentioned above.
The installation of libHLS gets XVCG from
/home/class/INSTR/ece3485/bin/sun4/xvcg
which is a Solaris-2.5.X binary.
You might see something like this when you try to run a libHLS program that is trying to display a graph using XVCG.
ld.so.1: /home/class/INSTR/ece3485/bin/xvcg: fatal: libXext.so.o: can't open file: errno=2
This is happening because XVCG is a dynamic linked binary. It needs to load the libXext.so.o and other libraries at run time. The error happens because the binary can't find the libraries.
To correct it, set the LD_LIBRARY_PATH environment variable, with
setenv LD_LIBRARY_PATH /usr/openwin/lib
This tells XVCG to look in /usr/openwin/lib for additional libraries. This is where libXext.so.o lives.
I recommend you place the setenv command in your .cshrc file, if you plan to be running libHLS applications a lot.
~libhls/libHLS
on the COE computer network. If you're running on a compatible platform, you should be able to use the library, include files, and XVCG binary installed there.
Just run source ~libhls/ece3485.cshrc.
In fact, you should be able to download the files of the DFS example above into a directory and compile it directly without any further modifications. When you write your own application, be sure to point LIBHLS_ROOT (or your equivalent Makefile variable) to the install directory mentioned above.
The installation of libHLS gets XVCG from
~libhls/libHLS/bin/sun4/xvcg
which is a Solaris-2.5.X binary.
You might see something like this when you try to run a libHLS program that is trying to display a graph using XVCG.
ld.so.1: ~libhls/libHLS/bin/xvcg: fatal: libXext.so.o: can't open file: errno=2
This is happening because XVCG is a dynamic linked binary. It needs to load the libXext.so.o and other libraries at run time. The error happens because the binary can't find the libraries.
To correct it, set the LD_LIBRARY_PATH environment variable, with
setenv LD_LIBRARY_PATH /usr/openwin/lib
This tells XVCG to look in /usr/openwin/lib for additional libraries. This is where libXext.so.o lives. (sourcing the ece3485.cshrc file does this for you.)
It is recommended that you start with the tutorial. It takes
you step-by-step though the DFS example above, explaining the reasons for
doing various things and pointing out other things that you need to watch
for when using libHLS. Once you have the hang of things, you'll find the
"Quick Reference" the most useful document.