C target
m-kru opened this issue · 0 comments
Background
The C target is not straightforward. C is very often used when a user wants to squeeze maximum performance, so any performance drop compromises are rather not acceptable. The address space might or might not be memory mapped. What is more, the user might expect interface functions calls to by synchronous or asynchronous. Satisfying all possible C target requirements is simply not possible. This implies, that C language will require multiple targets.
Regardless of the target, the interface implementation is always left to the user.
Potential C targets:
- c-sync
- c-async
- c-mmap - does async mmap interface make any sense?
c-sync
c-sync target is the simplest one to implement, so it is a good starting point. In c-sync all write / read functions block (hence sync) until they return success or failure.
Must-have:
- Support for static (compilation time) interface binding.
- Support for dynamic (run time) interface binding.
- Accessing the functionalities via multiple interfaces must be orthogonal. The solution where multiple modules accessing the bus must know about each other (directly or indirectly via some arbiter) is unacceptable. Arbitration takes place in gateware/hardware.
Nice to have:
- No need to provide pointer to write / read function or interface as argument to function accessing functionalities.
- No machine code duplication. The c-sync is often used in embedded systems with constrained memory for program. It is quite easy to fulfill all requirements by including static function in different modules. However such approach will increase memory consumption, as the same functions will be defined multiple times.
c-async
c-async will be harder to implement than c-sync. The whole callback logic needs to be deeply thought out. The precise requirements are not known yet.
c-mmap
Can c-mmap be async, or is it always sync?