12-09-2012, 04:19 PM
Global Variable Localization and Transformation for Hardware Synthesis from High-Level Programming Language Description
Global Variable Localization.pdf (Size: 204.11 KB / Downloads: 27)
Abstract
In this paper, we propose a method to synthesize hardware from highlevel
programming language description. The main step of the
proposed method is to localize global variables. The localization of
global variables is essential in synthesizing hardware from high-level
programming language description because global variables cannot be
synthesized directly. We first preprocess the input description in highlevel
programming language in order to convert all the complex data
type objects into simpler data type objects that can be synthesized
efficiently and then, we transform the input code into static single
assignment form. For each global variable, an appropriate function is
selected and the global variable is localized in the selected function.
The interconnection between modules is implemented so that the
values of the localized global variables are transferred to the places the
values are used at. The experimental results of the proposed method
show that the proposed method can synthesize hardware from highlevel
programming language description.
Introduction.
The high-level of integration afforded by advances in processing
technology has brought new challenges in the design of digital systems.
Higher integration has spurred a trend to integrate entire complex
systems consisting of a heterogeneous mixture of hardware and
software components on a chip, e.g., system-on-a-chip (SoC). The
trend challenges CAD tool developers to provide tools that can support
the design of such hardware-software co-design of digital systems.
Different languages have been used as inputs to hardware design. Most
commonly used are hardware description languages (HDL’s) such as
Verilog and VHDL. In the design of complex chips, however,
designers usually begin their designs with programming languages
such as C or C++ to estimate the system performance and verify the
functional correctness of the design using commonly available software
compilers. To implement some parts of the design in hardware using
synthesis tools, the designers have to manually translate those parts into
a synthesizable subset of HDL. As this process is both time-consuming
and error-prone, we propose a synthesizer that can synthesize hardware
from C description. The legacy codes widely used for many
applications can be easily integrated on a chip using this synthesis tool.
Previous Works
Different subsets of C and C-like HDL’s have been defined for
hardware synthesis, but none of them deals with global variable
localization and complex data types. The examples are HardwareC
defined by De Micheli and the subset of C language used in Cones
from AT&T Bell Laboratories.
C-Level Design proposes a solution, System CompilerTM, for
translating C into a RTL description in Verilog. They mainly
concentrate on finding concurrent statements and divide functions into
clusters, which can be executed in parallel using multiple always
blocks in Verilog [1][10], but they do not consider the localization of
global variables. Frontier design provides A|RT Builder that translates
ANSI C to synthesizable HDL[3]. The HDL code can be used directly
in a logic synthesis flow, or can be further optimized using behavioral
synthesis. However, unlike our method, they provide special data types
in the A|RT Builder library to support the bit vectors and they support
no global variables.
There are works that attempt to use C++ with class libraries that
provide HDL-like semantics for modeling hardware. Such examples
are SCENIC framework [2] from Synopsys and OCAPI from IMEC [4].
These works focus on providing class libraries for modeling
concurrency, signals, and events and do not deal with global variable
localization.
Some works make the effort to synthesize programming language
specific features such as dynamic memory allocations, function calls,
recursions, type castings, and pointers. For example, the authors of [5]
and [6] provide methods to synthesize pointers. But there is no work
dealing with the global variable localization and this is the major
contribution of this paper.
Data Type Conversion
Although high-level programming languages support complex data
types such as structures and unions, these complex data types cannot be
directly synthesized and have to be converted to simpler data types.
This section describes how to convert this kind of data types.
The data type conversion procedure is composed of the following two
steps: First, a new variable is defined for each structure member. The
type of the variable is the same as the type of the member. We call this
new variable a member variable. After defining member variables, we
analyze the source code and convert the accesses to a structure variable
into the accesses to the newly defined member variables of that structure, that is, the accesses to the members of a structure type are
replaced by the accesses to the new member variables corresponding to
the members. Likewise, an access to the whole structure will be
replaced by accesses to all the member variables. For example, an
assignment statement in which a structure variable is assigned to
another structure variable will be converted into assignment statements
between member variables.
Global Variable Localization
The global variables in programs can be classified into three groups
according to the usage. One group consists of global variables used to
contain globally used constants. For example, the coefficients of a filter
or a mask may be stored in global variables. These global variables are
initialized to some value and retain the initial value through the
program execution because they are not assigned to new values. These
variables can be localized to one or more functions and can be
implemented as ROM’s or PLA’s. The second group is used to record
the state of a function after the execution of the function. These global
variables are used in only one function and they may be declared as
static local variables in the functions where they are used. In hardware,
these variables are implemented registers in appropriate modules. The
last group is used to transfer data between functions. These global
variables are used as global storage that multiple functions can access.
Each function accesses the global storage and changes its contents and
other functions may use the modified contents.
Conclusions and Future Works
This paper presents a method to synthesize hardware from the highlevel
programming language description. In the proposed method, the
main step is to localize global variables. The experimental results of the
proposed method show that the proposed method can successfully
synthesize hardware from high-level programming language
descriptions.
There are works to be done in the future. The synthesis of
programming language-specific features is another problem to be
considered in the future. Some works have tried to solve this problem
but they all focused on only the sub-problems [5][6]. Currently,
dynamic memory allocation, recursion, type casting, and pointers
cannot be synthesized efficiently. We will find methods enabling the
synthesis of these constructs.