File: README_COMPILE_TIME

package info (click to toggle)
systemc 3.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 41,768 kB
  • sloc: cpp: 181,958; sh: 4,925; asm: 2,700; perl: 1,980; ansic: 1,931; makefile: 1,761; fortran: 492; python: 482; awk: 157; csh: 50
file content (23 lines) | stat: -rw-r--r-- 1,062 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Large portion of SystemC designs are implemented as header-only libraries.
This is especially true for parameterizable synthesizable modules, which
are often implemented as templates. Support for in-class initialization
may even further motivate SystemC users to implement modules as header-only
classes.

Unfortunately, implementing everything in headers removes benefit of separate
compilation: fast incremental builds. While compile time is not always an issue,
it can become a real problem when working with large systems.

Here are two advices:

1) Use a precompiled header (PCH) for <systemc.h>. It includes large portion of C++
standard library, so it is a very good candidate for PCH for every SystemC project.
(With C++14 it is already ~80000 lines of code after preprocessing)

2) Use a PImpl idiom to break dependencies on large header-only libraries.
In SystemC interface of a module is usually defined by ports and exports, everything
else can be hidden.

Example of PImpl for template specialization:
   adder_int_5_pimpl.cpp
   adder_int_5_pimpl.h