source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Victim_Pseudo_LRU_allocation.cpp @ 75

Last change on this file since 75 was 75, checked in by rosiere, 16 years ago

Update all component (except front_end) to :

  • new statistics model
  • no namespace std
File size: 3.7 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id$
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Generic/Victim/Victim_Pseudo_LRU/include/Victim_Pseudo_LRU.h"
10
11namespace morpheo {
12namespace behavioural {
13namespace generic {
14namespace victim {
15namespace victim_pseudo_lru {
16
17  void Victim_Pseudo_LRU::allocation (void)
18  {
19    _component   = new Component ();
20
21    Entity * entity = _component->set_entity (_name                 
22                                              ,"Select_Priority_Fixed"
23#ifdef POSITION
24                                              ,COMBINATORY           
25#endif
26                                              );
27   
28    _interfaces = entity->set_interfaces();
29
30    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31    {
32      Interface_fifo * interface = _interfaces->set_interface(""
33#ifdef POSITION
34                                                              , IN  ,WEST, "Generalist interface"
35#endif
36                                                              );
37     
38      in_CLOCK        = interface->set_signal_clk              ("clock" ,1);
39      in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1);
40    }
41
42    // ~~~~~[ Interface : "access" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43    {
44       in_ACCESS_VAL     = new SC_IN (Tcontrol_t) * [_param._nb_access];
45      out_ACCESS_ACK     = new SC_OUT(Tcontrol_t) * [_param._nb_access];
46      if (_param._size_table>1)
47       in_ACCESS_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_access];
48      out_ACCESS_ENTITY  = new SC_OUT(Tentity_t ) * [_param._nb_access];
49     
50      for (uint32_t i=0; i<_param._nb_access; i++)
51        {
52          Interface_fifo * interface = _interfaces->set_interface("access_"+toString(i)
53#ifdef POSITION
54                                                                  , IN  ,WEST, "Access"
55#endif
56                                                                  );
57
58           in_ACCESS_VAL     [i] = interface->set_signal_valack_in        ("val"    , VAL);
59          out_ACCESS_ACK     [i] = interface->set_signal_valack_out       ("ack"    , ACK);
60         
61          if (_param._size_table>1)
62           in_ACCESS_ADDRESS [i] = interface->set_signal_in  <Taddress_t> ("address",static_cast<uint32_t>(log2(_param._size_table)));
63          out_ACCESS_ENTITY  [i] = interface->set_signal_out <Tentity_t>  ("entity" ,static_cast<uint32_t>(log2(_param._nb_entity )));
64        }
65    }
66
67    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68   
69    {
70       in_UPDATE_VAL     = new SC_IN (Tcontrol_t) *  [_param._nb_update];
71      out_UPDATE_ACK     = new SC_OUT(Tcontrol_t) *  [_param._nb_update];
72      if (_param._size_table>1)
73       in_UPDATE_ADDRESS = new SC_IN (Taddress_t) *  [_param._nb_update];
74       in_UPDATE_ENTITY  = new SC_IN (Tentity_t ) *  [_param._nb_update];
75     
76      for (uint32_t i=0; i<_param._nb_update; i++)
77        {
78          Interface_fifo * interface = _interfaces->set_interface("update_"+toString(i)
79#ifdef POSITION
80                                                                  , IN  ,EAST, "Update"
81#endif
82                                                                  );
83
84          in_UPDATE_VAL     [i] = interface->set_signal_valack_in        ("val"    , VAL);
85         out_UPDATE_ACK     [i] = interface->set_signal_valack_out       ("ack"    , ACK);
86         if (_param._size_table>1)
87          in_UPDATE_ADDRESS [i] = interface->set_signal_in  <Taddress_t> ("address",static_cast<uint32_t>(log2(_param._size_table)));
88          in_UPDATE_ENTITY  [i] = interface->set_signal_in  <Tentity_t>  ("entity" ,static_cast<uint32_t>(log2(_param._nb_entity )));
89        }
90    }
91    // -----[ Register ]---------------------------------------------------
92    reg_TABLE = new entry_t *  [_param._size_table];
93
94    for (uint32_t i=0; i<_param._size_table; i++)
95      reg_TABLE [i] = new entry_t (_param._nb_entity);
96   
97    // -----[ Internal ]---------------------------------------------------
98    internal_ACCESS_ENTITY = new Tentity_t [_param._nb_entity];
99
100#ifdef POSITION
101    _component->generate_file();
102#endif
103  };
104
105}; // end namespace victim_pseudo_lru
106}; // end namespace victim
107}; // end namespace generic
108
109}; // end namespace behavioural
110}; // end namespace morpheo             
111#endif
Note: See TracBrowser for help on using the repository browser.