X hits on this document

45 views

0 shares

0 downloads

0 comments

14 / 14

Sequence Detector: “101”

// File: sdet.h #include “systemc.h”

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

SC_MODULE(sdet) {

sc_in<bool> clk, data; sc_out<bool> sfound;

void sdet::prc_sdet(){ first = data; second = first; third = second

sc signal<bool> first, second,

_

}

third; // synchronous logic process void prc_sdet(); // comb logic process void prc_out();

void sdet::prc_out(){ sfound = first & (!second) & third;

}

SC_CTOR(sdet) { S C _ M E T H O D ( p r c _ s d e t ) ;

sensitive_pos << clk; SC_METHOD(prc_out); sensitive << first << second

<< third;

}

};

  • A. Milenkovic

Counter: Up-down, Async Negative Clear

// File: cnt4.h #include “systemc.h”

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

const int CSIZE = 4; SC_MODULE(sdet) {

sc_in<bool> mclk, cl, updown; sc_out<sc_uint<CSIZE> > dout;

void prc_cnt4();

SC_CTOR(cnt4) { S C _ M E T H O D ( p r c _ c n t 4 ) sensitive_pos << mclk; sensitive_neg << cl; ;

void sdet::prc_cnt4(){ if(!clear) data_out = 0; else if(updown) dout=dout.read()+1; else dout=dout.read()-1;

}

}

};

  • A. Milenkovic

40

41

Document info
Document views45
Page views45
Page last viewedSat Dec 03 22:59:17 UTC 2016
Pages14
Paragraphs678
Words2716

Comments