JulianKemmerer / PipelineC

A C-like hardware description language (HDL) adding high level synthesis(HLS)-like automatic pipelining as a language construct/compiler feature.
https://github.com/JulianKemmerer/PipelineC/wiki
GNU General Public License v3.0
569 stars 46 forks source link

Convert sync integer ratio clock crossing c code gen to define struct instead of using fixed size array types #171

Open JulianKemmerer opened 1 year ago

JulianKemmerer commented 1 year ago

...so that the new clock_crossing.h header macros can be used.

Current code gen looks like:

#define fast_to_slow_RATIO 4
#include "uint64_s_array_N_t.h"
#define fast_to_slow_write_t uint64_s_array_1_t
#define fast_to_slow_read_t uint64_s_array_4_t

// Clock cross write
void fast_to_slow_WRITE(uint64_s_array_1_t in_data)
{
  // TODO
}

// Clock cross read
uint64_s_array_4_t fast_to_slow_READ()
{
  // TODO
}

Already do #define fast_to_slow_read_t uint64_s_array_4_t making it look like a type.

Get rid of #include "uint64_s_array_N_t.h" by actually generating fast_to_slow_read_t struct which has field that is an fixed size array.

Macro for sync crossing will need user to specify clock ratio (instead of being detected in auto generated header gen process) but macros are easier to work with than #include's...