title: SystemC Port Conversion
body: <p>I am trying to convert one type of SystemC port into another:</p>
  
  <p>from:</p>
  
  <pre><code>sc_port&lt;sc_fifo_out_if&lt;Type&gt; &gt; 
  </code></pre>
  
  <p>to:</p>
  
  <pre><code>sc_export&lt;tlm::tlm_analysis_if&lt;Type&gt; &gt; 
  </code></pre>
  
  <p>I used this class with a thread to convert between the types. </p>
  
  <pre><code>class port_converter : public sc_core::sc_module{
  public:
      sc_port&lt;sc_fifo_in_if&lt;Type&gt; &gt; in_converter;
      sc_port&lt;tlm::tlm_analysis_if&lt;Type&gt; &gt; out_converter;
  
      // c'tor
      SC_HAS_PROCESS(port_converter);
      port_converter(sc_module_name nm) :
          sc_module(nm), in_converter("in"), out_converter("out") {
          SC_THREAD(main_action);
      }
  
      // main action 
      void main_action() {
          while (1){
              out_converter-&gt;write(in_converter-&gt;read());
          }
      }
  };
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/fDPpG.png" rel="nofollow noreferrer">The solution diagram</a></p>
  
  <p>Is there a simpler way to convert between these types of ports?</p>