Skip to content

socrocket/greenlib

Repository files navigation

GreenLib

Overview

Productivity library for SystemC modelling

  • GreenReg : Easy accessible register modeling
  • GreenSocket : More advanced and customized socket
  • GreenSignalSocket : Model all the ports corresponding to different signals in an IP
  • GreenConfig : Flexible configuration and inspection
  • GreenControl : Router that connects user modules with service providers (plugins)
  • GreenMessage : A framework to pass messages from one SystemC module to another
  • GreenSerialSocket : TLM2 based Asynchronous Serial communication protocol which can be used to model industry standard serial interfaces like UART Model
  • GreenScript : SystemC module using python
  • GreenRouter : Connect the IPs using the GreenSocket infrastructure
  • GreenMemory : Implementation of a sparse memory array to simplify the implementation of more complex memories

Code status

build status

Requirements

GreenLib requires :

  • GIT > 1.8.2
  • SystemC 2.3.x
  • CMake > 2.8
  • Boost > 1.34
  • Python
  • Glib2
  • Pixman
  • Lua > 5.1
  • SWIG

OS support :

  • Linux (Debian/Ubuntu, CentOS)
  • Windows1 with MinGW
  • OS X : soon

Install requirements

Linux

Ubuntu / Debian :

$ sudo apt-get install cmake libboost-dev python-dev liblua5.2-dev swig

CentOS / Fedora :

$ sudo yum install cmake boost-devel python-devel lua-devel swig

Windows

Please try to install packages in paths without spaces.

With MinGW Installer, install these following packages :

MinGW

  • gcc
  • gcc-g++

Build

$ cmake [options]

This will result in generating the Makefile to build GreenLib.

Available options are:

  • CMAKE_INSTALL_PREFIX2 : Specify install directory used by install.
  • SYSTEMC_PREFIX : Specify SystemC prefix (Otherwise, CMake will scan SYSTEMC_HOME environment variable)
  • LUA_LIBRARIES : Specify LUA libraries directory (where is located lua.a, lua.dll, ...).
  • LUA_INCLUDE_DIR : Specify LUA header directory (where is located lua.h).
  • BOOST_ROOT : Specify Boost directory.
  • SWIG_DIR : Specify SWIG directory (where is located swig binary).
  • SWIG_EXECUTABLE : Specify SWIG binary path.
  • -G : Specify build tools. Currently, we only support "Unix Makefiles".

Example

Linux

$ cmake -DCMAKE_INSTALL_PREFIX=build -DSYSTEMC_PREFIX=/usr/local/lib/systemc-2.3.0/

(The default value of CMAKE_INSTALL_PREFIX is /usr/local).

Windows

cmake -DCMAKE_INSTALL_PREFIX=build
-DSYSTEMC_PREFIX=/c/Projects/systemc-2.3.1 \
-DLUA_LIBRARIES=/c/Projects/lua-5.2.4/src/liblua.a
-DLUA_INCLUDE_DIR=/c/Projects/lua-5.2.4/src/ \
-DBOOST_ROOT=/c/Projects/boost-1-57-0/ \
-DSWIG_DIR=/c/Projects/swigwin-3.0.5
-DSWIG_EXECUTABLE=/c/Projects/swigwin-3.0.5/swig.exe \
-G"Unix Makefiles"

Then compile:

make -j[Specifies the number of jobs (commands) to run simultaneously]

This action will result in the compilation of GreenLib.

Check

make check

or with parallel jobs:

make check -j[Specifies the number of jobs (commands) to run simultaneously]

This action will compile examples and check output with expected output.

If everything is OK, you should get "100% tests passed" message.

Installation

make install

This action will result in a package of GreenLib where you have defined CMAKE_INSTALL_PREFIX.

Usage

  • Copy the misc/FindGreenLib.cmake file in your project repository.
  • Add the following lines into your CMakeLists.txt:
find_package(GreenLib)
if(GreenLib_FOUND)
	include_directories(${GREENLIB_INCLUDE_DIRS})
   link_directories(${GREENLIB_LIBRARY_DIRS})
else()
	message(FATAL_ERROR "GreenLib not found.")
endif()

Contributing

GreenLib is an open source, community-driven project. If you'd like to contribute, please feel free to fork project and open a merge request or to send us a patch.

GreenLib-logo

Footnotes

  1. Currently, we don't support GreenScript on Windows.

  2. Default value is /usr/local