Build OpenAccess from Source Code

From oacwiki
Jump to: navigation, search

While it is easiest to just download a pre-built OpenAccess major release, you must compile OpenAccess yourself if you want to:

  • Use a different compute platform
  • Compile an OpenAccess incremental source release that has no pre-built binaries
  • Modify OpenAccess

Installing OpenAccess in the OpenAccess documentation also explains how to build OpenAccess from source code.

This page presents the compilation of OpenAccess 22.04 (p017). SuSE 10.3 with the gcc 4.2.1 (64bit) compiler is used as an example. In contrast, the officially supported platform for OpenAccess 22.04 (p028) is Redhat Enterprise Linux 3.0 with gcc 4.1.1.


System Prerequisites


The libelf-devel package is required for DM4 builds. In SuSE 10.3 this can be installed by Yast. Choose Software/Software Management and search for libelf-devel select and install the package. Note, installing this package may require installation of additional packages, however, Yast will recognize this and add any necessary additional packages.


The LEF and DEF version 5.7 toolkits are required for OpenAccess DM4, if the four translators, lef2oa, def2oa, oa2lef and oa2def, are to be built. These toolkits can be found in the Si2 lefdef project. The LEF/DEF package consist of two tarballs, one for LEF and one for DEF. These tarballs can be found here, the lefdef5.7-s001 package is used for this guide. Each tarball extracts to its own directory, ./lef and ./def. Compile each as necessary. In order to follow the seperation of lef from def, this guide assumes that the compiles are seperate and reside in the <lef-def-root>/lef and <lef-def-root>/def directories.


Version 2.5.4 of flex is required for the build. The normal SuSE installation ships with version 2.5.33, which is not compatable with the skeleton files used by the veriog and spef translators.. The proper version of flex can be found at . The 2.5.4 version of flex should be installed in /usr/local/bin, where as the 2.5.33 version is normally installed in /usr/bin.

Configuring Variables


Modify <oa-root>/build/make/linux_rhel30_gcc411_64.variables (or similar) such that CC and CXX can be properly located.

CC              = /usr/bin/gcc
CXX             = /usr/bin/g++


Modify <oa-root>/build/make/dep.variables such that LEF_HOME, DEF_HOME, ZLIB_HOME, BISON_HOME, FLEX_HOME and TCL_HOME and match your system setup, for SuSE 10.3 the following should work.

#Make sure we dont use LEFDEF_HOME by mistake

ifndef LEF_HOME
  LEF_HOME := /opt/lefdef/lef

ifndef DEF_HOME
  DEF_HOME := /opt/lefdef/def

ifndef ZLIB_HOME
   ZLIB_HOME := /usr

  BISON_HOME := /usr

ifndef FLEX_HOME
  FLEX_HOME := /usr/local

ifndef TCL_HOME
  TCL_HOME := /usr

For oaLefDef to find the proper library files modify the following two files as needed for your system.



# /usr/lib64
ifeq ($(SYSNAME_OPTIONS), _64)
  PROG_STATIC_LIBS := $(ZLIB_HOME)/lib64/libz.a 
  PROG_STATIC_LIBS := $(ZLIB_HOME)/lib/libz.a 


<oa-root>/oaLefDef/build.variables (comment the following lines as shown)

# Comment the following if using 64 bit OS, 
#ifeq ($(SYSNAME_OPTIONS), _64)
#  ifeq ($(strip $(LEFDEF_HOME)), "")
#    LEFDEF_LIB_DIR := $(LEF_HOME)/lib/64bit $(DEF_HOME)/lib/64bit
#  else
#    LEFDEF_LIB_DIR := $(LEFDEF_HOME)/lib/64bit
#  endif

# Comment the following if creating debug libraries.
# The 5.7-s001 LEF/DEF toolkit does not seem to create
#   seperate names for debug and non-debug versions.
#   This suffix is also used for the libz library as well,
#   therefore it may be best to not use the suffix in 
#   any case

#ifeq ($(OPTCHAR), D)
#  DBGLIB  = _g


The oaSpef build ruloes needs to point to the proper libz library if compiling in 64 bit mode. Modify <oa-root>/oaSpef/build.rules as shown below.

   @if [ ! -f $(ZLIB_HOME)/lib64/libz.a ]; \

Source Files

<oa-root>/oaSpef/src/oaSpefParser.skl and <oa-root>/oaVerilog/src/oaVerilogParser.skl

bison requires that the c.m4 source file be included. This can be accomplished by adding the following line to the beginning of the following files, <oa-root>/oaSpef/src/oaSpefParser.skl and <oa-root>/oaVerilog/src/oaVerilogParser.skl.

# For oaSpef
# <oa-root>/oaSpef/src/oaSpefParser.skl

# For oaVerilog
#< oa-root>/oaVerilog/src/oaVerilogParser.skl


The main OpenAccess makefile is located in <OA root>/oa.

Makefile targets are listed below.

  • oa builds just the core oa packages
  • lefdef builds the oaLefDef translator
  • spef builds the oaSpef translator
  • strm builds the oaStrm translator
  • verilog builds the oaVerilog translator
  • milkyway builds the oaMilkyway translator
  • 20to22 builds the oa20to22 translator
  • lang builds the oaTcl TCL bindings
  • all builds all of the above

Optimization is controlled by the compile variable OPTMODE, and can take on the values of opt or dbg.

For example, to build the OpenAccess core in optimized mode, you would issue the following commands:

% cd <oa-root>/oa
% make oa OPTMODE=opt

To make the entire install with debugging information issue the following command.

% cd <oa-root>/oa
% make OPTMODE=dbg

Depending on your needs you may not wish to build certain parts of the entire OpenAccess package. You can modify <oa-root>/oa/GNUMakefile to remove certain packages. For example by modifing the all target as shown below, you can skip the compilation of the oa20to22 and oaMilkyway translators.

# Original target
# all: oa lefdef strm spef verilog milkyway 20to22 lang

# Modified target
all: oa lefdef strm spef verilog lang

When building targets, the target is first cleaned then compiled. This behavior is sometimes unnecessary and unwanted. Modify each target in <oa-root>/oa/GNUMakefile as shown below. The clean target can still be called seperately. Alternatively, you can change the default target to default: install.

# Original target
oa: clean_oa install_oa

# Modified target
oa: install_oa


Build times for your reference:

opt1.5 hours
dbg1.0 hours
Personal tools