/* * $Id$ * * [ Description ] * * Test */ #include "Behavioural/Generic/RegisterFile/SelfTest/include/test.h" #include "Include/Test.h" void test (string name, morpheo::behavioural::generic::registerfile::Parameters param) { cout << "<" << name << "> : Simulation SystemC" << endl; try { cout << param.print(1); param.test(); } catch (morpheo::ErrorMorpheo & error) { cout << "<" << name << "> : " << error.what (); return; } catch (...) { cerr << "<" << name << "> : This test must generate a error" << endl; exit (EXIT_FAILURE); } RegisterFile * registerfile = new RegisterFile (name.c_str(), #ifdef STATISTICS morpheo::behavioural::Parameters_Statistics(5,50), #endif param); #ifdef SYSTEMC /********************************************************************* * Déclarations des signaux *********************************************************************/ sc_clock CLOCK ("clock", 1.0, 0.5); sc_signal NRESET; sc_signal READ_VAL [param._nb_port_read]; sc_signal READ_ACK [param._nb_port_read]; sc_signal READ_ADDRESS [param._nb_port_read]; sc_signal READ_DATA [param._nb_port_read]; sc_signal WRITE_VAL [param._nb_port_write]; sc_signal WRITE_ACK [param._nb_port_write]; sc_signal WRITE_ADDRESS [param._nb_port_write]; sc_signal WRITE_DATA [param._nb_port_write]; /******************************************************** * Instanciation ********************************************************/ cout << "<" << name << "> Instanciation of registerFile" << endl; (*(registerfile->in_CLOCK)) (CLOCK); (*(registerfile->in_NRESET)) (NRESET); for (uint32_t i=0; i in_READ_VAL [i])) (READ_VAL [i]); (*(registerfile->out_READ_ACK [i])) (READ_ACK [i]); (*(registerfile-> in_READ_ADDRESS [i])) (READ_ADDRESS [i]); (*(registerfile->out_READ_DATA [i])) (READ_DATA [i]); } for (uint32_t i=0; i in_WRITE_VAL [i])) (WRITE_VAL [i]); (*(registerfile->out_WRITE_ACK [i])) (WRITE_ACK [i]); (*(registerfile-> in_WRITE_ADDRESS [i])) (WRITE_ADDRESS [i]); (*(registerfile-> in_WRITE_DATA [i])) (WRITE_DATA [i]); } /******************************************************** * Simulation - Begin ********************************************************/ cout << "<" << name << "> Start Simulation ............" << endl; // Initialisation sc_start(0); for (uint32_t i=0; i Write the RegisterFile (no read)" << endl; uint32_t grain = 0; //uint32_t grain = static_cast(time(NULL)); srand(grain); Tdata_t data, data_wait; Taddress_t address = 0; while (address < param._nb_word) { uint32_t num_port = 0; cout << "cycle : " << static_cast (sc_simulation_time()) << endl; while (num_port Read the RegisterFile (no write)" << endl; srand(grain); for (uint32_t i=0; i (sc_simulation_time()) << endl; while (num_port " << data << endl; TEST(Tdata_t,data,data_wait); address ++; num_port ++; if (address >= param._nb_word) break; } while (num_port ............ Stop Simulation" << endl; #endif delete registerfile; }