Ignore:
Timestamp:
Jan 8, 2009, 2:06:27 PM (15 years ago)
Author:
rosiere
Message:

1) Bug fix (Operation, Instruction)
2) Modif Return Address Stack
3) Add Soft Test
4) Add Soc Test

Location:
trunk
Files:
3 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore set to
      Makefile.flags
      Makefile.tools
      Makefile.tools_path
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/Makefile.deps

    r81 r100  
    2626                                        $(Behavioural_DIR_LIBRARY)
    2727
    28 Queue_DEPENDENCIES              =       Queue_Control_library   \
    29                                         Behavioural_library
    30 
    31 Queue_CLEAN                     =       Queue_Control_library_clean     \
    32                                         Behavioural_library_clean
    33 
    3428#-----[ Rules ]--------------------------------------------
    3529
    3630#.NOTPARALLEL                   : Queue_library Queue_library_clean
    3731
    38 Queue_library                   : $(Queue_DEPENDENCIES)
     32Queue_library                   :
    3933                                @\
     34                                $(MAKE) Behavioural_library;\
     35                                $(MAKE) Queue_Control_library;\
    4036                                $(MAKE) --directory=$(DIR_MORPHEO)/Behavioural/Generic/Queue --makefile=Makefile;
    4137
    42 Queue_library_clean             : $(Queue_CLEAN)
     38Queue_library_clean             :
    4339                                @\
     40                                $(MAKE) Behavioural_library_clean;\
     41                                $(MAKE) Queue_Control_library_clean;\
    4442                                $(MAKE) --directory=$(DIR_MORPHEO)/Behavioural/Generic/Queue --makefile=Makefile clean;
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/SelfTest/config_size_queue_log2.cfg

    r81 r100  
    221       32      *2      #_size_queue   
    3332      32      *2      #_size_data
     40       0       *2      #_nb_port_slot
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/SelfTest/config_size_queue_no_log2.cfg

    r81 r100  
    223       256     *4      #_size_queue   
    3332      32      *2      #_size_data
     40       0       *2      #_nb_port_slot
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/SelfTest/include/test.h

    r81 r100  
    1616
    1717#include "Behavioural/Generic/Queue/include/Queue.h"
     18#include "Common/include/Time.h"
    1819
    1920using namespace std;
     
    2627void test    (string name,
    2728              morpheo::behavioural::generic::queue::Parameters * param);
    28 
    29 class Time
    30 {
    31 private : timeval time_begin;
    32 // private : timeval time_end;
    33  
    34 public  : Time ()
    35   {
    36     gettimeofday(&time_begin     ,NULL);
    37   };
    38 
    39 public  : ~Time ()
    40   {
    41     cout << *this;
    42   };
    43 
    44 public  : friend ostream& operator<< (ostream& output_stream,
    45                                       const Time & x)
    46   {
    47     timeval time_end;
    48    
    49     gettimeofday(&time_end       ,NULL);
    50    
    51     uint32_t nb_cycles = static_cast<uint32_t>(sc_simulation_time());
    52 
    53     double average = static_cast<double>(nb_cycles) / static_cast<double>(time_end.tv_sec-x.time_begin.tv_sec);
    54    
    55     output_stream << nb_cycles << "\t(" << average << " cycles / seconds )" << endl;
    56 
    57     return output_stream;
    58   }
    59 };
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/SelfTest/src/main.cpp

    r81 r100  
    88#include "Behavioural/Generic/Queue/SelfTest/include/test.h"
    99
    10 #define NB_PARAMS 2
     10#define NB_PARAMS 3
    1111
    1212void usage (int argc, char * argv[])
     
    1414  cerr << "<Usage> " << argv[0] << " name_instance list_params" << endl
    1515       << "list_params is :" << endl
    16        << " - size_queue (uint32_t)" << endl
    17        << " - size_data  (uint32_t)" << endl
     16       << " - size_queue   (uint32_t)" << endl
     17       << " - size_data    (uint32_t)" << endl
     18       << " - nb_port_slot (uint32_t)" << endl
    1819       << "" << endl;
    1920
     
    3637  uint32_t       x = 1;
    3738 
    38   const string   name       =      argv[x++];
    39   const uint32_t size_queue = atoi(argv[x++]);
    40   const uint32_t size_data  = atoi(argv[x++]);
     39  const string   name         =      argv[x++];
     40  const uint32_t size_queue   = atoi(argv[x++]);
     41  const uint32_t size_data    = atoi(argv[x++]);
     42  const uint32_t nb_port_slot = atoi(argv[x++]);
    4143
    4244  try
     
    4446      morpheo::behavioural::generic::queue::Parameters * param = new morpheo::behavioural::generic::queue::Parameters
    4547        (size_queue,
    46          size_data
     48         size_data ,
     49         nb_port_slot
    4750        );
    4851     
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/SelfTest/src/test.cpp

    r88 r100  
    1111
    1212#include "Behavioural/Generic/Queue/SelfTest/include/test.h"
     13#include "Behavioural/include/Allocation.h"
    1314#include "Common/include/Test.h"
    1415
     
    4849  sc_clock              *  in_CLOCK  = new sc_clock ("clock", 1.0, 0.5);         
    4950  sc_signal<Tcontrol_t> *  in_NRESET = new sc_signal<Tcontrol_t> ("NRESET");
    50   sc_signal<Tcontrol_t> *  in_INSERT_VAL  = new sc_signal<Tcontrol_t> ( "in_INSERT_VAL" );
    51   sc_signal<Tcontrol_t> * out_INSERT_ACK  = new sc_signal<Tcontrol_t> ("out_INSERT_ACK" );
    52   sc_signal<Tdata_t   > *  in_INSERT_DATA = new sc_signal<Tdata_t   > ( "in_INSERT_DATA");
    53   sc_signal<Tcontrol_t> * out_RETIRE_VAL  = new sc_signal<Tcontrol_t> ("out_RETIRE_VAL" );
    54   sc_signal<Tcontrol_t> *  in_RETIRE_ACK  = new sc_signal<Tcontrol_t> ( "in_RETIRE_ACK" );
    55   sc_signal<Tdata_t   > * out_RETIRE_DATA = new sc_signal<Tdata_t   > ("out_RETIRE_DATA");
     51
     52  ALLOC0_SC_SIGNAL( in_INSERT_VAL , "in_INSERT_VAL" ,Tcontrol_t);
     53  ALLOC0_SC_SIGNAL(out_INSERT_ACK ,"out_INSERT_ACK" ,Tcontrol_t);
     54  ALLOC0_SC_SIGNAL( in_INSERT_DATA, "in_INSERT_DATA",Tdata_t   );
     55  ALLOC0_SC_SIGNAL(out_RETIRE_VAL ,"out_RETIRE_VAL" ,Tcontrol_t);
     56  ALLOC0_SC_SIGNAL( in_RETIRE_ACK , "in_RETIRE_ACK" ,Tcontrol_t);
     57  ALLOC0_SC_SIGNAL(out_RETIRE_DATA,"out_RETIRE_DATA",Tdata_t   );
     58  ALLOC1_SC_SIGNAL(out_SLOT_VAL   ,"out_SLOT_VAL"   ,Tcontrol_t,_param->_nb_port_slot);
     59  ALLOC1_SC_SIGNAL(out_SLOT_DATA  ,"out_SLOT_DATA"  ,Tdata_t   ,_param->_nb_port_slot);
    5660 
    5761  /********************************************************
     
    6468  (*(_Queue->in_NRESET))       (*(in_NRESET));
    6569
    66   (*(_Queue-> in_INSERT_VAL )) (*( in_INSERT_VAL ));
    67   (*(_Queue->out_INSERT_ACK )) (*(out_INSERT_ACK ));
    68   (*(_Queue-> in_INSERT_DATA)) (*( in_INSERT_DATA));
    69   (*(_Queue->out_RETIRE_VAL )) (*(out_RETIRE_VAL ));
    70   (*(_Queue-> in_RETIRE_ACK )) (*( in_RETIRE_ACK ));
    71   (*(_Queue->out_RETIRE_DATA)) (*(out_RETIRE_DATA));
     70  INSTANCE0_SC_SIGNAL(_Queue, in_INSERT_VAL );
     71  INSTANCE0_SC_SIGNAL(_Queue,out_INSERT_ACK );
     72  INSTANCE0_SC_SIGNAL(_Queue, in_INSERT_DATA);
     73  INSTANCE0_SC_SIGNAL(_Queue,out_RETIRE_VAL );
     74  INSTANCE0_SC_SIGNAL(_Queue, in_RETIRE_ACK );
     75  INSTANCE0_SC_SIGNAL(_Queue,out_RETIRE_DATA);
     76  INSTANCE1_SC_SIGNAL(_Queue,out_SLOT_VAL   ,_param->_nb_port_slot);
     77  INSTANCE1_SC_SIGNAL(_Queue,out_SLOT_DATA  ,_param->_nb_port_slot);
    7278
    7379  cout << "<" << name << "> Start Simulation ............" << endl;
     
    103109  uint32_t data_in  = 0;
    104110  uint32_t data_out = 0;
     111  uint32_t nb_elt   = 0;
    105112
    106113  for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++)
     
    116123          SC_START(0); // genMoore
    117124
     125          for (uint32_t i=0; i<_param->_nb_port_slot; ++i)
     126            {
     127              TEST(Tcontrol_t, out_SLOT_VAL [i]->read(), (i<nb_elt));
     128              if (i<nb_elt)
     129              TEST(Tdata_t   , out_SLOT_DATA[i]->read(), data_out+i);
     130               
     131            }
     132
    118133          if ( in_INSERT_VAL->read() and out_INSERT_ACK->read())
    119134            {
    120135              LABEL ("Transaction with interface : INSERT");
    121136              data_in ++;
     137              nb_elt ++;
    122138            }
    123139          if (out_RETIRE_VAL->read() and  in_RETIRE_ACK->read())
     
    126142              TEST(Tdata_t, out_RETIRE_DATA->read(), data_out);
    127143              data_out++;
     144              nb_elt --;
    128145            }
    129146
     
    142159  delete in_CLOCK;
    143160  delete in_NRESET;
     161
     162  DELETE0_SC_SIGNAL( in_INSERT_VAL );
     163  DELETE0_SC_SIGNAL(out_INSERT_ACK );
     164  DELETE0_SC_SIGNAL( in_INSERT_DATA);
     165  DELETE0_SC_SIGNAL(out_RETIRE_VAL );
     166  DELETE0_SC_SIGNAL( in_RETIRE_ACK );
     167  DELETE0_SC_SIGNAL(out_RETIRE_DATA);
     168  DELETE1_SC_SIGNAL(out_SLOT_VAL   ,_param->_nb_port_slot);
     169  DELETE1_SC_SIGNAL(out_SLOT_DATA  ,_param->_nb_port_slot);
     170
    144171#endif
    145172
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/include/Parameters.h

    r88 r100  
    2222  {
    2323    //-----[ fields ]------------------------------------------------------------
    24   public : const uint32_t _size_queue;
    25   public : const uint32_t _size_data ;
    26    
     24  public : const uint32_t _size_queue  ;
     25  public : const uint32_t _size_data   ;
     26  public : const uint32_t _nb_port_slot;
    2727
    2828    //-----[ methods ]-----------------------------------------------------------
    2929  public : Parameters  (uint32_t size_queue,
    30                         uint32_t size_data );
     30                        uint32_t size_data ,
     31                        uint32_t nb_port_slot);
     32
    3133//   public : Parameters  (Parameters & param) ;
    3234  public : ~Parameters () ;
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/include/Queue.h

    r82 r100  
    7474  public    : SC_OUT(Tdata_t   )            * out_RETIRE_DATA;
    7575
     76    // ~~~~~[ Interface "slot" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     77  public    : SC_OUT(Tcontrol_t)           ** out_SLOT_VAL ;
     78  public    : SC_OUT(Tdata_t   )           ** out_SLOT_DATA;
     79
    7680    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
    7781  protected : morpheo::behavioural::generic::queue_control::Queue_Control * _queue_control;
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Parameters.cpp

    r88 r100  
    1717#define FUNCTION "Queue::Parameters"
    1818  Parameters::Parameters (uint32_t size_queue,
    19                           uint32_t size_data ):
    20     _size_queue (size_queue),
    21     _size_data  (size_data )
     19                          uint32_t size_data ,
     20                          uint32_t nb_port_slot):
     21    _size_queue   (size_queue),
     22    _size_data    (size_data ),
     23    _nb_port_slot (nb_port_slot)
    2224  {
    2325    log_printf(FUNC,Queue,FUNCTION,"Begin");
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Parameters_msg_error.cpp

    r81 r100  
    2323    Parameters_test test("Queue");
    2424
     25    if (_nb_port_slot > _size_queue)
     26      test.error(_("nb_port_slot must be <= size_queue\n"));
     27
    2528    log_printf(FUNC,Queue,FUNCTION,"End");
    2629
     
    3033}; // end namespace queue
    3134}; // end namespace generic
    32 
    3335}; // end namespace behavioural
    3436}; // end namespace morpheo             
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Queue_allocation.cpp

    r88 r100  
    77
    88#include "Behavioural/Generic/Queue/include/Queue.h"
     9#include "Behavioural/include/Allocation.h"
    910
    1011namespace morpheo                    {
     
    3839                                                         ,IN
    3940                                                         ,SOUTH,
    40                                                          "Generalist interface"
     41                                                         _("Generalist interface")
    4142#endif
    4243                                                         );
     
    4849    // ~~~~~[ Interface "insert" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    4950    {
    50       Interface_fifo * interface = _interfaces->set_interface("insert"
    51 #ifdef POSITION
    52                                                          ,IN
    53                                                          ,WEST
    54                                                          ,"Insertion of data"
    55 #endif
    56                                                          );
     51      ALLOC0_INTERFACE("insert", IN, WEST, _("Interface of data write."));
    5752     
    58        in_INSERT_VAL  = interface->set_signal_valack_in (VAL);
    59       out_INSERT_ACK  = interface->set_signal_valack_out(ACK);
    60        in_INSERT_DATA = interface->set_signal_in  <Tdata_t> ("data", _param->_size_data);
     53      ALLOC0_VALACK_IN ( in_INSERT_VAL  ,VAL);
     54      ALLOC0_VALACK_OUT(out_INSERT_ACK  ,ACK);
     55      ALLOC0_SIGNAL_IN ( in_INSERT_DATA ,"data",Tdata_t,_param->_size_data);
    6156    }
     57
    6258    // ~~~~~[ Interface "retire" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    6359    {
    64       Interface_fifo * interface = _interfaces->set_interface("retire"
    65 #ifdef POSITION
    66                                                               ,IN
    67                                                               ,EAST
    68                                                               ,"Retire of data"
    69 #endif
    70                                                               );
     60      ALLOC0_INTERFACE("retire", OUT, EAST, _("Interface of data read."));
    7161     
    72       out_RETIRE_VAL  = interface->set_signal_valack_out(VAL);
    73        in_RETIRE_ACK  = interface->set_signal_valack_in (ACK);
    74       out_RETIRE_DATA = interface->set_signal_out <Tdata_t> ("data", _param->_size_data);
     62      ALLOC0_VALACK_OUT(out_RETIRE_VAL  ,VAL);
     63      ALLOC0_VALACK_IN ( in_RETIRE_ACK  ,ACK);
     64      ALLOC0_SIGNAL_OUT(out_RETIRE_DATA ,"data",Tdata_t,_param->_size_data);
     65    }
     66
     67    // ~~~~~[ Interface "slot" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     68    {
     69      ALLOC1_INTERFACE("slot", OUT, EAST, _("Internal slot."),_param->_nb_port_slot);
     70     
     71      ALLOC1_VALACK_OUT(out_SLOT_VAL  ,VAL);
     72      ALLOC1_SIGNAL_OUT(out_SLOT_DATA ,"data",Tdata_t,_param->_size_data);
    7573    }
    7674     
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Queue_deallocation.cpp

    r88 r100  
    77
    88#include "Behavioural/Generic/Queue/include/Queue.h"
     9#include "Behavioural/include/Allocation.h"
    910
    1011namespace morpheo                    {
     
    2425        delete    in_CLOCK ;
    2526        delete    in_NRESET;
    26        
    27         delete    in_INSERT_VAL ;
    28         delete   out_INSERT_ACK ;
    29         delete    in_INSERT_DATA;
    30        
    31         delete   out_RETIRE_VAL ;
    32         delete    in_RETIRE_ACK ;
    33         delete   out_RETIRE_DATA;
     27
     28        DELETE0_SIGNAL( in_INSERT_VAL                        ,1);
     29        DELETE0_SIGNAL(out_INSERT_ACK                        ,1);
     30        DELETE0_SIGNAL( in_INSERT_DATA                       ,_param->_size_data);
     31
     32        DELETE0_SIGNAL(out_RETIRE_VAL                        ,1);
     33        DELETE0_SIGNAL( in_RETIRE_ACK                        ,1);
     34        DELETE0_SIGNAL(out_RETIRE_DATA                       ,_param->_size_data);
     35
     36        DELETE1_SIGNAL(out_SLOT_VAL    ,_param->_nb_port_slot,1);
     37        DELETE1_SIGNAL(out_SLOT_DATA   ,_param->_nb_port_slot,_param->_size_data);
    3438       
    3539        // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Queue_genMoore.cpp

    r81 r100  
    1919  {
    2020    log_printf(FUNC,Queue,FUNCTION,"Begin");
    21    
     21
     22    // Output
    2223    internal_INSERT_ACK = not _queue_control->full();
    2324    internal_RETIRE_VAL = not _queue_control->empty();
     
    2627    PORT_WRITE(out_RETIRE_VAL , internal_RETIRE_VAL);
    2728    PORT_WRITE(out_RETIRE_DATA,_queue_data[(*_queue_control)[0]]);
     29
     30    // Slot
     31    // Note : Slot 0 is the same slot as retire interface.
     32    uint32_t nb_elt = _queue_control->nb_elt();
     33
     34    for (uint32_t i=0; i<_param->_nb_port_slot; ++i)
     35      {
     36        PORT_WRITE(out_SLOT_VAL  [i], i<nb_elt);
     37        PORT_WRITE(out_SLOT_DATA [i],_queue_data[(*_queue_control)[i]]);
     38      }
    2839
    2940    log_printf(FUNC,Queue,FUNCTION,"End");
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Queue_vhdl_body.cpp

    r81 r100  
    2020  {
    2121    log_printf(FUNC,Queue,FUNCTION,"Begin");
    22     vhdl->set_body ("-----------------------------------------------------------------------------");
    23     vhdl->set_body ("-- Output");
    24     vhdl->set_body ("-----------------------------------------------------------------------------");
    25     vhdl->set_body ("out_INSERT_ACK        <= not reg_FULL;");
    26     vhdl->set_body ("out_RETIRE_VAL        <= not reg_EMPTY;");
    27        
    28     if (_param->_size_queue > 1)
    29       vhdl->set_body ("out_RETIRE_DATA       <= reg_DATA(conv_integer(reg_PTR_READ));");
    30     else
    31       vhdl->set_body ("out_RETIRE_DATA       <= reg_DATA(0);");
    32 
    33     vhdl->set_body ("");
    34     vhdl->set_body ("-----------------------------------------------------------------------------");
    35     vhdl->set_body ("-- Signal");
    36     vhdl->set_body ("-----------------------------------------------------------------------------");
    37     vhdl->set_body ("");
    38     vhdl->set_body ("signal_PTR_EQUAL      <=");
    39     if (_param->_size_queue > 1)
    40       {
    41         vhdl->set_body ("\t'1' when signal_NEXT_PTR_READ = signal_NEXT_PTR_WRITE else");
    42         vhdl->set_body ("\t'0';");
    43       }
    44     else
    45       vhdl->set_body ("\t'1';");
    46     vhdl->set_body ("signal_NEXT_FULL      <=");
    47     vhdl->set_body ("\t'1' when signal_WRITE='1' and signal_PTR_EQUAL='1' else");
    48     vhdl->set_body ("\t'0' when signal_READ ='1'                          else");
    49     vhdl->set_body ("\treg_FULL ;");
    50     vhdl->set_body ("signal_NEXT_EMPTY     <=");
    51     vhdl->set_body ("\t'1' when signal_READ ='1' and signal_PTR_EQUAL='1' else");
    52     vhdl->set_body ("\t'0' when signal_WRITE='1'                          else");
    53     vhdl->set_body ("\treg_EMPTY;");
    54     vhdl->set_body ("");
    55     vhdl->set_body ("-- read");
    56     vhdl->set_body ("signal_READ           <= (not reg_EMPTY) and in_RETIRE_ACK;");
    57 
     22    vhdl->set_comment(0,"---------------------------------------------------------------------------");
     23    vhdl->set_comment(0," Output");
     24    vhdl->set_comment(0,"---------------------------------------------------------------------------");
     25    vhdl->set_body   (0,"out_INSERT_ACK        <= not signal_FULL;");
     26    vhdl->set_body   (0,"out_RETIRE_VAL        <= not signal_EMPTY;");
     27       
     28    if (_param->_size_queue > 1)
     29    vhdl->set_body   (0,"out_RETIRE_DATA       <= reg_DATA(conv_integer(signal_PTR_READ));");
     30    else
     31    vhdl->set_body   (0,"out_RETIRE_DATA       <= reg_DATA(0);");
     32
     33    vhdl->set_body   (0,"");
     34    vhdl->set_comment(0,"---------------------------------------------------------------------------");
     35    vhdl->set_comment(0," Slot");
     36    vhdl->set_comment(0,"---------------------------------------------------------------------------");
     37    vhdl->set_body   (0,"");
     38    if (_param->_nb_port_slot > 1)
     39      for (uint32_t i=0; i<_param->_nb_port_slot; ++i)
     40        if (i==0)
     41          vhdl->set_body   (0,"signal_SLOT_0           <= signal_PTR_READ;");
     42        else
     43          {
     44            if (is_power2(_param->_size_queue))
     45              vhdl->set_body   (0,"signal_SLOT_"+toString(i)+"           <= signal_PTR_READ+"+std_logic_cst(log2(_param->_size_queue),i)+";");
     46            else
     47              vhdl->set_body   (0,"signal_SLOT_"+toString(i)+"           <= const_PTR_INIT when signal_SLOT_"+toString(i-1)+" = const_PTR_MAX else signal_SLOT_"+toString(i-1)+"+'1';");
     48          }
     49       
     50    for (uint32_t i=0; i<_param->_nb_port_slot; ++i)
     51      {
     52        if (_param->_nb_port_slot > 1)
     53          vhdl->set_body   (0,"out_SLOT_"+toString(i)+"_VAL        <= '1' when reg_NB_ELT > "+std_logic_cst(log2(_param->_size_queue+1),i)+" else '0';");
     54        else
     55          vhdl->set_body   (0,"out_SLOT_"+toString(i)+"_VAL        <= not signal_EMPTY;");
     56       
     57        if (_param->_nb_port_slot > 1)
     58          vhdl->set_body   (0,"out_SLOT_"+toString(i)+"_DATA       <= reg_DATA(conv_integer(signal_SLOT_"+toString(i)+"));");
     59        else
     60          if (_param->_size_queue > 1)
     61            vhdl->set_body   (0,"out_SLOT_"+toString(i)+"_DATA       <= reg_DATA(conv_integer(signal_PTR_READ));");
     62          else
     63            vhdl->set_body   (0,"out_SLOT_"+toString(i)+"_DATA       <= reg_DATA(conv_integer(0));");
     64      }
     65
     66    vhdl->set_body   (0,"");
     67    vhdl->set_comment(0,"---------------------------------------------------------------------------");
     68    vhdl->set_comment(0," Signal");
     69    vhdl->set_comment(0,"---------------------------------------------------------------------------");
     70    vhdl->set_body   (0,"");
     71    vhdl->set_body   (0,"signal_READ           <= (not signal_EMPTY) and in_RETIRE_ACK;");
     72    vhdl->set_body   (0,"signal_WRITE          <= (not signal_FULL ) and in_INSERT_VAL;");
     73    vhdl->set_body   (0,"");
     74    if (_param->_nb_port_slot>1)
     75      {
     76        vhdl->set_body   (0,"signal_EMPTY          <= '1' when reg_NB_ELT = "+std_logic_cst(log2(_param->_size_queue+1),0)+" else '0';");
     77    if (is_power2(_param->_size_queue))
     78    vhdl->set_body   (0,"signal_FULL           <= reg_NB_ELT "+std_logic_range(log2(_param->_size_queue),log2(_param->_size_queue))+";");
     79    else
     80      vhdl->set_body   (0,"signal_FULL           <= '1' when reg_NB_ELT = "+std_logic_cst(log2(_param->_size_queue+1),_param->_size_queue)+" else '0';");
     81      }
     82    else
     83      {
     84    vhdl->set_body   (0,"signal_EMPTY          <= reg_EMPTY;");
     85    vhdl->set_body   (0,"signal_FULL           <= reg_FULL ;");
     86      }
     87    vhdl->set_body   (0,"");
     88    if (_param->_size_queue > 1)
     89      {
     90    vhdl->set_body   (0,"signal_PTR_READ       <= reg_PTR_READ;");
     91    if (_param->_nb_port_slot>1)
     92      {
     93        if (is_power2(_param->_size_queue))
     94          vhdl->set_body   (0,"signal_PTR_WRITE      <= reg_PTR_READ + reg_NB_ELT"+std_logic_range(log2(_param->_size_queue))+";");
     95        else
     96          vhdl->set_body   (0,"signal_PTR_WRITE      <= reg_PTR_READ + reg_NB_ELT"+std_logic_range(log2(_param->_size_queue))+" when reg_PTR_READ + reg_NB_ELT"+std_logic_range(log2(_param->_size_queue)) +" <= const_PTR_MAX else reg_PTR_READ + reg_NB_ELT"+std_logic_range(log2(_param->_size_queue))+" - const_PTR_MAX-'1';");
     97      }
     98    else
     99    vhdl->set_body   (0,"signal_PTR_WRITE      <= reg_PTR_WRITE;");
     100      }
     101    vhdl->set_body   (0,"");
     102
     103    if (_param->_nb_port_slot>1)
     104      {
     105    vhdl->set_body   (0,"");
     106    vhdl->set_comment(0," nb_elt");
    58107    if (_param->_size_queue > 1)
    59108      { 
    60         vhdl->set_body ("signal_NEXT_PTR_READ  <= ");
    61         vhdl->set_body ("\treg_PTR_READ   when signal_READ='0' else");
    62         if (is_log2(_param->_size_queue) == false)
    63           vhdl->set_body ("\tconst_PTR_INIT when reg_PTR_READ  = const_PTR_MAX else");
    64 
    65         if (_param->_size_queue > 2)
    66           vhdl->set_body ("\treg_PTR_READ +'1';");
    67         else
    68           vhdl->set_body ("\tnot reg_PTR_READ;");
    69       }
    70     vhdl->set_body ("");
    71     vhdl->set_body ("-- write");
    72     vhdl->set_body ("signal_WRITE          <= (not reg_FULL ) and in_INSERT_VAL;");
    73     if (_param->_size_queue > 1)
    74       {
    75         vhdl->set_body ("signal_NEXT_PTR_WRITE <= ");
    76         vhdl->set_body ("\treg_PTR_WRITE  when signal_WRITE='0' else");
    77         if (is_log2(_param->_size_queue) == false)
    78           vhdl->set_body ("\tconst_PTR_INIT when reg_PTR_WRITE = const_PTR_MAX else");
    79         if (_param->_size_queue > 2)
    80           vhdl->set_body ("\treg_PTR_WRITE+'1';");
    81         else
    82           vhdl->set_body ("\tnot reg_PTR_WRITE;");
    83       }
    84     vhdl->set_body ("");
    85     vhdl->set_body ("-----------------------------------------------------------------------------");
    86     vhdl->set_body ("-- Registers");
    87     vhdl->set_body ("-----------------------------------------------------------------------------");
    88     vhdl->set_body ("");
    89     vhdl->set_body ("queue_write: process (in_CLOCK)");
    90     vhdl->set_body ("begin  -- process queue_write");
    91     vhdl->set_body ("\tif in_CLOCK'event and in_CLOCK = '1' then");
    92     vhdl->set_body ("");
    93     vhdl->set_body ("\t\tif (in_NRESET = '0') then");   
    94     if (_param->_size_queue > 1)
    95       {
    96         vhdl->set_body ("\t\t\treg_PTR_READ  <= const_PTR_INIT;");
    97         vhdl->set_body ("\t\t\treg_PTR_WRITE <= const_PTR_INIT;");
    98       }
    99     vhdl->set_body ("\t\t\treg_FULL      <= '0';");
    100     vhdl->set_body ("\t\t\treg_EMPTY     <= '1';");
    101     vhdl->set_body ("\t\telse");
    102     if (_param->_size_queue > 1)
    103       {
    104         vhdl->set_body ("\t\t\treg_PTR_READ  <= signal_NEXT_PTR_READ ;");
    105         vhdl->set_body ("\t\t\treg_PTR_WRITE <= signal_NEXT_PTR_WRITE;");
    106       }
    107     vhdl->set_body ("\t\t\treg_FULL      <= signal_NEXT_FULL ;");
    108     vhdl->set_body ("\t\t\treg_EMPTY     <= signal_NEXT_EMPTY;");
    109     vhdl->set_body ("");
    110     vhdl->set_body ("\t\t\tif (signal_WRITE = '1') then");   
    111     if (_param->_size_queue > 1)
    112       vhdl->set_body ("\t\t\t\treg_DATA(conv_integer(reg_PTR_WRITE)) <= in_INSERT_DATA;");
    113     else
    114       vhdl->set_body ("\t\t\t\treg_DATA(0) <= in_INSERT_DATA;");
    115     vhdl->set_body ("\t\t\tend if;");
    116     vhdl->set_body ("\t\tend if;");
    117     vhdl->set_body ("");
    118     vhdl->set_body ("\tend if;");
    119     vhdl->set_body ("end process queue_write;");
     109    vhdl->set_body   (0,"signal_NEXT_NB_ELT  <= ");
     110    vhdl->set_body   (1,"reg_NB_ELT   when (signal_READ xor signal_WRITE) = '0' else");
     111    if (_param->_size_queue > 2)
     112      {
     113    vhdl->set_body   (1,"reg_NB_ELT +'1' when signal_WRITE='1' else");
     114    vhdl->set_body   (1,"reg_NB_ELT -'1';");
     115      }
     116    else
     117    vhdl->set_body   (1,"not reg_NB_ELT;");
     118      }
     119      }
     120    else
     121      {
     122    vhdl->set_body   (0,"signal_PTR_EQUAL      <=");
     123    if (_param->_size_queue > 1)
     124      {
     125    vhdl->set_body   (1,"'1' when signal_NEXT_PTR_READ = signal_NEXT_PTR_WRITE else");
     126    vhdl->set_body   (1,"'0';");
     127      }
     128    else
     129    vhdl->set_body   (1,"'1';");
     130    vhdl->set_body   (0,"signal_NEXT_FULL      <=");
     131    vhdl->set_body   (1,"'1' when signal_WRITE='1' and signal_PTR_EQUAL='1' else");
     132    vhdl->set_body   (1,"'0' when signal_READ ='1'                          else");
     133    vhdl->set_body   (1,"reg_FULL ;");
     134    vhdl->set_body   (0,"signal_NEXT_EMPTY     <=");
     135    vhdl->set_body   (1,"'1' when signal_READ ='1' and signal_PTR_EQUAL='1' else");
     136    vhdl->set_body   (1,"'0' when signal_WRITE='1'                          else");
     137    vhdl->set_body   (1,"reg_EMPTY;");
     138    vhdl->set_body   (0,"");
     139
     140    vhdl->set_comment(0," write");
     141    if (_param->_size_queue > 1)
     142      {
     143    vhdl->set_body   (0,"signal_NEXT_PTR_WRITE <= ");
     144    vhdl->set_body   (1,"reg_PTR_WRITE  when signal_WRITE='0' else");
     145    if (is_log2(_param->_size_queue) == false)
     146    vhdl->set_body   (1,"const_PTR_INIT when reg_PTR_WRITE = const_PTR_MAX else");
     147    if (_param->_size_queue > 2)
     148    vhdl->set_body   (1,"reg_PTR_WRITE+'1';");
     149    else
     150    vhdl->set_body   (1,"not reg_PTR_WRITE;");
     151      }
     152      }
     153
     154    vhdl->set_body   (0,"");
     155    vhdl->set_comment(0," read");
     156    if (_param->_size_queue > 1)
     157      { 
     158    vhdl->set_body   (0,"signal_NEXT_PTR_READ  <= ");
     159    vhdl->set_body   (1,"reg_PTR_READ   when signal_READ='0' else");
     160    if (is_log2(_param->_size_queue) == false)
     161    vhdl->set_body   (1,"const_PTR_INIT when reg_PTR_READ  = const_PTR_MAX else");
     162
     163    if (_param->_size_queue > 2)
     164    vhdl->set_body   (1,"reg_PTR_READ +'1';");
     165    else
     166    vhdl->set_body   (1,"not reg_PTR_READ;");
     167      }
     168    vhdl->set_body   (0,"");
     169
     170    vhdl->set_comment(0,"---------------------------------------------------------------------------");
     171    vhdl->set_comment(0," Registers");
     172    vhdl->set_comment(0,"---------------------------------------------------------------------------");
     173    vhdl->set_body   (0,"");
     174    vhdl->set_body   (0,"queue_write: process (in_CLOCK)");
     175    vhdl->set_body   (0,"begin  -- process queue_write");
     176    vhdl->set_body   (1,"if in_CLOCK'event and in_CLOCK = '1' then");
     177    vhdl->set_body   (0,"");
     178    vhdl->set_body   (2,"if (in_NRESET = '0') then");   
     179    if (_param->_size_queue > 1)
     180      {
     181        vhdl->set_body   (3,"reg_PTR_READ  <= const_PTR_INIT;");
     182        if (_param->_nb_port_slot>1)
     183        vhdl->set_body   (3,"reg_NB_ELT    <= "+std_logic_cst(log2(_param->_size_queue+1),0)+";");
     184        else
     185        vhdl->set_body   (3,"reg_PTR_WRITE <= const_PTR_INIT;");
     186      }
     187    if (_param->_nb_port_slot<=1)
     188      {
     189    vhdl->set_body   (3,"reg_FULL      <= '0';");
     190    vhdl->set_body   (3,"reg_EMPTY     <= '1';");
     191      }
     192    vhdl->set_body   (2,"else");
     193    if (_param->_size_queue > 1)
     194      {
     195        vhdl->set_body   (3,"reg_PTR_READ  <= signal_NEXT_PTR_READ ;");
     196        if (_param->_nb_port_slot>1)
     197        vhdl->set_body   (3,"reg_NB_ELT    <= signal_NEXT_NB_ELT   ;");
     198        else
     199        vhdl->set_body   (3,"reg_PTR_WRITE <= signal_NEXT_PTR_WRITE;");
     200      }
     201    if (_param->_nb_port_slot<=1)
     202      {
     203    vhdl->set_body   (3,"reg_FULL      <= signal_NEXT_FULL ;");
     204    vhdl->set_body   (3,"reg_EMPTY     <= signal_NEXT_EMPTY;");
     205      }
     206    vhdl->set_body   (0,"");
     207    vhdl->set_body   (3,"if (signal_WRITE = '1') then");   
     208    if (_param->_size_queue > 1)
     209      vhdl->set_body   (3,"\treg_DATA(conv_integer(signal_PTR_WRITE)) <= in_INSERT_DATA;");
     210    else
     211      vhdl->set_body   (3,"\treg_DATA(0) <= in_INSERT_DATA;");
     212    vhdl->set_body   (3,"end if;");
     213    vhdl->set_body   (2,"end if;");
     214    vhdl->set_body   (0,"");
     215    vhdl->set_body   (1,"end if;");
     216    vhdl->set_body   (0,"end process queue_write;");
    120217
    121218    log_printf(FUNC,Queue,FUNCTION,"End");
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Queue_vhdl_declaration.cpp

    r81 r100  
    2424   
    2525    vhdl->set_signal  ("reg_DATA             ", "Tqueue");
    26     vhdl->set_signal  ("reg_FULL             ", 1);
    27     vhdl->set_signal  ("reg_EMPTY            ", 1);
    28     if (_param->_size_queue > 1)
    29       {
    30         vhdl->set_signal  ("reg_PTR_READ         ", log2(_param->_size_queue));
    31         vhdl->set_signal  ("reg_PTR_WRITE        ", log2(_param->_size_queue));
    32       }
     26
    3327    vhdl->set_signal  ("signal_READ          ", 1);
    3428    vhdl->set_signal  ("signal_WRITE         ", 1);
    35     vhdl->set_signal  ("signal_PTR_EQUAL     ", 1);
     29    vhdl->set_signal  ("signal_EMPTY         ", 1);
     30    vhdl->set_signal  ("signal_FULL          ", 1);
    3631
    3732    if (_param->_size_queue > 1)
    3833      {
    39         vhdl->set_signal  ("signal_NEXT_PTR_READ ", log2(_param->_size_queue));
    40         vhdl->set_signal  ("signal_NEXT_PTR_WRITE", log2(_param->_size_queue));
     34    vhdl->set_signal  ("reg_PTR_READ         ", log2(_param->_size_queue));
     35    vhdl->set_signal  ("signal_NEXT_PTR_READ ", log2(_param->_size_queue));
     36    vhdl->set_signal  ("signal_PTR_READ      ", log2(_param->_size_queue));
     37    vhdl->set_signal  ("signal_PTR_WRITE     ", log2(_param->_size_queue));
    4138      }
    4239
     40    if (_param->_nb_port_slot>1)
     41      {
     42    vhdl->set_signal  ("reg_NB_ELT           ", log2(_param->_size_queue+1));
     43    vhdl->set_signal  ("signal_NEXT_NB_ELT   ", log2(_param->_size_queue+1));
     44    for (uint32_t i=0; i<_param->_nb_port_slot; ++i)
     45    vhdl->set_signal  ("signal_SLOT_"+toString(i), log2(_param->_size_queue));
     46      }
     47    else
     48      {
     49    if (_param->_size_queue > 1)
     50      {
     51    vhdl->set_signal  ("reg_PTR_WRITE        ", log2(_param->_size_queue));
     52    vhdl->set_signal  ("signal_NEXT_PTR_WRITE", log2(_param->_size_queue));
     53      }
     54    vhdl->set_signal  ("reg_FULL             ", 1);
     55    vhdl->set_signal  ("reg_EMPTY            ", 1);
    4356    vhdl->set_signal  ("signal_NEXT_FULL     ", 1);
    4457    vhdl->set_signal  ("signal_NEXT_EMPTY    ", 1);
    45    
     58    vhdl->set_signal  ("signal_PTR_EQUAL     ", 1);
     59      }
     60
    4661    if (_param->_size_queue > 1)
    4762      {
Note: See TracChangeset for help on using the changeset viewer.