Ignore:
Timestamp:
Jul 5, 2007, 5:50:19 PM (17 years ago)
Author:
rosiere
Message:

Modification des classes d'encapsulation des interfaces :

  • gère les signaux à écrire dans le vhdl
  • les traces pour le testbench
  • la génération des vhdl structurelles

-> test sur la Pattern History Table

Location:
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Counter
Files:
2 deleted
11 edited

Legend:

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

    r2 r42  
    4343   *********************************************************************/
    4444  sc_clock                                 CLOCK ("clock", 1.0, 0.5);
     45  sc_signal<Tcontrol_t>                    RESET;
    4546  sc_signal<Tdata_t>                       DATA_IN  [param._nb_port];
    4647  sc_signal<Tcontrol_t>                    ADDSUB   [param._nb_port];
     
    5354  cout << "<" << name << "> Instanciation of _Counter" << endl;
    5455 
    55  #if defined(STATISTICS) or defined(VHDL_TESTBENCH)
    5656  (*(_Counter->in_CLOCK))        (CLOCK);
    57 #endif
     57  (*(_Counter->in_NRESET))       (RESET);
    5858
    5959  for (uint32_t i=0; i<param._nb_port; i++)
     
    7979
    8080  sc_start(0);
    81   _Counter->vhdl_testbench_label("Initialisation");
     81
     82  RESET.write(1);
     83
    8284  cout << "{"+toString(static_cast<uint32_t>(sc_simulation_time()))+"} Initialisation" << endl;
    8385
    84   _Counter->vhdl_testbench_label("Loop of Test");
    8586  cout << "{"+toString(static_cast<uint32_t>(sc_simulation_time()))+"} Loop of Test" << endl;
    8687
    8788  for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++)
    8889    {
    89       _Counter->vhdl_testbench_label("Iteration "+toString(iteration));
    9090      cout << "{" << static_cast<uint32_t>(sc_simulation_time()) << "} Itération " << iteration << endl;
    9191      for (uint32_t i=0; i<param._nb_port; i++)
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Counter/include/Counter.h

    r2 r42  
    2525#include "Behavioural/include/Vhdl.h"
    2626#endif
    27 #ifdef VHDL_TESTBENCH
    28 #include "Behavioural/include/Vhdl_Testbench.h"
    29 #endif
     27#include "Behavioural/include/Component.h"
    3028
    3129using namespace std;
    3230
    33 namespace morpheo                    {
     31namespace morpheo {
    3432namespace behavioural {
    3533namespace generic {
    3634namespace counter {
    37 
    3835
    3936  class Counter
     
    5552#endif
    5653
    57 #ifdef VHDL_TESTBENCH
    58   private   : Vhdl_Testbench                 * _vhdl_testbench;
    59 #endif
     54  public    : Component                      * _component;
     55  private   : Interfaces                     * _interfaces;
    6056
    6157#ifdef SYSTEMC
     
    6359    // Interface
    6460  public    : SC_CLOCK                      *  in_CLOCK        ;
    65 
     61  public    : SC_IN (Tcontrol_t)            *  in_NRESET       ;
    6662  public    : SC_IN (Tdata_t)              **  in_COUNTER_DATA         ;
    6763  public    : SC_IN (Tcontrol_t)           **  in_COUNTER_ADDSUB       ;
     
    107103#if VHDL                                       
    108104  public  : void     vhdl                      (void);
    109   private : void     vhdl_port                 (Vhdl & vhdl);
    110   private : void     vhdl_declaration          (Vhdl & vhdl);
    111   private : void     vhdl_body                 (Vhdl & vhdl);
     105  private : void     vhdl_port                 (Vhdl * & vhdl);
     106  private : void     vhdl_declaration          (Vhdl * & vhdl);
     107  private : void     vhdl_body                 (Vhdl * & vhdl);
    112108#endif                                         
    113109                                               
    114110#ifdef VHDL_TESTBENCH                         
    115   private : void     vhdl_testbench_port       (void);
    116111  private : void     vhdl_testbench_transition (void);
    117112#endif
    118   public  : void     vhdl_testbench_label      (string label);
    119113  };
    120114
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Counter/src/Counter.cpp

    r2 r42  
    3131    log_printf(FUNC,Counter,"Counter","Begin");
    3232
     33#ifdef SYSTEMC
     34    allocation ();
     35#endif
     36
    3337#ifdef STATISTICS
    3438    // Allocation of statistics
     
    3640                            param_statistics          ,
    3741                            param);
    38 #endif
    39 
    40 #ifdef VHDL_TESTBENCH
    41     // Creation of a testbench
    42     //  -> port
    43     //  -> clock's signals
    44     _vhdl_testbench = new Vhdl_Testbench (_name);
    45     vhdl_testbench_port           ();
    46     _vhdl_testbench->set_clock    ("in_CLOCK",false);
    4742#endif
    4843
     
    5348
    5449#ifdef SYSTEMC
    55     allocation ();
    56 
    5750    SC_METHOD (transition);
    5851    dont_initialize ();
     
    8578#endif
    8679
    87 #ifdef VHDL_TESTBENCH
    88     // generate the test bench
    89     _vhdl_testbench->generate_file();
    90     delete _vhdl_testbench;
    91 #endif
    92 
    9380#ifdef STATISTICS
    9481    _stat->generate_file(statistics(0));
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Counter/src/Counter_allocation.cpp

    r2 r42  
    2121    log_printf(FUNC,Counter,"allocation","Begin");
    2222
    23 #if defined(STATISTICS) or defined(VHDL_TESTBENCH)
    24     in_CLOCK  = new SC_CLOCK           ("in_CLOCK");
     23    _component   = new Component ();
     24
     25    Entity * entity = _component->set_entity (_name     
     26                                             ,"Counter" 
     27#ifdef POSITION
     28                                             ,COMBINATORY
    2529#endif
     30                                              );
     31   
     32    _interfaces = entity->set_interfaces();
    2633
    27      in_COUNTER_DATA  = new SC_IN (Tdata_t)    * [_param._nb_port];
    28      in_COUNTER_ADDSUB= new SC_IN (Tcontrol_t) * [_param._nb_port];
    29     out_COUNTER_DATA  = new SC_OUT(Tdata_t)    * [_param._nb_port];
    30    
    31     for (uint32_t i=0; i<_param._nb_port; i++)
    32       {
    33         rename = " in_COUNTER_DATA_" +toString(i);
    34          in_COUNTER_DATA  [i] = new SC_IN (Tdata_t)    (rename.c_str());
     34    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     35    {
     36      Interface * interface = _interfaces->set_interface(""
     37#ifdef POSITION
     38                                                         , IN 
     39                                                         , SOUTH
     40                                                         , "Generalist interface"
     41#endif
     42                                                         );
     43     
     44      in_CLOCK              = interface->set_signal_clk              ("clock" ,1,CLOCK_VHDL_NO);
     45      in_NRESET             = interface->set_signal_in  <Tcontrol_t> ("nreset",1,RESET_VHDL_NO);
     46    }
    3547
    36         rename = " in_COUNTER_ADDSUB_"+toString(i);
    37          in_COUNTER_ADDSUB[i] = new SC_IN (Tcontrol_t) (rename.c_str());
    38 
    39         rename = "out_COUNTER_DATA_" +toString(i);
    40         out_COUNTER_DATA  [i] = new SC_OUT(Tdata_t)    (rename.c_str());
    41       }
     48    // ~~~~~[ Interface : "counter" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     49     {
     50        in_COUNTER_DATA  = new SC_IN (Tdata_t)    * [_param._nb_port];
     51        in_COUNTER_ADDSUB= new SC_IN (Tcontrol_t) * [_param._nb_port];
     52       out_COUNTER_DATA  = new SC_OUT(Tdata_t)    * [_param._nb_port];
     53       
     54       for (uint32_t i=0; i<_param._nb_port; i++)
     55         {
     56           Interface_fifo * interface = _interfaces->set_interface("counter_"+toString(i)
     57#ifdef POSITION
     58                                                                   , IN 
     59                                                                   , SOUTH
     60                                                                   , "Counter interface"
     61#endif
     62                                                                   );
     63           
     64            in_COUNTER_DATA   [i] = interface->set_signal_in  <Tdata_t   > ("data"  , _param._size_data);
     65            in_COUNTER_ADDSUB [i] = interface->set_signal_in  <Tcontrol_t> ("addsub", 1                );
     66           out_COUNTER_DATA   [i] = interface->set_signal_out <Tdata_t   > ("data"  , _param._size_data);
     67         }
     68     }
     69#ifdef POSITION
     70    _component->generate_file();
     71#endif
    4272
    4373    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Counter/src/Counter_deallocation.cpp

    r2 r42  
    1919    log_printf(FUNC,Counter,"deallocation","Begin");
    2020
    21 #if defined(STATISTICS) or defined(VHDL_TESTBENCH)
    22     delete in_CLOCK;
    23 #endif
     21    delete     in_CLOCK;
     22    delete     in_NRESET;
    2423   
    25     for (uint32_t i=0; i<_param._nb_port; i++)
    26       {
    27         delete  in_COUNTER_DATA  [i];
    28         delete  in_COUNTER_ADDSUB[i];
    29         delete out_COUNTER_DATA  [i];
    30       }
    31     delete  in_COUNTER_DATA  ;
    32     delete  in_COUNTER_ADDSUB;
    33     delete out_COUNTER_DATA  ;
     24    delete []  in_COUNTER_DATA  ;
     25    delete []  in_COUNTER_ADDSUB;
     26    delete [] out_COUNTER_DATA  ;
    3427   
    3528    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
     29
     30    delete _component;
    3631
    3732    log_printf(FUNC,Counter,"deallocation","End");
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Counter/src/Counter_genMealy.cpp

    r3 r42  
    11#ifdef SYSTEMC
    2 #if defined(STATISTICS) or defined(VHDL_TESTBENCH)
    32/*
    43 * $Id$
     
    5150}; // end namespace morpheo             
    5251#endif
    53 #endif
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Counter/src/Counter_vhdl.cpp

    r2 r42  
    1919  {
    2020    log_printf(FUNC,Counter,"vhdl","Begin");
    21     Vhdl vhdl (_name);
     21    Vhdl * vhdl = new Vhdl (_name);
    2222
    23     vhdl.set_library_work (_name + "_Pack");
     23    vhdl->set_library_work (_name + "_Pack");
    2424
    2525    vhdl_port        (vhdl);
     
    2727    vhdl_body        (vhdl);
    2828
    29     vhdl.generate_file();
     29    vhdl->generate_file();
     30
     31    delete vhdl;
    3032    log_printf(FUNC,Counter,"vhdl","End");
    3133
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Counter/src/Counter_vhdl_body.cpp

    r2 r42  
    1414namespace counter {
    1515
    16 
    17   void Counter::vhdl_body (Vhdl & vhdl)
     16  void Counter::vhdl_body (Vhdl * & vhdl)
    1817  {
    1918    log_printf(FUNC,Counter,"vhdl_body","Begin");
    20     vhdl.set_body ("");
     19    vhdl->set_body ("");
    2120   
    2221    for (uint32_t i=0; i<_param._nb_port; i++)
     
    2625        if (_param._size_data > 1)
    2726          {
    28             counter_inc = "in_COUNTER_DATA_"+toString(i)+"+1";
    29             counter_dec = "in_COUNTER_DATA_"+toString(i)+"-1";
     27            counter_inc = "in_COUNTER_"+toString(i)+"_DATA+1";
     28            counter_dec = "in_COUNTER_"+toString(i)+"_DATA-1";
    3029          }
    3130        else
    3231          {
    33             counter_inc = "in_COUNTER_DATA_"+toString(i)+"+1";
    34             counter_dec = "in_COUNTER_DATA_"+toString(i)+"-1";
     32            counter_inc = "in_COUNTER_"+toString(i)+"_DATA+1";
     33            counter_dec = "in_COUNTER_"+toString(i)+"_DATA-1";
    3534          }
    3635
    37         vhdl.set_body ("out_COUNTER_DATA_"+toString(i)+" <=");
     36        vhdl->set_body ("out_COUNTER_"+toString(i)+"_DATA <=");
    3837        if (_param._size_data > 1)
    3938          {
    40             vhdl.set_body ("\tin_COUNTER_DATA_"+toString(i)+"+1 when in_COUNTER_ADDSUB_"+toString(i)+" = '1' and in_COUNTER_DATA_"+toString(i)+" < cst_max else");
    41             vhdl.set_body ("\tin_COUNTER_DATA_"+toString(i)+"-1 when in_COUNTER_ADDSUB_"+toString(i)+" = '0' and in_COUNTER_DATA_"+toString(i)+" > cst_min else");
    42             vhdl.set_body ("\tin_COUNTER_DATA_"+toString(i)+";");
     39            vhdl->set_body ("\tin_COUNTER_"+toString(i)+"_DATA+1 when in_COUNTER_"+toString(i)+"_ADDSUB = '1' and in_COUNTER_"+toString(i)+"_DATA < cst_max else");
     40            vhdl->set_body ("\tin_COUNTER_"+toString(i)+"_DATA-1 when in_COUNTER_"+toString(i)+"_ADDSUB = '0' and in_COUNTER_"+toString(i)+"_DATA > cst_min else");
     41            vhdl->set_body ("\tin_COUNTER_"+toString(i)+"_DATA;");
    4342          }
    4443        else
    4544          {
    46             vhdl.set_body ("\tin_COUNTER_ADDSUB_"+toString(i)+";");
     45            vhdl->set_body ("\tin_COUNTER_"+toString(i)+"_ADDSUB;");
    4746          }
    4847      }
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Counter/src/Counter_vhdl_declaration.cpp

    r2 r42  
    1515
    1616
    17   void Counter::vhdl_declaration (Vhdl & vhdl)
     17  void Counter::vhdl_declaration (Vhdl * & vhdl)
    1818  {
    1919    log_printf(FUNC,Counter,"vhdl_declaration","Begin");
     
    2121    if (_param._size_data > 1)
    2222      {
    23         vhdl.set_constant ("cst_min",_param._size_data,std_logic_others(_param._size_data,0));
    24         vhdl.set_constant ("cst_max",_param._size_data,std_logic_others(_param._size_data,1));
     23        vhdl->set_constant ("cst_min",_param._size_data,std_logic_others(_param._size_data,0));
     24        vhdl->set_constant ("cst_max",_param._size_data,std_logic_others(_param._size_data,1));
    2525      }
    2626
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Counter/src/Counter_vhdl_port.cpp

    r2 r42  
    1515
    1616
    17   void Counter::vhdl_port (Vhdl & vhdl)
     17  void Counter::vhdl_port (Vhdl * & vhdl)
    1818  {
    1919    log_printf(FUNC,Counter,"vhdl_port","Begin");
    2020
    21     for (uint32_t i=0; i<_param._nb_port; i++)
    22       {
    23         vhdl.set_port (" in_COUNTER_DATA_"  +toString(i), IN, _param._size_data);
    24         vhdl.set_port (" in_COUNTER_ADDSUB_"+toString(i), IN, 1                );
    25         vhdl.set_port ("out_COUNTER_DATA_"  +toString(i),OUT, _param._size_data);
    26       }
    27    
     21    _interfaces->set_port(vhdl);
     22
    2823    log_printf(FUNC,Counter,"vhdl_port","End");
    2924  };
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Counter/src/Counter_vhdl_testbench_transition.cpp

    r2 r42  
    2121    sc_start(0);
    2222
    23     // In order with file Counter_vhdl_testbench_port.cpp
    24     // Warning : if a output depend of a subcomponent, take directly the port of subcomponent
    25     // (because we have no control on the ordonnancer's policy)
    26 
    27     for (uint32_t i=0; i<_param._nb_port; i++)
    28       {
    29         _vhdl_testbench->add_input (PORT_READ( in_COUNTER_DATA  [i]));
    30         _vhdl_testbench->add_input (PORT_READ( in_COUNTER_ADDSUB[i]));
    31         _vhdl_testbench->add_output(PORT_READ(out_COUNTER_DATA  [i]));
    32       }
    33    
    34     // add_test :
    35     //  - True  : the cycle must be compare with the output of systemC
    36     //  - False : no test
    37     _vhdl_testbench->add_test(true);
    38 
    39     _vhdl_testbench->new_cycle (); // always at the end
     23    _interfaces->testbench();
    4024
    4125    log_printf(FUNC,Counter,"vhdl_testbench_transition","End");
Note: See TracChangeset for help on using the changeset viewer.