Skip to content

Getting started

Mikhail Moiseev edited this page Oct 23, 2020 · 51 revisions

This pages explains building and installation of ICSC on Linux OS. In the following description Ubuntu 20.4 is used, all operations are given for bash terminal.

Preparing environment

It needs to have:

  • C++ compiler supports C++17, default Ubuntu C++ compiler is g++ 9.3.0 that works fine
  • CMake version 3.12 or later, default Ubuntu CMake version is 3.16
  • git to clone ISCS repository

Clone ISCS source repository to $ICSC_HOME folder:

$ git clone https://github.com/intel/systemc-compiler my_iscs_folder
$ export ICSC_HOME=my_iscs_folder

Preparing dependencies

It needs to have:

Download Protobuf, LLVM and Clang into $ICSC_HOME folder.

Building and installing Protobuf

$ cd $ICSC_HOME/protobuf-3.13.0
$ mkdir build && cd build
$ cmake ../cmake/ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$ICSC_HOME -DBUILD_SHARED_LIBS=ON
$ make -j8
$ make install

Building and installing LLVM/Clang

It needs to put Clang source cfe-7.0.0.src into llvm-7.0.0.src/tools done by first command below.

$ mv $ICSC_HOME/cfe-7.0.0.src $ICSC_HOME/llvm-7.0.0.src/tools/clang
$ cd $ICSC_HOME/llvm-7.0.0.src
$ mkdir build && cd build
$ cmake ../ -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$ICSC_HOME
$ make -j8
$ make install

Building and installing ICSC

$ cd $ICSC_HOME/icsc
$ mkdir build && cd build
$ cmake ../ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$ICSC_HOME
$ make -j8
$ make install

Folders and files

After installation there is the following folder structure:

 $ICSC_HOME
   * bin                 -- binary utilities, can be removed
   * build               -- build folder, can be removed
   * examples            -- a few illustrative examples 
   * icsc                -- ICSC sources
        * cmake          -- CMake files
        * components     -- assertions, fifo and other library components
        * doc            -- user guide latex and pdf files
        * sc_elab        -- elaborator sources 
        * sc_tool        -- ISCS sources  
        * systemc        -- patched SystemC 2.3.3 sources
        * .gitmodules    -- not intended to be used here, can be removed
        * CMakeLists.txt -- cmake file for ICSC tool
        * LICENSE.txt    -- Apache 2.0 WITH LLVM exceptions license
        * README.md      -- Tool description
   * include             -- LLVM/Clang, SystemC and other headers
   * lib                 -- tool compiled libraries
   * libexec             -- can be removed
   * lib64               -- tool compiled libraries
   * share               -- can be removed  
   * tests               -- unit tests 
   * designs             -- folder for user designs with an design template
   * CMakeLists.txt      -- cmake file for examples, tests and user designs
   * README              -- build and run examples, tests and used designs description
   * setenv.sh           -- set environment script for bash terminal  

Run examples and tests

There are number of examples in examples sub-folder:

  • asserts -- immediate and temporal SystemC assertions with SVA generation
  • counter -- simple counter with SC_METHOD and SC_CTHREAD processes
  • decoder -- configurable FIFO example
  • fsm -- finite state machine coding
  • intrinsic -- Verilog code intrinsic example
  • int_error -- error reporting example, dangling pointer de-reference inside
  • latch_ff -- simple latch and flip flop with asynchronous reset

There are number of unit tests in tests sub-folder:

To build and run them to generate SystemVerilog it needs:

$ cd $ICSC_HOME
$ mkdir build && cd build
$ cmake ../                          # prepare Makefiles 
$ ctest -j8                          # compile and run Verilog generation
                                     # use "-jN" key to run in "N" processes
$ cd examples/counter                # go to counter example folder 
$ cat sv_out/counter.sv              # print generated Verilog file 

Run SystemC simulation of an example in bash terminal:

$ cd $ICSC_HOME
$ mkdir build && cd build
$ cmake ../                          # prepare Makefiles 
$ make counter                       # compile SystemC simulation for counter example
$ cd examples/counter                # go to counter example folder
$ ./counter                          # run SystemC simulation 
Clone this wiki locally