开发者

Is it possible to use System C data types in C++ without the entire System C kernel?

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?


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.


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!)


I had this same need: I wanted the flexible length integers and bit-vectors in C++. I did not want the rest of SystemC, particularly the runtime.

I investigated GMP and similar and found them overly large and complex for my needs.

I found a very similar set of datatypes that may provide exactly what you want are available as AC Datatypes at https://hlslibs.org They are available under Apache 2.0 license. The integer datatypes are very similar to SystemC integer/bit-vector datatypes.

However, they are very lightweight: just include the appropriate header file. No runtime component like SystemC.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜