<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.ice-online.com/index.php?action=history&amp;feed=atom&amp;title=ICE_Help_JVCC</id>
	<title>ICE Help JVCC - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ice-online.com/index.php?action=history&amp;feed=atom&amp;title=ICE_Help_JVCC"/>
	<link rel="alternate" type="text/html" href="https://wiki.ice-online.com/index.php?title=ICE_Help_JVCC&amp;action=history"/>
	<updated>2026-08-20T16:14:04Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.ice-online.com/index.php?title=ICE_Help_JVCC&amp;diff=564&amp;oldid=prev</id>
		<title>ConvertBot: Java Verilog Cross Compiler for data processing cores</title>
		<link rel="alternate" type="text/html" href="https://wiki.ice-online.com/index.php?title=ICE_Help_JVCC&amp;diff=564&amp;oldid=prev"/>
		<updated>2020-04-27T18:33:01Z</updated>

		<summary type="html">&lt;p&gt;Java Verilog Cross Compiler for data processing cores&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;div style=&amp;quot;background-color: #eef9ff; border: 1px solid #999; padding: 10px;&amp;quot;&amp;gt;[[ICE_Help|&amp;amp;uarr; ''Go to the full list of ICE Help pages'']].&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;onlyinclude&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
'''Summary:''' Java Verilog Cross Compiler for data processing cores&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Motivation: &lt;br /&gt;
&lt;br /&gt;
The ICE-CORE (Code-Once-Run-Everywhere) framework is intended to simplify &lt;br /&gt;
algorithm development and deployment by using a single test and development&lt;br /&gt;
methodology when writing code that runs on different platforms such as &lt;br /&gt;
CPUs, GPUs, VPUs and FPGAs.&lt;br /&gt;
&lt;br /&gt;
The maintenance of these source files can be reduced in many situations by using&lt;br /&gt;
the ICE-JVCC cross compiler.  We define a new language, JavaVerilog, that has the &lt;br /&gt;
information necessary to automatically generate the Java, C, and SystemVerilog &lt;br /&gt;
code for various platforms.&lt;br /&gt;
&lt;br /&gt;
== Compiler ==&lt;br /&gt;
&lt;br /&gt;
The JVCC cross compiler takes in a Java/Verilog coreName.jv file and generates the &lt;br /&gt;
source code for each of the different platforms.  This includes coreName.java for &lt;br /&gt;
a JVM, coreName.c for a CPU, and coreName.sv for an FPGA supporting SystemVerilog.&lt;br /&gt;
&lt;br /&gt;
The Java and C versions are self contained and will run on any JVM or CPU.  &lt;br /&gt;
&lt;br /&gt;
The SystemVerilog version contains instances of Java objects converted into&lt;br /&gt;
System Verilog modules that can be compiled into .bit files on Xilinx, Altera &lt;br /&gt;
or any other FPGA supporting SystemVerilog.  In this case, the library calls in &lt;br /&gt;
the C code initialize the objects, load the initial class variables into the FPGA, &lt;br /&gt;
and start the data flow to execute the core's processing methods in the hardware &lt;br /&gt;
device.&lt;br /&gt;
&lt;br /&gt;
== Language ==&lt;br /&gt;
&lt;br /&gt;
The JavaVerilog language follows Java 1.6 constructs with the following extensions:&lt;br /&gt;
&lt;br /&gt;
Integer data types can specify the number of bits, ex. uint6 for a 6 bit integer.&lt;br /&gt;
The Verilog syntax for selecting bit ranges of an integer is adopted for ease of &lt;br /&gt;
use.  For example:  myint[5:3] refers to bits 3 through 5 of the integer myint.&lt;br /&gt;
Fixed floating point types fptx and dptx are introduced to support FPGA platforms&lt;br /&gt;
that do not efficiently support IEEE floating point arithmetic.&lt;br /&gt;
&lt;br /&gt;
== Flows ==&lt;br /&gt;
&lt;br /&gt;
The current JVCC supports three different processing flows: Stream, Buffer, and Array.&lt;br /&gt;
&lt;br /&gt;
The Stream flow is useful for applications working on a stream of data accessing a &lt;br /&gt;
window of a few samples at a time which is often the case in signal processing.&lt;br /&gt;
&lt;br /&gt;
The Buffer flow is useful for packet processing where one needs random access to &lt;br /&gt;
data within defined blocks of a data stream.&lt;br /&gt;
&lt;br /&gt;
The Array flow is useful for implementing fixed vector operations.&lt;br /&gt;
&lt;br /&gt;
The first two flows each have one data input stream and one data output stream.  &lt;br /&gt;
The Ice-Core framework handles getting control information and data to/from the core.&lt;br /&gt;
Alternate frameworks may use OpenCL to implement these control and data flow functions.&lt;br /&gt;
The compiled FPGA module behaves as an OpenCL kernel.&lt;br /&gt;
&lt;br /&gt;
== Data Types ==&lt;br /&gt;
&lt;br /&gt;
The Java language supports primitive data types of byte, short, int, long, float and &lt;br /&gt;
double.  JavaVerilog extends this set to include integers of any bit length and fixed &lt;br /&gt;
floating point types.  When implementing these variables on non-FPGA platforms, they &lt;br /&gt;
are handled by the larger native primitve type.  The supported data types are defined &lt;br /&gt;
in CoreTypes.lst which is read in by the compiler.&lt;br /&gt;
&lt;br /&gt;
Floating point is currently implemented in the FPGA as fixed floating point.&lt;br /&gt;
The fptx data type is 32 bits with 16 fractional bits to the right of the point.&lt;br /&gt;
The dptx data type is 64 bits with 32 fractional bits to the right of the point.&lt;br /&gt;
&lt;br /&gt;
== Data Structures ==&lt;br /&gt;
&lt;br /&gt;
To define data structures that do not have class methods or constructors, the class &lt;br /&gt;
must extend the DataTypes class.  These classes map into C structs and SystemVerilog &lt;br /&gt;
packed structures.  The structure members will be in the order the variables are &lt;br /&gt;
encountered in the class.  The offset of each variable in a class, including data &lt;br /&gt;
structures, is tracked by the compiler for initialization, run-time modification &lt;br /&gt;
and readback.&lt;br /&gt;
&lt;br /&gt;
== Cores ==&lt;br /&gt;
&lt;br /&gt;
Cores are objects that can be accessed by the external world.  They are composed of &lt;br /&gt;
code that can perform operations on local variables, instantiate other Cores or &lt;br /&gt;
Components, and call Tasks or Functions.  They are accessable through a set of C &lt;br /&gt;
or Java library calls. &lt;br /&gt;
&lt;br /&gt;
 core = new Core(N,M)   : instantiates a Core with max usage parameters&lt;br /&gt;
 core.set(Name,value)   : sets a runtime parameter&lt;br /&gt;
 value = core.get(Name) : gets a runtime parameter&lt;br /&gt;
 core.open()            : prepares for processing loop with current parameters&lt;br /&gt;
 core.process(isb,osb)  : runs the processing loop for a given Input/Output Streams&lt;br /&gt;
 core.close()           : finishes processing and release resources&lt;br /&gt;
 &lt;br /&gt;
Cores currently have one data input stream, one data output stream and a control interface.&lt;br /&gt;
The public class variables are accessable from the external interface for monitoring &lt;br /&gt;
and/or real-time control.  &lt;br /&gt;
&lt;br /&gt;
Cores can instantiate other cores, components, and tasks.&lt;br /&gt;
&lt;br /&gt;
== Components ==&lt;br /&gt;
&lt;br /&gt;
Components are blocks of code that implement functions that may be used by this core &lt;br /&gt;
or others.  Their variables are not readable from the external interface but are &lt;br /&gt;
initialized by their calling core or component.&lt;br /&gt;
&lt;br /&gt;
Components can instantiate other components and tasks, but not cores.&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
&lt;br /&gt;
Functions for commonly used C math functions are available as methods in the CoreCommon &lt;br /&gt;
class that both Cores and Components extend.  This gives the JV code a more familiar C &lt;br /&gt;
style for math functions.  The functions are typically implemented as 1st order look-up &lt;br /&gt;
tables in the FPGA code.&lt;br /&gt;
&lt;br /&gt;
Unless called out in CoreFunctions.lst as a task, all functions complete in a single clock.&lt;br /&gt;
&lt;br /&gt;
== Tasks ==&lt;br /&gt;
&lt;br /&gt;
Tasks are functions that may take multiple clock cycles in the FPGA version.  Some Functions &lt;br /&gt;
are implemented as Tasks automatically.  These decisions are guided by the CoreFunctions.lst &lt;br /&gt;
configuration file which is read in by the compiler.&lt;br /&gt;
&lt;br /&gt;
== Declarations ==&lt;br /&gt;
&lt;br /&gt;
Although Java and Verilog support declarations almost anywhere in the code, to keep the C &lt;br /&gt;
translation ANSI comlpiant, all declarations must be completed before the first operational &lt;br /&gt;
line of code in each method.  &lt;br /&gt;
&lt;br /&gt;
== Defines ==&lt;br /&gt;
&lt;br /&gt;
All static declarations in the JV code are converted to defines in the C and FPGA code.&lt;br /&gt;
The class constructors in the open() method are used to build the FPGA module resources.  &lt;br /&gt;
This requires all arguments to the constructor to be static variables that create &lt;br /&gt;
resources for the worst case at runtime.&lt;br /&gt;
&lt;br /&gt;
There are a few special static variables that are reserved for special use:&lt;br /&gt;
&lt;br /&gt;
 FLOW=v   : Type of data flow must be STREAM, BUFFER, or ARRAY&lt;br /&gt;
 PIPE=n   : Pipe mode for loops: 1=On 0=Off -1=Auto (default=AUTO)&lt;br /&gt;
 BW=n	   : Bus Width in bits for FPGA data interface&lt;br /&gt;
 IBW=n	   : Input Bus Width in bits for FPGA data interface (default=BW)&lt;br /&gt;
 OBW=n	   : Output Bus Width in bits for FPGA data interface (default=BW)&lt;br /&gt;
 MC=n	   : Master Core mode: 1=Core is comprised of other cores, 0=Normal Core&lt;br /&gt;
 VERBOSE  : Turn on verbose print statements (vprint) for debugging&lt;br /&gt;
 AUTOLOCAL : Turn class varialbes into locals in the C process method to help optimizer&lt;br /&gt;
&lt;br /&gt;
== FPGA Implementation ==&lt;br /&gt;
&lt;br /&gt;
The compiler assumes a synchronous design methodology in the FPGA. The system clock is used &lt;br /&gt;
to supply all control interfaces as well as read the input stream/buffer and write the output &lt;br /&gt;
stream/buffer.  Most statements will use this clock.  A 2x clock is available for special loops.  &lt;br /&gt;
&lt;br /&gt;
The coreName.sv file contains three sections: Declarations, Sequencer, and Execution.&lt;br /&gt;
&lt;br /&gt;
The variables in the declarations section are allocated much as they are in C. &lt;br /&gt;
All other statements are then evaluated for input and output variable sensitivity.&lt;br /&gt;
&lt;br /&gt;
The sequencer section uses the sensitivity list to decide which clock on which to execute each &lt;br /&gt;
line of code.  Loops are unrolled in time by default.  When pipelined, many of these lines are &lt;br /&gt;
executing simultaneously.  Each equals sign (or other form of assignment) infers a clock edge.&lt;br /&gt;
Complex equations can be split into simpler equations of similar complexity and combined &lt;br /&gt;
on the next line to improve timing. &lt;br /&gt;
&lt;br /&gt;
The execution section implements the assignment statements in a single always block except for &lt;br /&gt;
unrolled loops that are converted to unique generate-for loops with their own 1x or 2x clock.&lt;br /&gt;
&lt;br /&gt;
== Directives ==&lt;br /&gt;
&lt;br /&gt;
The compiler can be given directives to tune its behavior.  &lt;br /&gt;
They must be entered as in-line comments and will apply to the entire line.&lt;br /&gt;
&lt;br /&gt;
 jvc.pipe	: pipeline this for or while loop - this is the default in Stream mode&lt;br /&gt;
 jvc.clocksPer=N  : number of clocks per pass through pipelined loop&lt;br /&gt;
 jvc.unroll=N	: unroll or parallelize a loop N indices at a time&lt;br /&gt;
 jvc.accum=N	: calls out variables for an accumulator unrolled by N &lt;br /&gt;
 jvc.clk2x	: use the 2x clock for this loop&lt;br /&gt;
 jvc.ROM	: implement array as Read Only Memmory, compiler handles initialization&lt;br /&gt;
 jvc.passive	: this object is passed between two components and needs special handling&lt;br /&gt;
&lt;br /&gt;
Compiler directives are case insensitive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/onlyinclude&amp;gt;&lt;br /&gt;
[[Category:ICE_Help]]&lt;/div&gt;</summary>
		<author><name>ConvertBot</name></author>
		
	</entry>
</feed>