12.07.2015 Views

Solution Quiz automne 2009 - Moodle - École Polytechnique de ...

Solution Quiz automne 2009 - Moodle - École Polytechnique de ...

Solution Quiz automne 2009 - Moodle - École Polytechnique de ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

INF8500 - Intra - Automne <strong>2009</strong>};};req.write(false);return(data.read());class adaptT: public sc_module, public table_vers_quant_if{public:sc_in clk;sc_out req;sc_in ack;sc_inout data;// constructeurSC_CTOR(adaptT) {}void init () {req.write(false); // Tous les signaux <strong>de</strong> contrôle sont initialisés à 0}void Requete_Acceptee (int *Ind, int *Sel) {//On lit le sélecteur et sa valeur est retournée à la tablereq.write(true); // On est prêt à recevoirdo { //On attend le signal <strong>de</strong> m_iquant pour démarrerwait(clk->posedge_event());} while (!ack.read());*Sel = data.read();req.write(false); // La lecture <strong>de</strong> Sel est complétéewait(clk->posedge_event());//On lit l'in<strong>de</strong>x et sa valeur est retournée à la tablereq.write(true); // On est à nouveau prêt à recevoirdo { //On attend le signal <strong>de</strong> m_iquant pour redémarrerwait(clk->posedge_event());} while (!ack.read());*Ind = data.read();}req.write(false); // La lecture <strong>de</strong> Ind est complétée};void Envoie_Coefficient (int Coeff) {do {wait(clk->posedge_event());} while (not ack.read());data.write(Coeff);req.write(true);wait(clk->posedge_event());req.write(false);}Page 5 <strong>de</strong> 21

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!