spim and xspim are installed on the CS machines (definitely the 32-bit machines, not installed on the 64-bit yet). Download the example float.s file and try both of the following:
> spim -keepstats float.s
> xspim float.s
If you would like to install it on your own machine, download the source if you have a unix-based machine or download the executables if you have a PC. To properly compare floating point output and gather instruction statistics, download the version posted at http://www.cs.colostate.edu/~mstrout/spim/keepstats.html. For a unix-based machine, the only tricky thing I ran into was the EXCEPTION_DIR. Make sure to edit the Makefile in both the spim and the xspim directory to set your CPU_DIR and EXCEPTION_DIR. The EXCEPTION_DIR should be set to the full path to a directory that contains the exception.s file, which currently sits in the CPU/ subdirectory in the spim source.
class Main
{
public static void main(String args[])
{
System.out.println("Hello World!");
}
}
Put Main.java into
a file hierarchy with the following structure:
ProjName.svn/
trunk/
src/
Main.java
branch/
tag/
// Make sure to replace $HOMEDIR with your own unix home directory.
// For example, /s/parsons/c/fac/mstrout
// Replace $MACHINE with a CS unix machine that you use often.
// Replace $USER with your username.
// creating the repository on a CS unix machine
// NOTE: Each project will have its own repository.
// All the project repositories for CS553 will be in
// $HOMEDIR/SVNRepositories/CS553_Projects/.
% cd $HOMEDIR
% mkdir SVNRepositories
% mkdir SVNRepositories/CS553_Projects
% svnadmin create $HOMEDIR/SVNRepositories/CS553_Projects/ProjName
// importing ProjName into the repository
% cd ProjName.svn
% setenv SVN_SSH 'ssh -l $USER'
// if you are using bash do the following:
% export SVN_SSH='ssh -l $USER'
% svn import . svn+ssh://$MACHINE.cs.colostate.edu/$HOMEDIR/SVNRepositories/CS553_Projects/ProjName -m "Initial import"
$USER@$MACHINE.cs.colostate.edu's password:
Adding trunk
Adding trunk/src
Adding trunk/src/Main.java
Adding tag
Adding branch
Committed revision 1.
// get a working directory for the project
% cd ..
% setenv SVN_SSH 'ssh -l $USER'
// if you are using bash do the following:
% export SVN_SSH='ssh -l $USER'
// for some reason the below command requires your password three times
// I have seen this on other subversion servers as well
% svn co svn+ssh://$MACHINE.cs.colostate.edu/$HOMEDIR/SVNRepositories/CS553_Projects/ProjName/trunk ProjName
% cd ~cs553/cs553x % mkdir SVNRepositories % svnadmin create ~cs553/cs553x/SVNRepositories/Project2 // check the permissions, the cs553x, SVNRepositories, and Project2 // directories should all have group rws permissions % ls -al % ls -al SVNRepositories/ // if they don't them change the permissions % cd SVNRepositories % chmod g+rwxs . % find . -type f -print | xargs chmod g+rw % find . -type d -print | xargs chmod g+rwxs
/usr/local/java/bin
Put it BEFORE /usr/local/bin and /usr/bin/.
% setenv PATH /usr/local/java/bin:$PATH
// if you are using bash do the following:
% export PATH=/usr/local/java/bin:$PATH
% javac Main.java
% java Main
Main-Class: Main
% jar cmf mainClass.txt lastname-MJC.jar *.class *.java */*.class */*.java */*/*.class */*/*.java */*/*.dat
% java -jar lastname-MJC.jar infile.java
% /usr/local/bin/eclipse.sh
- Window->Preferences
- Find Java->Code Style->Formatter
- Click on Edit...
- Under the Indentation tab select "Spaces only" as your Tab policy
% setenv PATH /usr/local/jdk-1.5-0-02-nb-4/jdk1.5/bin:$PATH
// if you are using bash do the following:
% export PATH=/usr/local/jdk-1.5-0-02-nb-4/jdk1.5/bin:$PATH
% setenv PATH /s/bach/b/class/cs553/sablecc-3.2/bin:$PATH
// if you are using bash do the following:
% export PATH=/s/bach/b/class/cs553/sablecc-3.2/bin:$PATH
% sablecc straightline.scc
% ant -Dinstall.dir=. install
% java -jar $(SABLECC_DIR)/lib/sablecc.jar minijava.scc
Here is how you create a graphic on the CS department machines:
% dot -Tpng -otest.png test.dot
% dot -Tps2 -Gsize=64,64 -Gmargin=0 -otest.ps2 test.dot
% ps2pdf test.ps2 test.pdf
Here are some notes for using dot on a PC, courtesy of Eric Eastman.
After getting tired of transferring my ".dot" files from my Windows XP
system where I am doing my Java work for the class, to one of the CS
department's Linux systems to display them, I finally got the Graphviz
package to run on my XP system. Using the "dotty" viewer that comes with
the Graphviz package I can now display the graphs under XP.
I downloaded Graphviz from:
http://graphviz.org/Download_windows.php
I tried using the self-installing graphviz-2.8.exe file from this site and
had problems with it, so after de-installing it, I downloaded the
graphviz-win-2.8.bin.tgz file. This file has to be un-gzip, un-tar, and the
directories hand installed, but the dot and dotty programs work under XP.
To display the graph of the file expr2.ast.dot that Michelle sent out last
week, I used the command:
dotty expr2.ast.dot
You can create a jpg file of the graph with the command:
dot -Tjpg expr2.ast.dot > expr2.ast.jpg
I also downloaded and installed "Tintfu", a Java based Editor/Viewer for
".dot" files which works with the Graphvis package and allows you to edit
drawings, from:
http://tintfu.sourceforge.net/
It comes as a single "jar" file, so it's easy to install.
Under Run => External Tools => External Tools...
- Create a new configuration.
- Give it a name, maybe "SableCC"
- On the Main tab:
- Provide the location of SableCC
For me it was "C:\sablecc-3.2\bin\sablecc.bat"
- For the working directory I used "${project_loc}/src"
- Select the .scc file that you want to run (or run the
main in that project and select nothing) before
running this tool.
- Under arguments I used "*.scc"
- Under the Refresh tab:
- Select "Refresh resources upon completion" and "The
project containing the selected resource and
"Recursively inc..."
- Now you can just click on the green play icon with the red
tool box on the toolbar to the right of debug and run icons
Now that I have a tool named "SableCC" I can add it as a builder for
a project.
- Select a project, right click and select properties
- Under builders you can either import SableCC (or create a new
one using a similar process)
- Select that new builder and move it up so that it runs before
the Java Builder