In this chapter, we explain how to download, install and start using Spark. We also present the files and directory setup required to
run Spark.
3.1 Downloading and Installing Spark
Spark can be obtained from the download page at:
http://mesl.ucsd.edu/spark
Choose the appropriate distribution based on the operating system you
want to work on. The distribution will be named
``spark-[OS]-[Version].tar.gz''. So let us say you are interested the
1.1 version for the Linux platform, you will download the file
``spark-linux-1.1.tar.gz''. For the Windows distribution, we ship a
ZIP archive named ``spark-win32-[Version].zip''.
After downloading this file, gunzip and untar the file as follows:
gunzip spark-linux-1.1.tar.gz
tar xvf spark-linux-1.1.tar.gz
OR
unzip spark-win32-1.1.zip
|
Uncompressing (gunzip and untar) the distribution will create the
following directory structure:
spark-[OS]-[Version]/
bin/
include/
tutorial/
spark-setup.csh
spark-setup.sh
|
where [OS] is the operating system for which you downloaded the
distribution and [Version] is the Spark version. The ``bin''
directory contains the Spark binary and other files required to
execute Spark. The ``tutorial'' directory contains the tutorial
shipped with this distribution and described in the Spark
Tutorial document. The ``include'' directory contains standard ``C''
include files such as stdio.h et cetera that are included by some
input applications. However, note that for the Windows distribution,
these include files are not useful. If you do want to include system
files such as ``stdio.h'' et cetera, please specify the path to these
files using the environment variable SPARK_INCLUDES or using the
command-line flag ``-I /path/to/include''.
To begin with source the ``spark-setup.csh/sh'' script as follows:
source spark-setup.csh # if you are using csh/tcsh shell
. spark-setup.sh # if you are using sh/bash shell
|
For the Windows distribution, if you are using Spark under
CYGWIN or MSYS/MINGW, then you can source the spark-setup.sh file,
else for native Windows, you can run the batch file
``spark-setup.bat''.
The ``spark-setup'' script sets up the path to the Spark
executable, along with some environment variables required by Spark. You are now ready to use Spark. In the next section,
we describe the files and directory setup required for Spark to
run. Details on the how to run the tutorial can be found in a
separate document also available on the Spark download website.
3.2 Files Required and Directory Setup
To run the Spark executable, you require:
112
default.spark or filename.spark: This file is the
hardware description file that contains the resource allocation,
bit-widths of various data types, et cetera (see Section
4.315Hardware Description File Format: default.sparksection.4.3). A sample default.spark is listed in Appendix
A24Sample default.spark Hardware Description fileappendix.A.
Priority.rules or any file specified under the
``[SchedulerRules]'' section of the default.spark file. This file
contains all the rules and switches controlling the scheduling
heuristic, branch balancing heuristic, code motions et cetera (see
Section 4.521Scripting Options for Controlling Transformations and Heuristics: Priority.rulessection.4.5). A sample Priority.rules is listed in
Appendix B26Recommended Priority.rules Synthesis Script fileappendix.B.
./output directory: This is the directory in which all the
output files, including the dotty graphs, VHDL and C output,
et cetera are generated.
Sample default.spark and Priority.rules files are included with the
Spark distribution in the ``spark-[OS]-[Version]/bin''
directory.
3.3 Recommended Command-line Options for Invoking Spark
We recommend the following command-line options for invoking
Spark:
spark -hli -hcs -hcp -hdc -hs -hvf -hb -hec filename.c
The command-line options that are enabled are: loop-invariant code
motion (-hli), common sub-expression elimination (-hcs), copy and
constant propagation (-hcp), dead code elimination (-hdc), scheduling
(-hs), generation of synthesizable RTL VHDL (-hvf),
interconnect-minimizing resource binding (-hb) and generation of
statistics about cycle count (-hec).
3.4 Options for Synthesizing Microprocessor Blocks
To synthesize microprocessor blocks [16], we have to
enable operation chaining across conditional boundaries by using the
command-line option -hch and we have to increase the clock period to
a large number so that all the operations can be packed into one clock
cycle. We arbitrarily increase clock period to 10000ns: this enables
up to 1000 additions to be chained together (if each addition takes
10ns). The clock period can be set in the ``[GeneralInfo]'' section
of the default.spark file (see Section 4.3.116Timing Informationsubsection.4.3.1) and the
timing of each operation in the design can be set in the
``[Resources]'' section (see Section 4.3.317Hardware Resource Informationsubsection.4.3.3).
Also, we have to enable full loop unrolling. This can be done by
setting the number of unrolls in the ``[RDLPParams]'' section of the
default.spark file to the number of iterations of the loop to be
unrolled (see Section 4.3.519Loop Unrolling and Pipelining Parameterssubsection.4.3.5).
Hence, for synthesizing microprocessor blocks, we recommend the
following command-line options for invoking Spark:
spark -hch -hli -hcs -hcp -hdc -hs -hvf -hb -hec filename.c