intel / systemc-compiler

This tool translates synthesizable SystemC code to synthesizable SystemVerilog.
Other
244 stars 35 forks source link

Can tlm interfaces be used? #36

Closed orichal closed 1 year ago

orichal commented 2 years ago

Hierarchy:

TOP --> TB --> DUT

DUT module:

sc_port< tlm_nonblocking_get_peek_if< bool > > status; ... if (status->nb_can_get()) { bool status_in; status->nb_get(status_in); }

TB module:

sc_port< tlm_nonblocking_put_if< bool > > status; ... if (status->nb_can_put()) { bool status_out = true; status->nb_put(status_out); }

TOP module:

DUT dut; TB tb; tlm_fifo chan_status; ... tb.bind(chan_status); dut.bind(chan_status);

Errors:

The above code will end up with errors:

Intel Compiler for SystemC (ICSC) version 1.4.31, Jun 17,2022

Top-level module is Control error: Port bound to incorrect signal: TOP.dut.status fatal error: ScTool internal fatal error : No global static constant integer result

SystemC-to-Verilog translation, ERROR

2 errors generated.

mikhailmoiseev commented 2 years ago

TLM 1.0 interfaces are not supported.

There is a communication library with blocking/non-blocking interfaces similar to TLM 1.0 which are synthesizable. The library also has external ports with TLM 2.0 interfaces. It will be available near months.

orichal commented 2 years ago

TLM 1.0 interfaces are not supported.

There is a communication library with blocking/non-blocking interfaces similar to TLM 1.0 which are synthesizable. The library also has external ports with TLM 2.0 interfaces. It will be available near months.

Thank you for a quick answer. Is the TLM-1.0 equivalent part of the communication library available ?

mikhailmoiseev commented 2 years ago

The communication library modules have sct_put_if/sct_get_if interfaces given below. The reason why TLM 1.0 was not taken is it includes too many functions and some of them cannot be synthesized.

Interface Functions Comment
sct_put_if bool ready() Return true if it is ready to put request
void reset_put() Reset this initiator/FIFO
void clear_put() Clear (remove) request put in this cycle
bool put(const T& data) Put request into initiator/FIFO if it is ready, return ready to request
bool put(const T& data, sc_uint<N> mask) | Put request into initiator/FIFO if it is ready, mask used to enable/disable put or choose targets in multi-cast put, return ready to request
void b_put(const T& data) May-block put request, could be used in THREAD process only
bool has_put() Put request done at last DC, combinational in RTL mode
void addTo(sc_sensitive& s) Add put related signal to process sensitivity
void addHasPutTo(sc_sensitive& s) | Add signals to sensitivity for process which calls has_put()
sct_get_if bool request() Return true if it has request to get
void reset_get() Reset this target/FIFO
void clear_get() Clear (return back) request got in this cycle
T peek() Peek request, return current request data, if no request last data returned
T get() Get request and remove it from FIFO/target, return current request data, if no request last data returned
bool get(T& data, bool enable) | Get request and remove it from FIFO/target if enable is true, return true if there is a request
T b_get() May-block get request, could be used in THREAD process only
bool has_get() Get request done at last DC, combinational in RTL mode
void addTo(sc_sensitive& s) Add get related signal to process sensitivity
void addPeekTo(sc_sensitive& s) Add peek related signal to process sensitivity
void addHasGetTo(sc_sensitive& s) | Add signals to sensitivity for process which calls has_get()
orichal commented 2 years ago

Thank you, seems as it covers the most important part of TLM 1.0 nb/b get/put/peek . Looking forward!

mikhailmoiseev commented 1 year ago

In version 1.5.1 sct_fifo updated with the interfaces given above. This implementation is free of limitations. See more details at https://github.com/intel/systemc-compiler/wiki/Common-SystemC-Library

mikhailmoiseev commented 1 year ago

Please find the SingleSource library with TLM interfaces implementation at https://github.com/intel/systemc-compiler/tree/main/components/common. There is description of the library channels in update UserGuide: https://github.com/intel/systemc-compiler/blob/main/doc/ug.pdf

orichal commented 1 year ago

Thanks!

orichal commented 12 months ago

Hi Mikhail,

Thank you very much.

Ori

On Sat, Sep 30, 2023, 23:31 Mikhail Moiseev @.***> wrote:

Closed #36 https://github.com/intel/systemc-compiler/issues/36 as completed.

— Reply to this email directly, view it on GitHub https://github.com/intel/systemc-compiler/issues/36#event-10517962961, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6UWIER2AUGLGQQL4N3YILX5B6SPANCNFSM54DOOMLQ . You are receiving this because you authored the thread.Message ID: @.***>