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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

INF8500 - Intra - Automne <strong>2009</strong>#inclu<strong>de</strong> "systemc.h"//#############################Interface Maison#######################################class quant_vers_table_if : virtual public sc_interface{public:// du côté du quantificateur inversevirtual void Deman<strong>de</strong>_Requete(int Sel, int Ind) =0;virtual int Lire_Coefficient() = 0;};class table_vers_quant_if : virtual public sc_interface{public:// du côté <strong>de</strong> la table <strong>de</strong>s valeurs précalculéesvirtual void Requete_Acceptee(int *Sel, int *Ind) = 0;virtual void Envoie_Coefficient(int Coeff) = 0;};class adaptQ: public sc_channel, public quant_vers_table_if{public:sc_in clk;sc_out req;sc_in ack;sc_inout data;// constructeurSC_CTOR(adaptQ) {}void init () {req.write(false); // Tous les signaux <strong>de</strong> contrôle sont initialisés à 0// afin d'assurer un blocage au démarrage}void Deman<strong>de</strong>_Requete(int Sel, int Ind) {//envoie du sélecteurdo {wait(clk ->posedge_event());} while (!ack.read());data.write(Sel);req.write(true);wait(clk->posedge_event());req.write(false);}//envoie <strong>de</strong> l'in<strong>de</strong>xdo {wait(clk->posedge_event());} while (!ack.read());data.write(Ind);req.write(true);wait(clk->posedge_event());req.write(false);int Lire_Coefficient() {req.write(true);do {wait(clk->posedge_event());} while (not ack.read());Page 4 <strong>de</strong> 21

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

Saved successfully!

Ooh no, something went wrong!