Browse Source

Changes to get converter working and to provide verilator as

infrastructure
pull/3/head
Eyck Jentzsch 1 year ago
parent
commit
6fa22dca91
4 changed files with 43 additions and 13 deletions
  1. 24
    0
      incl/scc/signal_initiator_mixin.h
  2. 5
    6
      incl/scc/time2tick.h
  3. 12
    4
      incl/tlm/tlm_signal_conv.h
  4. 2
    3
      src/verilator_callbacks.cpp

+ 24
- 0
incl/scc/signal_initiator_mixin.h View File

@@ -48,6 +48,30 @@ public:

using BASE_TYPE::bind;

void write_now(tlm_signal_type value){
auto* gp = tlm::tlm_signal_gp<tlm_signal_type>::create();
gp->set_command(tlm::TLM_WRITE_COMMAND);
gp->set_value(value);
gp->acquire();
tlm::tlm_phase phase{tlm::BEGIN_REQ};
auto delay{sc_core::SC_ZERO_TIME};
(*this)->nb_transport_fw(*gp, phase, delay);
gp->release();
}

template<typename EXT_TYPE>
void write_now(tlm_signal_type value, EXT_TYPE* ext){
auto* gp = tlm::tlm_signal_gp<tlm_signal_type>::create();
gp->set_command(tlm::TLM_WRITE_COMMAND);
gp->set_value(value);
if(ext) gp->set_extension(ext);
gp->acquire();
tlm::tlm_phase phase{tlm::BEGIN_REQ};
auto delay{sc_core::SC_ZERO_TIME};
(*this)->nb_transport_fw(*gp, phase, delay);
gp->release();
}

/**
*
* @param cb the callback function

+ 5
- 6
incl/scc/time2tick.h View File

@@ -10,7 +10,8 @@

#include "utilities.h"

class time2tick: public sc_core::sc_module {
namespace scc {
struct time2tick: public sc_core::sc_module {
SC_HAS_PROCESS(time2tick);
sc_core::sc_in<sc_core::sc_time> clk_i;
sc_core::sc_out<bool> clk_o;
@@ -28,13 +29,11 @@ private:
t=clk_i.read();
}
clk_o=true;
wait(t);
wait(t/2);
clk_o=false;
wait(t);
wait(t-t/2);
}
}
};



}
#endif /* _SCC_TIME2TICK_H_ */

+ 12
- 4
incl/tlm/tlm_signal_conv.h View File

@@ -16,7 +16,7 @@
namespace tlm {

template<typename TYPE>
class tlm_signal2sc_signal:
struct tlm_signal2sc_signal:
public sc_core::sc_module,
public tlm_signal_fw_transport_if<TYPE, tlm_signal_baseprotocol_types<TYPE>> {

@@ -30,7 +30,11 @@ class tlm_signal2sc_signal:

sc_core::sc_out<TYPE> s_o;

tlm_signal2sc_signal(sc_core::sc_module_name nm) : sc_core::sc_module(nm) {
tlm_signal2sc_signal(sc_core::sc_module_name nm)
: sc_core::sc_module(nm)
, NAMED(t_i)
, NAMED(s_o)
{
t_i.bind(*this);
SC_METHOD(que_cb);
sensitive<<que.event();
@@ -50,7 +54,7 @@ private:
};

template<typename TYPE>
class sc_signal2tlm_signal:
struct sc_signal2tlm_signal:
public sc_core::sc_module,
public tlm_signal_bw_transport_if<TYPE, tlm_signal_baseprotocol_types<TYPE>> {

@@ -64,7 +68,11 @@ class sc_signal2tlm_signal:

tlm_signal_initiator_socket<TYPE> t_o;

sc_signal2tlm_signal(sc_core::sc_module_name nm) : sc_core::sc_module(nm) {
sc_signal2tlm_signal(sc_core::sc_module_name nm)
: sc_core::sc_module(nm)
, NAMED(s_i)
, NAMED(t_o)
{
t_o.bind(*this);
SC_METHOD(sig_cb);
sensitive<<s_i;

+ 2
- 3
src/verilator_callbacks.cpp View File

@@ -11,11 +11,10 @@
void vl_stop (const char* filename, int linenum, const char* hier) {
Verilated::gotFinish(true);
Verilated::flushCall();
sc_stop();
}
if (!sc_core::sc_end_of_simulation_invoked()) sc_core::sc_stop();}

void vl_finish (const char* filename, int linenum, const char* hier) {
Verilated::gotFinish(true);
Verilated::flushCall();
sc_stop();
if (!sc_core::sc_end_of_simulation_invoked()) sc_core::sc_stop();
}

Loading…
Cancel
Save