Changes between Initial Version and Version 1 of Soclib Cc/And Modelsim


Ignore:
Timestamp:
Mar 25, 2010, 12:15:14 PM (14 years ago)
Author:
Nicolas Pouillon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Soclib Cc/And Modelsim

    v1 v1  
     1= Cosimulation using SoCLib components and RTL models =
     2
     3You may use CABA models together with RTL models using !ModelSim. This
     4needs the following parts:
     5 * a set of SystemC models
     6 * a set of Verilog/VHDL models
     7 * glue wrappers where needed, exporting a RTL model to SystemC or SystemC to RTL (not covered in this guide)
     8 * a SystemC clock driver (we had some issues with vhdl clock driver), i.e. a module bagotting clock signal
     9
     10SystemC modules are SoCLib ones and are usually compiled with
     11SoCLib-cc. They come with pure-c++ dependancies which must be linked
     12together with the modules.
     13
     14Due to its simulator core design, !ModelSim has to compile SystemC
     15modules a special way, and has a dedicated tool to compile SystemC/C++
     16files: `sccom`.
     17
     18Soclib-cc has three main jobs:
     19 * Select modules and dependancies from a platform description file,
     20 * Explicitly instantiate C++ templates,
     21 * Call the C++ compiler. Only this step is implemented in `sccom`.
     22
     23The flow is as in the picture:
     24
     25[[Image(flow.png,nolink)]]
     26
     27soclib-cc handles most of this automagically if correctly
     28configured. This guide explains how to set things up.
     29
     30Moreover, the C/C++ only dependancies are not
     31directly compileable with the dedicated !ModelSim tool, but can be
     32''injected'' at the last time, for the linkage phase (`sccom -link`).
     33
     34= How to configure SoCLib-cc to call !ModelSim compiler driver =
     35
     36Sometimes, the C++-only dependencies of SystemC modules need to Know
     37about SystemC types. Therefore, SystemC includes must be
     38available.
     39
     40soclib-cc needs new configuration sections for
     41 * the compiler used by sccom
     42 * the path to !ModelSim's SystemC implementation
     43 * used flags
     44 * object file names pattern in sccom work directory
     45
     46For all these, we must create 3 new configurations in soclib-cc's
     47configuration file:
     48* a compiler
     49* a SystemC library
     50* a build environment
     51
     52{{{
     53# Definition of the compiler used for ModelSim-usable SoCLib components.
     54# We use sccom for components compilation and linkage, gcc/g++ for utilities
     55config.toolchain_sccom = Config(
     56        base = config.toolchain,
     57        # Must use this.
     58        tool_map = {
     59          'SCCOM_CC':'sccom',
     60          'SCCOM_CXX':'sccom',
     61          'CC':'gcc',
     62          'CXX':'g++',
     63          'CC_LINKER':'sccom',
     64          'CXX_LINKER':'sccom',
     65        },
     66        # Modelsim cant do parallel builds :'(
     67        max_processes = 1,
     68        # No cflags are needed, sccom forces them
     69        cflags = [],
     70        # Special features, it has a -link invocation needed at end...
     71        libs = ['-link'],
     72)
     73       
     74# Definition of the ModelSim SystemC implementation. Must modify the
     75# path according to the ModelSim current installation.
     76config.systemc_sccom = Config(
     77        base = config.systemc,
     78        # This special vendor attributes enables some quirks in soclib-cc
     79        vendor = 'sccom',
     80        # This is the path of the produced .o files when compiled with sccom.
     81        # You have to try it by hand, and adapt
     82        sc_workpath = "work/_sc/linux_gcc-4.1.2",
     83        # Mandatory quirks
     84        dir = "",
     85        os = "",
     86        libs = [],
     87        # cflags have to be deducted from actual invocation
     88        # Try using sccom -v by hand
     89        cflags = ['-I/users/soft/mentor/modelsim-6.5c/modeltech/include/systemc',
     90                  '-I/users/soft/mentor/modelsim-6.5c/modeltech/include'],
     91        )
     92
     93# Definition of a new build environment, which can be referenced with 'soclib-cc -t'
     94config.sccom = Config(
     95        base = config.build_env,
     96        toolchain = config.toolchain_sccom,
     97        systemc = config.systemc_sccom,
     98        # Where temporary files lies, beware that if you set a global path,
     99        # you'll need a mechanism to make user-unique directories.
     100        repos = "/tmp/",
     101        )
     102}}}
     103
     104= SystemC modules in !ModelSim limitations =
     105
     106All modules that may be used from the outside of the SystemC-part
     107(from RTL or from GUI) have to be declared with a special macro
     108(`SC_MODULE_EXPORT`).
     109
     110There is no `sc_main()` function in modelsim-based simulators. The top
     111module must be a `sc_module` with no interfaces. This probably needs a
     112rewrite of your netlists.
     113
     114If you use DSX-generated netlists, this is done transparently.
     115
     116= Usage =
     117
     118Now we configured soclib-cc, we can compile a complete SystemC system.
     119
     120Example to come