tags:

views:

78

answers:

2

System C provides arbitrary length integer types that can be manipulated either as numbers (i.e. with support for artihmetic) or as bit-vectors (i.e. with support for logic operations and working with sub-vectors).

System C also provides support for all sorts of other things I don't want, such as clocks, flip flops and such, as well as its own runtime. I'm picky - I want the datatypes without the overhead.

Can these data types be used independently of the rest of the system C kernel? If so, how?

+4  A: 

At least TTBOMK, no. There are quite a few libraries that support arbitrary-length integers in C++ without the hardware-design "stuff" in SystemC though (e.g., NTL, GMP, MIRACL). Some of them do add more than just plain arbitrary-precision arithmetic (e.g., various functions used heavily on number theory).

OTOH, given the typical implementations, at least if you use them as static libraries, only what you actually use will be linked into your executable.

Jerry Coffin
+1  A: 

I'm not familiar with SystemC, but I do always like to point out that in open source projects, you can get the answer from the horse's mouth.

Browsing the CPP files which implement the integer type, it seems to depend on things in datatypes/, utils/, and kernel/:

http://github.com/systemc/systemc-2.2.0/tree/master/src/sysc/datatypes/int/

If the static linking that Jerry suggests doesn't pare it down enough to what seems reasonable (due to some kind of unnecessary global or subsystem inits), you could fork it off GitHub for your minimalist version if it's important to do so...but there's always a cost to maintaining your own branch.

(Or you could contribute a meta-system for paring down bits of system-C people don't need which might get incorporated into the main distribution!)

Hostile Fork