X hits on this document

59 views

0 shares

0 downloads

0 comments

12 / 14

Loops

  • C++ loops: for, do-while, while

  • SystemC RTL supports only for loops

  • For loop iteration must be a compile time constant

  • A. Milenkovic

Loops: An Example

// File: demux.h #include “systemc.h” const int IW=2; const int OW=4;

SC_MODULE(demux) { sc_in<sc_uint<IW> > a; sc_out<sc_uint<OW> > z;

// File: demux.cpp #include “demux.h”

void priority::prc_demux(){ sc_uint<3> j; sc_uint<OW> temp;

for(j=0; j<OW; j++) if(a==j) temp[j] = 1;

void prc_demux();

else temp[j] = 0;

}

SC_CTOR(demux) { SC_METHOD(prc_demux); sensitive << a;

}

};

  • A. Milenkovic

Methods

  • Methods other than SC_METHOD processes can be used in a SystemC RTL

  • A. Milenkovic

34

35

36

Document info
Document views59
Page views59
Page last viewedMon Jan 16 15:39:56 UTC 2017
Pages14
Paragraphs678
Words2716

Comments