labs.beatcraft.com

Caution:
The project of JavaRock, a high-level synthesis language has already been closed.
It has moved to its successor, which is called Synthesijer.
BC::labs puts weight on the project of Stnthesijer and frequently update the new project.

Please consider this page and JavaRock related articles as reference.


JavaRock

JavaRock is a high-level synthesis language, which generates HDL from Java language.
This article shows how to set up the basic working environment for JavaRock.

If you like to see how JavaRock works with an evaluation board, please visit this page.
This example shows how to use JavaRock for DE0-Nano.

How to Compile a JavaRock sample on Ubuntu (12.04 32bit version)

Basic set up

The newest compiled JavaRock is javarock_20130708.jar, and the latest sample code set of JavaRock is samples_20130707.tar,gz.
Please download them from the URL shown below.
http://sourceforge.net/projects/javarock/files/20130708/

Install Ubuntu 12.04 (32bit version) and add the package listed below.

$ sudo apt-get install build-essential
$ sudo apt-get install openjdk-7-jdk

Compile JavaRock Samples

Set PATH, which defines the location of javarock_20130708.jar is placed, to the environment variable of JavaRock, JAVAROCK.

$ export JAVAROCK=/home/beat/JavaRock/javarock_20130708.jar


Compile samples/pong.
Assume that the directory of samples is /home/beat/JavaRock/samples.
If comile_fpga.sh does not have the executable permission, give it, and execute it.

$ cd JavaRock/
$ ls
javarock_20130708.jar  samples  samples_20130707.tar.gz
$ export JAVAROCK=/home/beat/JavaRock/javarock_20130708.jar
$ cd samples/pong/
$ ls
ButtonIF.java  DE2-115  Game.java  Top.java  acknowledgement.txt  compile_fpga.bat  compile_fpga.sh
$ chmod +x compile_fpga.sh
$ ./compile_fpga.sh
Compile: ButtonIF
Compile: Game
Compile: Top
pass: connection
pass: bypass
pass: optimization
pass: linkage
pass: generate
VHDLArrayAccess:getReadSignal: TO => net.wasamon.javarock.model.vhdl.VHDLIdent
VHDLArrayAccess:getReadSignal: TO => net.wasamon.javarock.model.vhdl.VHDLIdent
VHDLArrayAccess:getReadSignal: TO => net.wasamon.javarock.model.vhdl.VHDLIdent
VHDLArrayAccess:getReadSignal: TO => net.wasamon.javarock.model.vhdl.VHDLIdent
VHDLArrayAccess:getReadSignal: TO => net.wasamon.javarock.model.vhdl.VHDLIdent
VHDLArrayAccess:getReadSignal: TO => net.wasamon.javarock.model.vhdl.VHDLIdent
VHDLArrayAccess:getReadSignal: TO => net.wasamon.javarock.model.vhdl.VHDLIdent
VHDLArrayAccess:getReadSignal: TO => net.wasamon.javarock.model.vhdl.VHDLIdent
VHDLArrayAccess:getReadSignal: TO => net.wasamon.javarock.model.vhdl.VHDLIdent
VHDLArrayAccess:getReadSignal: TO => net.wasamon.javarock.model.vhdl.VHDLIdent
VHDLArrayAccess:getReadSignal: TO => net.wasamon.javarock.model.vhdl.VHDLIdent
VHDLArrayAccess:getReadSignal: TO => net.wasamon.javarock.model.vhdl.VHDLIdent


After the compile process is completed, please check that class files and vhd file are generated.

$ ls
ButtonIF.class  DE2-115     Game.java  Top.java             compile_fpga.bat  game.vhd
ButtonIF.java   Game.class  Top.class  acknowledgement.txt  compile_fpga.sh   top.vhd

How to Compile JavaRock sample on Mac OS X

JavaRock can be compiled on Mac OS X Mavericks (10.9.3) if JDK7 is installed to Mac OS X.
The default Java on Mac OS X Mavericks is Java 1.6, but JavaRock cannot be compiled with Java 1.6. Java 1.7 is the requirement.

$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
    1.6.0_65-b14-462, x86_64:   "Java SE 6"     /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    1.6.0_65-b14-462, i386:     "Java SE 6"     /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home


Download Oracle JDK from the URL below.
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
After the download of jdk-7u55-maxosx-x64.dmg is completed, the execute the file.
As the installer screen shows up, please follow its instructions to install JDK.
After the installation is completed, please check its version of JDK.

$ java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)

$ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
    1.7.0_55, x86_64:   "Java SE 7"     /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home
    1.6.0_65-b14-462, x86_64:   "Java SE 6"     /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    1.6.0_65-b14-462, i386:     "Java SE 6"     /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

Compile JavaRock samples

Confirming that JDK7 is installed, set PATH, which defines the location of javarock_20130708.jar is placed, to the environment variable of JavaRock, JAVAROCK. This is the same way as having done to Ubuntu.

$ export JAVAROCK=/home/beat/JavaRock/javarock_20130708.jar

Setting PATH to the environment variable, execute samples/test/test.sh.

$ cd ~/JavaRock/samples/test
$ ./test.sh
Compile: counter
Compile: led
Compile: SC1602Wrapper
Compile: SC1602Writer
Compile: sc1602_test
Compile: echo
Compile: rs232c
Compile: test
pass: connection
pass: bypass
pass: optimization
pass: linkage
pass: generate
VHDLArrayAccess:getReadSignal: TO => net.wasamon.javarock.model.vhdl.VHDLIdent
VHDLArrayAccess:getReadSignal: TO => net.wasamon.javarock.model.vhdl.VHDLIdent


$ ls
counter.vhd             rs232c.vhd              test.class
echo.vhd                sc1602_test.vhd         test.java
led.vhd                 sc1602writer.vhd        test.sh
rs232c.class            sim.VHD                 test.ucf
rs232c.java             test.bat                tes


If the class file and vhd file exist, this file, test.sh, is executed correctly,
If test.sh is executed without updating the version of Java, these errors will occur. The details are shown below.

$ cd ~/JavaRock/samples/test
$ ./test.sh 
An exception has occurred in the compiler ((version info not available)). Please file a bug at the JavaRock BugTracks (http://sourceforge.net/p/javarock/bugs/)  after checking the Bug Parade for duplicates.
Include your program and the following diagnostic in your report.  Thank you.
java.lang.NoClassDefFoundError: javax/lang/model/type/UnionType
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at openjdk.com.sun.tools.javac.comp.MemberEnter.<init>(MemberEnter.java:95)
        at openjdk.com.sun.tools.javac.comp.MemberEnter.instance(MemberEnter.java:85)
        at openjdk.com.sun.tools.javac.comp.Enter.<init>(Enter.java:126)
        at openjdk.com.sun.tools.javac.comp.Enter.instance(Enter.java:114)
        at openjdk.com.sun.tools.javac.comp.Check.<init>(Check.java:96)
        at openjdk.com.sun.tools.javac.comp.Check.instance(Check.java:86)
        at openjdk.com.sun.tools.javac.code.Types.<init>(Types.java:101)
        at openjdk.com.sun.tools.javac.code.Types.instance(Types.java:88)
        at openjdk.com.sun.tools.javac.jvm.ClassReader.<init>(ClassReader.java:264)
        at openjdk.com.sun.tools.javac.jvm.ClassReader.instance(ClassReader.java:226)
        at openjdk.com.sun.tools.javac.main.JavaCompiler.<init>(JavaCompiler.java:331)
        at openjdk.com.sun.tools.javac.main.JavaCompiler.instance(JavaCompiler.java:88)
        at openjdk.com.sun.tools.javac.main.Main.compile(Main.java:424)
        at openjdk.com.sun.tools.javac.main.Main.compile(Main.java:353)
        at openjdk.com.sun.tools.javac.main.Main.compile(Main.java:342)
        at openjdk.com.sun.tools.javac.main.Main.compile(Main.java:333)
        at openjdk.com.sun.tools.javac.Main.compile(Main.java:76)
        at openjdk.com.sun.tools.javac.Main.main(Main.java:61)
Caused by: java.lang.ClassNotFoundException: javax.lang.model.type.UnionType
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        ... 30 more

About JavaRock

The contents of expanded samples_201310707.tar.gz are organized as they are shown below.
In the following directories, kc705 indicates this directory for Xilinx Kintex-7 FPGA KC705.
Test directory is for Virtex-6 FPGA ML605 Evaluation Kit. microboard is the directory for Avnet Spartan-6 LX9 MicroBoard.
Zedboard is the test directory for Xulinx ZedBoard ZedBoard.

samples
├── altera
│ ├── DE2_115.qsf
│ ├── DE2_115.v
│ ├── Test.java
│ ├── Top.java
│ ├── mandelbrot
│ │ ├── Firefly.java
│ │ ├── Mandelbrot.java
│ │ ├── SC1602Wrapper.java
│ │ ├── SC1602Writer.java
│ │ ├── VGAIf.java
│ │ ├── VGAJavaTest.java
│ │ ├── VGAWrapper.java
│ │ ├── compile
│ │ │ ├── mandelbrot.sof
│ │ │ ├── test.qsf
│ │ │ └── test.sof
│ │ ├── main.java
│ │ ├── sc1602_test.java
│ │ ├── test.sh
│ │ └── test.v
│ ├── mandelbrot.sof
│ ├── test
│ │ ├── Firefly.java
│ │ ├── Mandelbrot.java
│ │ ├── SC1602Wrapper.java
│ │ ├── SC1602Writer.java
│ │ ├── VGAIf.java
│ │ ├── VGAJavaTest.java
│ │ ├── VGAWrapper.java
│ │ ├── main.java
│ │ ├── sc1602_test.java
│ │ ├── test.sh
│ │ └── test.v
│ ├── test.qsf
│ └── test.sof
├── arith
│ ├── arith.java
│ ├── assign.java
│ └── floating.java
├── array
│ ├── BitVectorTest.java
│ ├── bitvectortest_sim.VHD
│ ├── fill.java
│ ├── fillsim.java
│ ├── fillsim_sim.VHD
│ ├── main.java
│ ├── out.vcd
│ ├── rx.java
│ ├── sum.java
│ ├── sumsim.java
│ ├── sumsim_sim.VHD
│ ├── test.java
│ ├── test2.java
│ ├── test3.java
│ ├── testTest.java
│ ├── testtestsim.VHD
│ ├── tx.java
│ └── work-obj93.cf
├── bench
│ ├── BubbleSort.java
│ ├── BubbleSortMod.java
│ ├── BubbleSortSim.java
│ ├── BubbleSortThread.java
│ ├── Sieve.java
│ ├── SieveMod.java
│ ├── SieveSim.java
│ ├── SieveThread.java
│ ├── bubblesort.sh
│ ├── sieve.sh
│ ├── simbubble.VHD
│ └── simsieve.VHD
├── bf e-trees exStick
│ ├── BF.java
│ ├── HW.java
│ ├── IO.java
│ ├── Test.java
│ ├── TestHW.java
│ ├── compile.sh
│ ├── exstick.VHD
│ ├── exstick.ucf
│ ├── exstick2.ucf
│ ├── rs232c.java
│ ├── sim
│ │ └── IO.java
│ ├── sim.VHD
│ ├── test.ucf
│ └── top.VHD
├── callback
│ ├── CallBackTest.java
│ ├── Counter.java
│ ├── test.ucf
│ └── top.v
├── container
│ ├── List.java
│ ├── Stack.java
│ └── Test.java
├── echo
│ ├── UpperEcho.java
│ ├── echo.java
│ └── rs232c.java
├── float
│ └── test.java
├── i2c
│ ├── I2C_IF.java
│ ├── I2C_Master_Wrapper.java
│ ├── I2C_Test.java
│ ├── SimpleI2C_Wrapper.java
│ ├── top.VHD
│ └── zedboard.ucf
├── kc705~ │ ├── compile.bat
│ ├── compile.sh
│ ├── rs232c.java
│ ├── test.java
│ ├── test.sh
│ ├── top.VHD
│ └── top.ucf
├── led
│ ├── Firefly.java
│ ├── counter.java
│ └── led.java
├── microboard │ ├── button.java
│ ├── microboard.sh
│ ├── sim.VHD
│ ├── test.java
│ ├── test.ucf
│ └── top.VHD
├── old
│ ├── Hoge.java
│ ├── MUX.java
│ ├── MyString.java
│ ├── append.java
│ ├── appendsim.java
│ ├── arraysim.java
│ ├── arraysim2.java
│ ├── arraytest.java
│ ├── arraytest2.java
│ ├── echo0.java
│ ├── echo1.java
│ ├── put.java
│ ├── state.java
│ └── step.java
├── pong
│ ├── ButtonIF.java
│ ├── DE2-115
│ │ ├── DE2-115.qpf
│ │ └── DE2-115.qsf
│ ├── Game.java
│ ├── Top.java
│ ├── acknowledgement.txt
│ ├── compile_fpga.bat
│ └── compile_fpga.sh
├── prime
│ ├── Prime.java
│ ├── PrimeSim.java
│ ├── PrimeThread.java
│ ├── sim.VHD
│ └── test.sh
├── random
│ ├── Random19Wrapper.java
│ └── sim.VHD
├── sc1602
│ ├── SC1602Wrapper.java
│ ├── SC1602Writer.java
│ ├── ml605_sc1602.ucf
│ └── sc1602_test.java
├── sformat
│ ├── SParser.java
│ ├── SParserTest.java
│ └── test.dat
├── syntax
│ ├── cond.java
│ ├── condtest.java
│ ├── condtest_sim.VHD
│ ├── for_test.java
│ ├── for_test_test.java
│ ├── for_test_test_sim.VHD
│ ├── out.vcd
│ ├── private_method.java
│ ├── private_method_test.java
│ ├── private_method_test_sim.VHD
│ ├── public_constant.java
│ ├── public_constant_test.java
│ ├── public_constant_test_sim.VHD
│ ├── subblock.java
│ ├── subblock_test.java
│ ├── subblock_test_sim.VHD
│ ├── sync.java
│ ├── sync_test.java
│ ├── sync_test_sim.VHD
│ ├── thread_test.java
│ ├── thread_test_test.java
│ ├── thread_test_test_sim.VHD
│ ├── type_test.java
│ ├── type_test_test.java
│ ├── type_test_test_sim.VHD
│ └── work-obj93.cf
├── test
│ ├── rs232c.java
│ ├── sim.VHD
│ ├── test.bat
│ ├── test.java
│ ├── test.sh
│ └── test.ucf
├── upl_tx_rx
│ ├── Makefile
│ ├── UPL32Test.java
│ ├── UPL32_RX.java
│ ├── UPL32_TX.java
│ ├── UPL8Test.java
│ ├── UPL8_RX.java
│ ├── UPL8_TX.java
│ ├── simpledualportram.VHD
│ ├── upl32_sim.VHD
│ ├── upl8_sim.VHD
│ ├── vhdl_upl32_rx_wrapper.VHD
│ ├── vhdl_upl32_tx_wrapper.VHD
│ ├── vhdl_upl8_rx_wrapper.VHD
│ ├── vhdl_upl8_tx_wrapper.VHD
│ ├── vhdl_upl_rx.VHD
│ └── vhdl_upl_tx.VHD
├── vgatest
│ ├── VGAIf.java
│ ├── VGAJavaTest.java
│ ├── VGAWrapper.java
│ ├── sramiface.VHD
│ ├── swing
│ │ └── VGAIf.java
│ ├── vga.VHD
│ ├── vgaclk.VHD
│ ├── vgagen.VHD
│ └── vgaiface.VHD
├── vhdl
│ ├── arraytop.vhd
│ ├── bitvector.vhd
│ ├── blockram.vhd
│ ├── button.vhd
│ ├── clk_div.vhd
│ ├── distributedram.vhd
│ ├── ml605.ucf
│ ├── rs232c_rx.vhd
│ ├── rs232c_tx.vhd
│ ├── sim.vhd
│ └── simpledualportram.vhd
├── wait-notify
│ ├── Consumer.java
│ ├── NoWait.java
│ ├── NoWait2.java
│ ├── NoWait2Test.java
│ ├── Producer.java
│ ├── Simulation.java
│ ├── Test.java
│ ├── nowait2_sim.VHD
│ └── nowait_sim.VHD
└── zedboard
   ├── FPGAMain.java
   ├── HDMI_1280_720_Wrapper.java
   ├── LED.java
   ├── compile.sh
   ├── i2cmem
   ├── top.VHD
   └── zedboard.ucf
32 directories, 232 files

Reference

Revision History

  • 2014/12/24 This article is initially published

  • Caution:
    The development of JavaRock has been closed, and it has the successor, which is called Synthesijer.
    If you are interested in a high-level synthesis, which is generates HDL from Java language, please go to Synthesijer.

Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   RSS of recent changes
Last-modified: 2014-12-24 (Wed) 07:32:30 (3637d)