| Table of Contents |
|---|
/tmp directories are
purged weekly of old files.
ccl1.ee.byu.edu --> ccl15.ee.byu.edu
iexplorerfor a browser that doesn't uglify your pages like Netscape.
splish.ee.byu.edu,
which is linked from www.ee.byu.edu. Login with:
lpr filename
mpage -2 filename |lpr
/ka1/users/your_username (It is possible that your drive space
might be on /fpga1 /fpga2 /fpga or /cad instead of /ka1)
cp -r /ee/your_user_login_name/* .
chgrp to change it back to "ee" if needed.
tcshto get a much better shell which allows a command history (by pressing up and down) and other convenient features. If you write shell scripts, consider using the sh shell for portability. Use CDE Dterm for colors and proper key mapping. Perhaps you'll find a different shell you prefer, if that is the case, you'll find useful the man pages on chsh, which changes the default shell. Type
man chsh
echo $DISPLAYIf the result is the name of your computer then it should work as desired. If not, enter the following, (replacing zap with your computer name):
setenv DISPLAY zap.ee.byu.edu:0.0
tar -zxvf [filename with all extensions]
Each of these steps is described below:
checkout command, handing it a
module name or directory path (relative to the $CVSROOT variable)
you want to work on. CVS copies the latest revision of each file
in the specified module or directory out of the Repository and
into a directory tree created in your current directory. You may
specify a particular branch to work on by symbolic name if you
don't want to work on the default (main or trunk) branch.
commit them back
into the Repository.
update command. When your merged files build
and test correctly, you may commit the merged result. This
method is referred to as copy-modify-merge, which does not
require locks on the source files.
tag the
committed files, producing a symbolic name that can be handed to a
future checkout command. A special form of tag produces a
branch in development, as usually happens at release time.
cvs checkout: No CVSROOT specified! Please use the `-d' option
cvs [checkout aborted]: or set the CVSROOT environment variable
cvs checkout httpc
cvs checkout: Updating httpc
U httpc/.cvsignore
U httpc/Makefile
U httpc/httpc.c
U httpc/poll-server
cvs checkout httpc means, "Check out the source
tree called httpc from the repository specified by the CVSROOT
environment variable."
CVS puts the tree in a subdirectory named `httpc':
cd httpc
$ ls -l
total 8
drwxr-xr-x 2 jimb 512 Oct 31 11:04 CVS
-rw-r--r-- 1 jimb 89 Oct 31 10:42 Makefile
-rw-r--r-- 1 jimb 4432 Oct 31 10:45 httpc.c
-rwxr-xr-x 1 jimb 460 Oct 30 10:21 poll-server
gcc -g -Wall httpc.c -o httpcMerging your changes:
cvs commit command below.
cvs update command takes care of this:
cvs update
cvs update: Updating .
U Makefile
RCS file: /u/src/master/httpc/httpc.c,v
retrieving revision 1.6
retrieving revision 1.7
Merging differences between 1.6 and 1.7 into httpc.c
M httpc.c
cvs update command, CVS merges changes into your working copy
only; the repository and the other developers' working directories
are left undisturbed. It is up to you to test the merged text, and
make sure it's valid.
cvs update to get a list of the modified files from CVS:
cvs update
cvs update: Updating .
M httpc.c
As expected, the only file CVS mentions is `httpc.c'; it says it
contains changes which you have not yet committed. You can commit
them like so:
cvs commit httpc.c
At this point, CVS will start up your favorite editor and prompt you for a
log message describing the change. When you exit the editor, CVS will
commit your change:
Now that you have committed your changes, they are visible to the rest
of the group. When another developer runs cvs update, CVS will
merge your changes to `httpc.c' into their working directory.
It's important to understand what CVS does and doesn't consider a
conflict. CVS does not understand the semantics of your program; it
simply treats its source code as a tree of text files. If one developer adds a
new argument to a function and fixes its callers, while another developer
simultaneously adds a new call to that function, and does not pass the
new argument, that is certainly a conflict -- the two changes are
incompatible -- but CVS will not report it. CVS's understanding of
conflicts is strictly textual.
In practice, fortunately, conflicts are rare. Usually, they seem to result
from two developers attempting to address the same problem, a lack of
communication between developers, or disagreement about the design of
the program. Allocating tasks to developers in a reasonable way reduces
the likelihood of conflicts.
CVS: A Bulletted Summary
- Each developer uses
cvs checkout to create her own copy of
the source tree from the CVS repository. The command can
operate on a directory tree, a single file or a module; a module
groups several files or directories into one entity which can be
operated on as a unit. One defines modules by editing the
`modules' file.
- The developer modifies, compiles and tests the code in her copy of
the source tree (called a working directory) with whatever editors
and tools she chooses -- Emacs, make, etags, etc. She uses
cvs
add and cvs remove to add and remove files.
- When the changes are complete, the developer uses
cvs commit
to merge her changes back into the repository. This makes her
changes available to other developers.
- At any point, the developer may use
cvs update to merge
changes committed by others into her working directory. If there
are uncommitted changes to files in her working directory, CVS
prints a message and attempts to merge the changes from the
repository with her changes in the working directory. If the merge
fails, CVS indicates a conflict which she resolves manually with a
text editor.
- The developer can show the differences between two revisions with
cvs diff; show the log of changes to a particular file with cvs
log; show the history of each line of a file with cvs annotate;
and show who has used cvs checkout, cvs tag, and several
other CVS commands, using cvs history.
- CVS supports watches, allowing developers to request notification
when someone begins editing a file or obtain a list of developers
currently working on a file.
- The user can record the state of the repository at a particular point
with the cvs tag command and use that tag as an argument to
most CVS commands, for example to retrieve the files as of the
tagged point.
- The developer can create a new development branch with
cvs
tag -b, and manipulate branches with cvs update -r and
cvs checkout -r. Subsequent operations in that working
directory apply to that branch. To return to the main branch, the
developer can use cvs update -A. The cvs update -j
command merges changes made on another branch into the
working directory.
- The existence or nonexistence of a file is itself version controlled so
that files can exist on some but not all branches and users can
reproduce the state of the files at any given point in time.
The developer can mark a file as binary, which prohibits merging
and line terminator conversions, using cvs admin.
CVS Usage in Our Lab: Checking Out JHDL
You can check out a copy of the JHDL tree from the CVS repository to poke through it to learn about the organization of JHDL. Packages of interest are
byucc.jhdl.base, byucc.jhdl.Logic, , byucc.jhdl.apps, etc. Also, take a look at the API documentation generated by javadoc.
Here's how to check out JHDL:
First, SSH to a cluster machine, say ccl7
ssh ccl7
Then change to the temp drive, make a cvs directory, mycvs, and enter
that directory
cd /tmp
mkdir mycvs
cd mycvs
Set the CVSROOT environment variable, and run the cvs checkout command
setenv CVSROOT /fpga3/cvsroot/
cvs co byucc/jhdl
A couple minutes later
.
.
.
U byucc/jhdl/util/xmac/WireMethodsParser.java
U byucc/jhdl/util/xmac/WireParser.java
U byucc/jhdl/util/xmac/XMAC.java
U byucc/jhdl/util/xmac/XMACParser.java
U byucc/jhdl/util/xmac/config.xml
U byucc/jhdl/util/xmac/xmac
U byucc/jhdl/util/xmac/xmac.xsd
cvs checkout: Updating byucc/jhdl/util/xmac/config
$
Hurrah, We've checked out the latest JHDL source.
CVS Errors
If you weren't added to the fpga group you'll probably get the
following message:
cvs checkout: Updating byucc/jhdl
cvs checkout: failed to create lock directory in repository `/fpga3/cvsroot//fpga/byucc/jhdl': Permission denied
cvs checkout: failed to obtain dir lock in repository `/fpga3/cvsroot//fpga/byucc/jhdl'
cvs [checkout aborted]: read lock failed - giving up
Talk to the EE sysops to have this corrected.
Jikes
Jikes is a compiler that translates Java source files as defined in The Java
Language Specification into the bytecoded instruction set and binary format
defined in The Java Virtual Machine Specification. Features include:
- strict adherence to the language specification,
- extremely fast compile speed,
- built-in dependence analysis, allowing incremental compilation and
- automatic makefile generation.
Jikes is a Java compiler from IBM that works pretty much like javac, but
much, much faster. You probably already have it in your path, because it's
in /usr/bin. The only other setup you need is to tell it where your Java
runtime jarfile is: It's called rt.jar, and it's in jre/lib in the directory
where Java is, which is probably /usr/local/java/jre/lib. You shoulde set the
JIKESPATH like this:
setenv JIKESPATH /usr/local/java/jre/lib/rt.jar:$CLASSPATH
JNI - Java Native Interface
The JNI allows Java code that runs within a Java Virtual Machine (VM) to operate with applications and libraries written in other
languages, such as C, C++, and assembly. In addition, the Invocation API allows you to embed the Java Virtual Machine into your
native applications.
Programmers use the JNI to write native methods to handle those situations when an application cannot be written entirely in the
Java programming language. For example, you may need to use native methods and the JNI in the following situations:
- The standard Java class library may not support the platform-dependent features needed by your application.
- You may already have a library or application written in another programming language and you wish to make it accessible to Java applications.
- You may want to implement a small portion of time-critical code in a lower-level programming language, such as assembly, and then have your Java application call these functions.
Programming through the JNI framework lets you use native methods to do many operations. Native methods may represent legacy
applications or they may be written explicitly to solve a problem that is best handled outside of the Java programming environment.
Apache Ant (Another Neat Tool)
ANT is like "make", that is, it is a program for simplifying and organizing the
building (compilation) of large programming projects. ANT was designed
specifically for JAVA programs. Info on ANT can be found at the Ant Homepage
Theory of Operation
ANT needs an input file to tell it what to do. This file is called, by default,
build.xml. Here is a recent BYU FGPA Lab build.xml file.
XML, by the way, is another TLA standing for "eXtensible Markup Language." Both
XML and HTML are extended from SGML, the Standard Generalized Markup Language, so they
are similar. With markup languages expect to find nested structures of elements defined by angle bracket
tags. Within those tags you'll get meta-properties and between those tags
you'll find the data. Common elements in ANT include <project> <target> and
<property>
When Ant is run, it first parses the buildfile, then it goes to the default
target tag (or the target specified by the user) and begins executing the
commands specified by nested tags within that target. All of the commands
themselves are represented by XML tags. Targets can also indicate that they
depend on other targets (with a depends attribute). Ant ensures that all of the
targets listed in the depends attribute are executed before the current target
is run.
Details
In this lab, Ant is located in /opt. Our version uses another parser called
Xerces rather than the default one.
Building the Checked Out JHDL
Let's check out the latest JHDL and build it:
We want the fastest lab machine: rhynn. So first we SSH there:
> ssh rhynn
byrdmr@rhynn's password:
Last login: Mon Jan 14 16:44:16 2002 from zap.ee.byu.edu
Then, We change to the /dev/shm drive (a RAM disk) and create a check out directory which we
will name mycvs. Next, we check out a tagged version of the source and docs
[byrdmr@rhynn ~]$ cd /dev/shm
[byrdmr@rhynn shm]$ cd mycvs/
[byrdmr@rhynn mycvs]$ cvs co -r JHDL_RELEASE_0_3_15 byucc/jhdl docs/jhdl
Now we set a few environment variables
[byrdmr@rhynn mycvs]$ setenv JAVA_HOME /usr/local/java
[byrdmr@rhynn mycvs]$ setenv ANT_OPTS "-Xms32M -Xmx128M"
[byrdmr@rhynn mycvs]$ setenv PATH /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/opt/ant/bin
[byrdmr@rhynn mycvs]$ setenv CLASSPATH .:/usr/local/java/jre/lib/rt.jar
We set the classpath to force the use of jikes, a better compiler than javac.
Now we cd into the directory with our build.xml file:
cd byucc/jhdl
Now we run ANT:
[byrdmr@rhynn jhdl]$ ant -Dcvs.docs.src=docs/ -Dbuild.dir="JHDL-0.3.15" -Dversion=0.3.15 -Dfiltering=on release-all
This is what ANT returns:
Buildfile: build.xml
init:
[echo] >>> JHDL 0.3.11-development [2002]
[echo] >>> run the [usage] target to list available targets
prepare-directories:
.
.
.
BUILD SUCCESSFUL
Total time: 16 minutes 6 seconds
If the build was successful, ANT copies lots of files to a build directory and compiles the tree
into a subdirectory called "classes." At this point, JHDL is checked out and
built, and we are almost ready to start compiling JHDL programs. First, recall
that we will use Jikes to compile our .java files and Sun's JVM
(java) to execute them.
Be sure to delete the mycvs directory in /dev/shm after you have copied
the files out of
the build directory!
A Longer ANT Description:
The default target for the build of JHDL is the compile target. The compile
target depends on several other targets which build a special build directory
structure, copy only the desired source files, and prepares other files, such as
XMAC-generated code and resource files. After those other targets complete
their tasks, the compile target will compile the desired Java source code to the
build/classes directory.
To see a list of the major targets that you can run, execute the command
ant usage
To see a more comprehensive list of the targets that you can run, execute the
command
ant -projecthelp
You may also set properties in a build.properties file. This file may contain
the name/value pairs for all of the properties which you would like to have set
every time you run Ant to build JHDL. Put your build.properties file in the
base directory.
The standard JHDL build includes a wide range of tools that no one project
probably uses. To streamline the build, Use custom includes and excludes, to
suit your specific needs.
Directory Naming Conventions Used in ANT
The "test," "docs," and "old" directories are treated in special ways by Ant, as
directed by the buildfile. The test directories are not compiled by default.
The docs directories are not copied over to build/src (so they could contain
.java files if necessary); instead they are copied to the same directory in
which javadoc-generated HTML documentation is made. The old directories are
simply ignored by Ant altogether.
Put all test files and examples that demonstrate correct functionality in a
subdirectory called "test". For more information about writing and executing
tests, see How To Test JHDL
If you have resources that compliment your javadoc comments, put them in a
subdirectory called "docs". This is a good place for .gif files, additional
.html files, and other resources to include with the javadoc information
If a file is not needed anymore, run cvs remove on it. If the file is of
historical interest, or can otherwise be useful as reference, move it to a
subdirectory called "old".
Most of the time you will not need to worry about modifying the build.xml file
in byucc/jhdl. However, if your changes to JHDL require special treatment for
the build, be sure to update the build.xml file.
Speeding up ANT
Ant builds can be very I/O-bound, especially if performed on an NFS (Network
File System) drive. The JHDL build currently involves 2000-3000 files. For
normal builds, the copy and compilation dependencies are verified for each of
these files. If the file queries are done over your network connection, as with
NFS, the process of merely checking timestamps on files quickly adds up to be a
very big job.
To avoid this problem, you should consider performing your Ant builds on the
local drive of the computer you are using. All of the Linux and HP-UX machines
have a /tmp drive available for such purposes. Many Windows machines may have a
C:\temp\ directory. Also, some of the Linux machines in the lab may have a
/home drive available. You can copy your CVS-checked-out files to one of these
drives (or just perform the CVS chekout directly on the drive). With the file
I/O no longer using the network, you will find your Ant builds going much
faster, as well as your overall system performance improving. (The network can
be a real bottleneck.)
WARNING: The /tmp drives on Linux and HP-UX machines (as well as other variants
of Unix) are often cleaned out by a process running in the background. That
process looks for files that are older than some relative date and deletes them.
If you choose to work on a /tmp drive and you care about the work you have done
there, you must remember to copy your directory back to a network drive when you
are done. Alternatively, you could use a program or script that recursively
updates the timestamps of all of your files to trick the /tmp scrubber. Also,
beware that the /tmp and /home drives are not backed up by the lab or the Spice
sysops. (Only the network drives are backed up.)
Subdirectories
By default, the Ant build of JHDL will check the dependencies of every file to
compile in the whole JHDL tree. With approximately 3000 files, this can take a
long time (especially over NFS). However, most of the time, you may only care
about compiling some subdirectory of the JHDL tree, depending on where you are
developing and working. You can use the start.path property to tell Ant to
focus on just that subdirectory and the child directories in it. For example,
to compile just the byucc/jhdl/Logic/Modules directory, you could run the
following:
ant -Dstart.path=byucc/jhdl/Logic/Modules
A handy tool for doing this from any directory is a script that Aaron Stewart
wrote. This script, called build (or whatever you rename it, if you choose),
allows you to go to any part of the JHDL tree in which you may be working, edit
some files, then just run the build script from that same directory. The script
automatically determines where you are in the byucc/jhdl directory hierarchy and
runs Ant with the start.path property set to that value.
To use this script, do the following:
- Download the script into a location in your command path. (For example, if
~yourUserName/bin is in your command path, you could put it there.) You may
have to run the rehash command from the command line to refresh your
terminal's path setting or modify the initialization file (e.g. .cshrc) which
sets your path if you are adding a new directory to your path.
- Go into your local copy of the JHDL tree and into a subdirectory where you are
working.
- Run build.
QuickStart: Putting It All Together
Java Version
To discover which version of Java you hava installed, type:
java -version
On CCL7, it returns:
java version "1.3.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)
To run JHDL, you need a Java 1.3.0 or better. The beta version
1.4.0 is ok. Either SUN or IBM's JDK's work nicely.
Setting Up JHDL Paths
To use the latest JHDL we checked out and built in this tutorial example, we type:
setenv CLASSPATH .:/tmp/mycvs/build/classes
Or, to use the latest "stable" lab release, type:
setenv CLASSPATH .:/fpga3/jhdl/release/latest/JHDL.jar:/fpga3/jhdl/release/swing/swing.jar
Next, we need to setup Jikes' JIKESPATH
setenv JIKESPATH /usr/local/java/jre/lib/rt.jar:$CLASSPATH
Finally, to use java we need to put it into the PATH. Since we are
ssh'd into a linux machine, we enter:
setenv PATH /usr/local/java/bin:$PATH
We can now enter jikes and java and see the default output. If
no errors appear, we are ready to code! Be sure to add your working
directory to the CLASSPATH or Java will complain like this:
error Exception in thread "main" Java.lang.NoClassDefFoundError
For my working directory I entered the following:
setenv CLASSPATH .:$CLASSPATH
If you've SSH'd into a machine, you'll need to export the display to get swing windows to appear:
setenv DISPLAY zap:0
To make sure your Java is working, try compiling and executing the following
file: helloworld.java
class helloworld
{
public static void main(String args[])
{
System.out.println("Hello World");
}
}
Then type
java jab
You might get:
Problem with constructor javax.swing.plaf.FontUIResource and args {Dialog,0,12} : and types {class
java.lang.String,int,int} : java.lang.reflect.InvocationTargetException
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:997)
at javax.swing.UIDefaults$ProxyLazyValue.createValue(UIDefaults.java:663)
at javax.swing.UIDefaults.get(UIDefaults.java:145)
at javax.swing.MultiUIDefaults.get(MultiUIDefaults.java:46)
at javax.swing.UIDefaults.getFont(UIDefaults.java:223)
at javax.swing.UIManager.getFont(UIManager.java:456)
at javax.swing.LookAndFeel.installColorsAndFont(LookAndFeel.java:90)
at javax.swing.plaf.basic.BasicPanelUI.installDefaults(BasicPanelUI.java:51)
at javax.swing.plaf.basic.BasicPanelUI.installUI(BasicPanelUI.java:42)
at javax.swing.JComponent.setUI(JComponent.java:322)
at javax.swing.JPanel.updateUI(JPanel.java:107)
at javax.swing.JPanel.(JPanel.java:67)
at javax.swing.JPanel.(JPanel.java:97)
at byucc.jhdl.apps.Viewers.BrowserMainFrame.BrowserMainFrame.(BrowserMainFrame.java:72)
at byucc.jhdl.apps.Jab.BrowserCore.(BrowserCore.java:100)
at byucc.jhdl.apps.Jab.BrowserCore.main(BrowserCore.java:1229)
Exception in thread "main" java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:58)
at java.awt.Font.initializeFont(Font.java:264)
at java.awt.Font.(Font.java:298)
at byucc.jhdl.apps.Viewers.BrowserMainFrame.BrowserTree.(BrowserTree.java:22)
at byucc.jhdl.apps.Viewers.BrowserMainFrame.BrowserMainFrame.(BrowserMainFrame.java:77)
at byucc.jhdl.apps.Jab.BrowserCore.(BrowserCore.java:100)
at byucc.jhdl.apps.Jab.BrowserCore.main(BrowserCore.java:1229)
Which simply means that because we've SSH'd into a machine and intend to run an xwindows application (via swing), we
forgot to export the display to our machine we're typing at. In my case, I'm logged into ZAP, so I type:
setenv DISPLAY zap:0
Now we're again free to enter
java jab
Jab will spawn two new windows. A JAB Console and a Circuit Browser.
In the SSH window you might see, right before the two new windows are launched:
Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
.
.
.
This is not a problem and is being worked on.
In the JAB console, you might see:
Unable to open file: /ka1/users/byrdmr/.jabrc
Again, this is not a problem. The .jabrc ("JAB-are-see") file, unneeded, is used for storing frequently used aliases.
To get rid of this message, type touch ~/.jabrc
XMAC
Basic JHDL components are available in a number of sizes. For example, AND gates range from 2 to 8 inputs wide. To accomplish this, the standard AND gate class contains
many overloaded constructors for the different numbers of inputs. A script
file, written in XML, automates this task, and is called XMAC.
Javadoc
Javadoc is a tool that parses the declarations and documentation comments in a set of source files and produces a set of HTML pages
describing the classes, inner classes, interfaces, constructors, methods, and fields.
Jab & Tbone
Definitions:
- JAB (Just-Another Browser), is not deprecated in favor of JB, Jab Lite
- JAb is a graphical circuit browser. The tools
byucc.jhdl.apps.Viewers.cvt.tool as well as
byucc.jhdl.apps.StimulatorStimulator and
byucc.jhdl.apps.dtb.DynamicTestBench are the preferred tools for circuit
simulation and execution.
- Test Bench
- A program that will automatically run your circuit through some test vectors.
- Tbone
- A test bench program that lets you do things that you would otherwise only be
able to do by writing a test bench.
- CLI
- A command line interpreter system used in Jab and Tbone to parse and execute user commands.
CLI: Command Line Interpreter, navigating in JAB
CLI is the command interpreter which allows you to interface with JAB.
The CLI commands are listed in the User's Manual.
Netlisting & EDIF files
Once a JHDL design (or a design from any other HDL) is finished,
it is output into in a format that can be interpreted by the tools
that will convert it into something that can be used to configure an FPGA.
This is what netlisting is all about.
Electronic Design Interchange Format (EDIF) files
Appendix A: JHDL Tree Structure:
Here's a snapshot of the JHDL directories taken June 3, '02