Ignore:
Timestamp:
Aug 17, 2007, 6:00:56 PM (17 years ago)
Author:
rosiere
Message:

Changement dans le répertoire "New_Component" afin que les composants nouvellement crées peuvent compiler

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/src/test.cpp

    r44 r50  
    77 */
    88
     9#define NB_ITERATION 32
     10
    911#include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/include/test.h"
    1012#include "Common/include/Test.h"
     
    3133    }
    3234
    33   RegisterFile_Monolithic * registerfile = new RegisterFile_Monolithic (name.c_str(),
     35  RegisterFile_Monolithic * registerfile = new RegisterFile_Monolithic (name.c_str()
    3436#ifdef STATISTICS
    35                                                                         morpheo::behavioural::Parameters_Statistics(5,50),
     37                                                                        ,morpheo::behavioural::Parameters_Statistics(5,1000)
    3638#endif
    37                                                                         param);
     39                                                                        ,param);
    3840 
    3941#ifdef SYSTEMC
     
    7981    }
    8082 
     83  cout << "<" << name << "> Start Simulation ............" << endl;
     84  Time * _time = new Time();
     85
    8186  /********************************************************
    8287   * Simulation - Begin
    8388   ********************************************************/
    8489
    85   cout << "<" << name << "> Start Simulation ............" << endl;
    8690  // Initialisation
    8791
     
    100104  NRESET.write(1);
    101105
    102   cout << "<" << name << "> Write the RegisterFile (no read)" << endl;
    103 
    104   uint32_t grain = 0;
    105   //uint32_t grain = static_cast<uint32_t>(time(NULL));
    106  
    107   srand(grain);
    108  
    109   Tdata_t    data, data_wait;
    110   Taddress_t address = 0;
    111 
    112   while (address < param._nb_word)
    113     {
    114       uint32_t num_port = 0;
    115      
    116       cout << "cycle : " << static_cast<uint32_t> (sc_simulation_time()) << endl;
    117 
    118       while (num_port<param._nb_port_write)
     106
     107  for (uint32_t nb_iteration=0; nb_iteration < NB_ITERATION; nb_iteration ++)
     108    {
     109      cout << "<" << name << "> 1) Write the RegisterFile (no read)" << endl;
     110
     111      // random init
     112      uint32_t grain = 0;
     113      //uint32_t grain = static_cast<uint32_t>(time(NULL));
     114     
     115      srand(grain);
     116
     117      Tdata_t tab [param._nb_word];
     118     
     119      for (uint32_t i=0; i<param._nb_word; i++)
     120        tab[i]= rand()%(1<<(param._size_word-1));
     121     
     122      Taddress_t address_next = 0;
     123      Taddress_t nb_ack = 0;
     124     
     125      while (nb_ack < param._nb_word)
    119126        {
    120           data = rand()%(1<<(param._size_word-1));
    121 
    122           cout << "(" << num_port << ") [" << address << "] <= " << data << endl;
    123           WRITE_VAL  [num_port] .write(1);
    124           WRITE_DATA    [num_port] .write(data);
    125           WRITE_ADDRESS [num_port] .write(address);
    126 
    127           address  ++;
    128           num_port ++;
    129           // Address can be not a multiple of nb_port_write
    130           if (address >= param._nb_word)
    131             break;
     127          cout << "cycle : " << static_cast<uint32_t> (sc_simulation_time()) << endl;
     128
     129          for (uint32_t num_port=0; num_port < param._nb_port_write; num_port ++)
     130            {
     131              if ((address_next < param._nb_word) and
     132                  (WRITE_VAL [num_port].read() == 0))
     133                {
     134                  cout << "(" << num_port << ") [" << address_next << "] <= " << tab[address_next] << endl;
     135                 
     136                  WRITE_VAL     [num_port] .write(1);
     137                  WRITE_DATA    [num_port] .write(tab[address_next]);
     138                  WRITE_ADDRESS [num_port] .write(address_next++);
     139                 
     140                  // Address can be not a multiple of nb_port_write
     141                  if (address_next >= param._nb_word)
     142                    break;
     143                }
     144            }
     145         
     146          sc_start(1);
     147
     148          // reset write_val port
     149          for (uint32_t num_port=0; num_port < param._nb_port_write; num_port ++)
     150            {
     151              if ((WRITE_ACK [num_port].read() == 1) and
     152                  (WRITE_VAL [num_port].read() == 1))
     153                {
     154                  WRITE_VAL  [num_port] .write(0);
     155                  nb_ack ++;
     156                }
     157            }
     158
     159          sc_start(0);
    132160        }
    133 
    134       while (num_port<param._nb_port_write)
     161     
     162      address_next = 0;
     163      nb_ack       = 0;
     164
     165      cout << "<" << name << "> 2) Read the RegisterFile (no write)" << endl;
     166     
     167      Tdata_t read_address [param._nb_port_read];
     168
     169      while (nb_ack < param._nb_word)
    135170        {
    136           WRITE_VAL  [num_port] .write(0);
    137           num_port ++;
     171          cout << "cycle : " << static_cast<uint32_t> (sc_simulation_time()) << endl;
     172         
     173          for (uint32_t num_port=0; num_port < param._nb_port_read; num_port ++)
     174            {
     175              if ((address_next < param._nb_word) and
     176                  (READ_VAL [num_port].read() == 0))
     177                {
     178                  read_address [num_port] = address_next++;
     179
     180                  READ_VAL     [num_port].write(1);
     181                  READ_ADDRESS [num_port].write(read_address [num_port]);
     182
     183                  if (address_next >= param._nb_word)
     184                    break;
     185                }
     186            }
     187
     188          sc_start(1);
     189
     190          // reset write_val port
     191          for (uint32_t num_port=0; num_port < param._nb_port_read; num_port ++)
     192            {
     193              if ((READ_ACK [num_port].read() == 1) and
     194                  (READ_VAL [num_port].read() == 1))
     195                {
     196                  READ_VAL  [num_port] .write(0);
     197
     198                  cout << "(" << num_port << ") [" << read_address [num_port] << "] => " << READ_DATA [num_port].read() << endl;
     199
     200                  TEST(Tdata_t,READ_DATA [num_port].read(), tab[read_address [num_port]]);
     201                  nb_ack ++;
     202                }
     203            }
     204
     205          sc_start(0);
    138206        }
    139 
    140       sc_start(1);
    141     }
    142   cout << "<" << name << "> Read the RegisterFile (no write)" << endl;
    143 
    144   srand(grain);
    145 
    146   for (uint32_t i=0; i<param._nb_port_write; i++)
    147     WRITE_VAL [i] .write (0);
    148 
    149   sc_start(1);
    150 
    151   address  = 0;
    152   while (address < param._nb_word)
    153     {
    154       uint32_t num_port = 0;
    155 
    156       cout << "cycle : " << static_cast<uint32_t> (sc_simulation_time()) << endl;
    157      
    158       while (num_port<param._nb_port_read)
    159         {
    160           READ_VAL  [num_port] .write(1);
    161           READ_ADDRESS [num_port] .write(address);
    162 
    163           sc_start(0); // evaluation
    164 
    165           data_wait = rand()%(1<<(param._size_word-1));
    166           data      = READ_DATA    [num_port] .read();
    167 
    168           cout << "(" << num_port << ") [" << address << "] => " << data << endl;
    169 
    170           TEST(Tdata_t,data,data_wait);
    171 
    172           address  ++;
    173           num_port ++;
    174           if (address >= param._nb_word)
    175             break;
    176         }
    177 
    178       while (num_port<param._nb_port_read)
    179         {
    180           READ_VAL  [num_port] .write(0);
    181           num_port ++;
    182         }
    183 
    184       sc_start(1);
    185     }
    186 
    187   for (uint32_t i=0; i<param._nb_port_read; i++)
    188     READ_VAL  [i] .write (0);
    189 
    190   sc_start(1);
     207    }
    191208
    192209  /********************************************************
     
    194211   ********************************************************/
    195212
     213  TEST_STR(bool,true,true, "End of Simulation");
     214  delete _time;
    196215  cout << "<" << name << "> ............ Stop Simulation" << endl;
    197216
Note: See TracChangeset for help on using the changeset viewer.