|
JOP - Java Optimized Processor
|
Home |
Getting StartedThis document is also available as PDF: An Introduction to the Design Flow for JOP This document describes the design flow for JOP - how to build the Java processor and a Java application from scratch (the VHDL and Java sources) and download the processor to an FPGA and the Java application to the processor. 1 IntroductionJOP [2], the Java optimized processor, is an open-source development available for different targets (Altera and Xilinx FPGAs and various types of FPGA boards). To support several targets the design-flow gets a little bit complicated. There is a Makefile available and when everything is set up correct a simplemakeshould build everything from the sources and download a Hello World example. However, to costumize the Makefile for a different target it is necessary to understand the complete design flow. 1.1 ToolsAll needed tools are freely available.
javac gcc make cvs quartus_map jbi32All the executables should be found and usually report their usage. 1.2 Getting StartedThis sections shows a quick step-by-step build of JOP for the Cyclone target in the minimal configuration. All directory paths are given relative to the JOP root directory jop. The build process is explained in more detail in one of the following sections.1.2.1 Download the SourceCreate a working directory and download JOP from the www.opencores.org CVS server:cvs -d :pserver:anonymous@cvs.opencores.org:/cvsroot/anonymous -z9 co -P jopAll sources are downloaded to a directory jop. For the following command change to this directory. Create the needed directories with: make directories 1.2.2 ToolsThe tools are built with following make command:make tools 1.2.3 Assemble the Microcode JVM, Compile the ProcessorThe JVM configured to download the Java application from the serial interface is built with:make jopserThis command also invokes Quartus to build the processer. If you want to build it within Quartus follow the following instructions: Start Quartus II and open the project jop.qpf from directory quartus/cycmin in Quartus with File - Open Project.... Start the compiler and fitter with Processing - Start Compilation. After successful compilation the FPGA is configured with Tools - Programmer and Start. 1.2.4 Compiling and Downloading the Java ApplicationA simple Hello World application is the default application in the Makefile. It is built and downloaded to JOP with:make jappThe "Hello World" message should be printed in the command window and the LED on the board should blink. For a different application change the Makefile targets or override the make variables at the command line. Following example builds and runs some benchmarks on JOP: make japp -e P1=bench P2=jbe P3=DoAll 1.3 Xilinx Spartan-3 Starter KitFor the Xilinx starter kit the design flow is very similar:
2 Booting JOP - How Your Application StartsBasically this is a two step process: a.) configure the FPGA and b.) load the Java application. There are different ways to perform these steps.2.1 FPGA ConfigurationFPGAs are usually SRAM based and lose their configuration after power down. Therefore the configuration has to be loaded on power up. For development the FPGA can be configured via a download cable (with JTAG commands). This can be done within the IDEs from Altera and Xilinx or with command line tools such as quartus_pgm or jbi32. When the device shall boot automatically the configuration has to be stored in non volatile memory such as Flash. Serial Flash is directly supported by an FPGA to boot on power up. Another method is to use a standard parallel Flash to store the configuration and additional data (e.g. the Java application). A small PLD reads the configuration data from the Flash and shifts it into the FPGA. This method is used on the Cyclone and ACEX boards.2.2 Java DownloadWhen the FPGA is configured the Java application has to be downloaded into the main memory. This download is performed in microcode as part of the JVM startup sequence. The application is a .jop file generated by JOPizer. At the moment there are three options:
2.3 CombinationsTheoretically all ways to configure the FPGA can be combined with all ways to download the Java application. However, only two combinations are useful:
3 The Design FlowThis section describes the design flow to build JOP in greater detail.3.1 ToolsThere are a few tools necessary to build and download JOP to the FPGA boards. Most of them are written in Java. Only the tools that access the serial line are written in C2.3.1.1 DownloadingThese little programs are already compiled and the binaries are checked in in the CVS. The sources can be found in directory c_src.
3.1.2 Generation of FilesThese tools are written in Java and are delivered in source form. The source can be found under java/tools/src and the class files are in jop-tools.jar in directory java/tools/dist/lib.
3.1.3 Simulation
3.2 TargetsJOP has been successfully ported to several different FPGAs and boards. The main distribution contains the ports for the FPGAs:
3.2.1 ACEX EP1K50C144 JopcoreThis board was one of the first targets (besides the KFL project) for JOP and the design files of the board are now available as open-source from http://www.opencores.org/projects.cgi/web/acxbrd/overview. As the FPGA is a little bit dated the latest features of JOP (e.g. the enhancements in the method cache) are not available in the Acex port. Use jop_20040913_v37_web.zip from the archive section. Two Quartus projects for this board are available: acxmin, a minimum configuration containing only a serial interface, and acxtal, a configuration for the baseio extension board. The ACEX specific files are jopacx.vhd and mem.vhd.3.2.2 Cyclone EP1C6/12This board is pin-compatible to the ACEX board and comes in two versions: with an Cyclone EP1C6 or EP1C12. The board contains:
3.2.3 Xilinx Spartan-3The Spartan-3 specific files are jop_xs3.vhd and mem_xs3.vhd for the Xilinx Spartan-3 Starter Kit and jop_trenz.vhd and mem_trenz.vhd for the Trenz Retrocomputing board.4 EclipseIn folder eclipse there are several Eclipse projects that you can import into your Eclipse workspace. All projects use the Eclipse path variable3 JOP_HOME that has to point to the root directory of the JOP sources. Under Window - Preferences... select General - Workspace - Linked Resources and create the path variable JOP_HOME with New.... Import the projects with File - Import.. and Existing Projects into Workspace. Select as root directory .../jop/eclipse, select the projects you want to import and press Finish. Table 2 shows all available projects.
5 SimulationThis section contains the information you need to get a simulation of JOP running. There are two ways to simulate JOP:
5.1 Background InformationTo simulate JOP, or any other processor design, in a vendor neutral way models of the internal memories (block RAM) and the external main memory are necessary. Beside this, only a simple clock driver is necessary. To speed-up the simulation a little bit a simulation of the uart output, which is used for System.out.print(), is also part of the package. Table 3 lists the simulation files for JOP and which program generates the initialization data. The non-generated VHDL files can be found in directory vhdl/simulation.
make simAfter a few seconds you should see the startup message from JOP printed in ModelSims command window. 6 Files Types You Might EncounterAs there are various tools involved in the complete build, you will find files with various extensions. The following list explains the file types you might encounter when changing and building JOP. The list is far from being complete - it's just a start. The following files are the source files:
7 Porting JOPAdd a description about the files (memory).7.1 Test UtilitiesTo verify that the port of JOP is successful there are some small test programs in asm/src. To run the JVM on JOP the microcode jvm.asm is assembled and will be stored in an on-chip ROM. The Java application will than be loaded by the first microcode instructions in jvm.asm into an external memory. However, to verify that JOP and the serial line are working correct it is possible to run small test programs directly in microcode. One test program (blink.asm) does not need the main memory and is a first test step before testing the possible changed memory interface. testmon.asm can be used to debug the main memory interface. Both test programs can be built with the make targets jop_blinktest and jop_testmon.7.1.1 Blinking LED and UART outputIn directory asm the blink test program is built with:build blinkCompile and download the FPGA configuration as described in Section 1.2.3. After download the watchdog LED should blink and the FPGA will print out 0 and 1 on the serial line. Use a terminal program or the utility e.exe to check the output from the serial line. 7.1.2 Test MonitorIn directory asm the test monitor is built with:build testmonStart a terminal program (e.g. HyperTerm) to communicate with the monitor program. Compile and download the FPGA configuration as described in Section 1.2.3. After download the program prints the content of the memory at address 0. The program understands following commands:
8 AcknowledgmentsEd Anuff wrote testmon.asm to perform a memory interface test and BlockGen.java to convert Altera .mif files to Xilinx memory blocks. BlockGen.java was the key tool to port JOP to Xilinx FPGAs in general and the Spartan-3 more specific. Flavius Gruian wrote JOPizer to generate the .jop file from the application classes. JOPizer is based on the open source BCEL and a substitute to Sun's proprietary JavaCodeCompact.9 Notes
9.1 A Customized InstructionAdd a description how to implement a customized or native instruction with hardware support on JOP.9.2 A new Peripheral DeviceCreation of a new peripheral devices involves some VHDL coding. However, there are several examples jop/vhdl/scio. All peripheral components in JOP are connected with the SimpCon [3] interface. If you want to use a device that implements the Wishbone [1] bus, a SimpCon-Wishbone bridge is available (e.g. it is used to connect the AC97 interface in the dspio project). I would suggest to start by using an example and change it to your needs. Take a look into sc_test_slave.vhd. All peripheral components (SimpCon slaves) are connected in one module usually named scio_xxx.vhd. Browse the examples and copy one that best fits your needs. In this module the address of your peripheral device is defined (e.g. 0x10 for the primary UART). This IO address is mapped to a negative memory address for JOP. That means 0xffffff80 is added to the address. By convention this address mapping is defined in com.jopdesign.sys.Const. Here is the UART example:// use neagitve base address for fast constant load // with bipush public static final int IO_BASE = 0xffffff80; ... public static final int IO_STATUS = IO_BASE+0x10; public static final int IO_UART = IO_BASE+0x10+1;The IO devices are accessed from Java by native5 functions: com.jopdesign.sys.Native.rd() and wr(). Again an example with the UART:
// busy wait on free tx buffer
// no wait on an open serial line, just wait
// on the baud rate
while ((Native.rd(Const.IO_STATUS)&1)==0) {
;
}
Native.wr(c, Const.IO_UART);
I would suggest that you create your own scio_xxx.vhdl and
your own Quartus project for your configuration. So you're not
mixing your changes up when you download a new version of JOP. For
your new Quartus project you only have to copy the three files
jop.cdf, jop.qpf, and jop.qsf in a new directory under quartus. This
new directory is the project name you have to set in the Makefile:
QPROJ=yourproject
You new VHDL module and the scio_xxx.vhdl are added in
jop.qsf. This file is a plain ASCII file and you can edit it with
your editor or with Quartus if you like.
References
Footnotes:1All addresses in JOP are counted in 32-bit quantities. However, the Flash is connected only to the lower 8 bits of the data bus. Therefore a store of one word in the main memory needs four loads from the Flash. 2The Java JDK still comes without the javax.comm package and getting this optional package correct installed is not that easy - Blame Sun. 3Eclipse (path) variables are workspace specific. 4Eclipse can't use path variables for external .jar files - annoying 5These are not real functions and are substituted by special bytecodes on application building with JOPiter. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Copyright © 2000-2007, Martin Schoeberl
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||