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

Last change on this file since 42 was 42, checked in by rosiere, 17 years ago

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

File size: 3.6 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#ifdef POSITION
20    _component   = new Component ();
21
22    Entity * entity = _component->set_entity (_name                  ,
23                                             "Select_Priority_Fixed",
24                                             COMBINATORY            );
25   
26    _interfaces = entity->set_interfaces();
27#else
28    _interfaces = new Interfaces();
29#endif
30
31    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32    {
33      Interface_fifo * interface = _interfaces->set_interface("", IN  ,WEST, "Generalist interface");
34     
35      in_CLOCK        = interface->set_signal_clk              ("clock" ,1);
36      in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1);
37    }
38
39    // ~~~~~[ Interface : "access" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40    {
41       in_ACCESS_VAL     = new SC_IN (Tcontrol_t) * [_param._nb_access];
42      out_ACCESS_ACK     = new SC_OUT(Tcontrol_t) * [_param._nb_access];
43      if (_param._size_table>1)
44       in_ACCESS_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_access];
45      out_ACCESS_ENTITY  = new SC_OUT(Tentity_t ) * [_param._nb_access];
46     
47      for (uint32_t i=0; i<_param._nb_access; i++)
48        {
49          Interface_fifo * interface = _interfaces->set_interface("access_"+toString(i), IN  ,WEST, "Access");
50
51           in_ACCESS_VAL     [i] = interface->set_signal_valack_in        ("val"    , VAL);
52          out_ACCESS_ACK     [i] = interface->set_signal_valack_out       ("ack"    , ACK);
53         
54          if (_param._size_table>1)
55           in_ACCESS_ADDRESS [i] = interface->set_signal_in  <Taddress_t> ("address",static_cast<uint32_t>(log2(_param._size_table)));
56          out_ACCESS_ENTITY  [i] = interface->set_signal_out <Tentity_t>  ("entity" ,static_cast<uint32_t>(log2(_param._nb_entity )));
57        }
58    }
59
60    // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61   
62    {
63       in_UPDATE_VAL     = new SC_IN (Tcontrol_t) *  [_param._nb_update];
64      out_UPDATE_ACK     = new SC_OUT(Tcontrol_t) *  [_param._nb_update];
65      if (_param._size_table>1)
66       in_UPDATE_ADDRESS = new SC_IN (Taddress_t) *  [_param._nb_update];
67       in_UPDATE_ENTITY  = new SC_IN (Tentity_t ) *  [_param._nb_update];
68     
69      for (uint32_t i=0; i<_param._nb_update; i++)
70        {
71          Interface_fifo * interface = _interfaces->set_interface("update_"+toString(i), IN  ,EAST, "Update");
72
73          in_UPDATE_VAL     [i] = interface->set_signal_valack_in        ("val"    , VAL);
74         out_UPDATE_ACK     [i] = interface->set_signal_valack_out       ("ack"    , ACK);
75         if (_param._size_table>1)
76          in_UPDATE_ADDRESS [i] = interface->set_signal_in  <Taddress_t> ("address",static_cast<uint32_t>(log2(_param._size_table)));
77          in_UPDATE_ENTITY  [i] = interface->set_signal_in  <Tentity_t>  ("entity" ,static_cast<uint32_t>(log2(_param._nb_entity )));
78        }
79    }
80    // -----[ Register ]---------------------------------------------------
81    reg_TABLE = new entry_t *  [_param._size_table];
82
83    for (uint32_t i=0; i<_param._size_table; i++)
84      reg_TABLE [i] = new entry_t (_param._nb_entity);
85   
86    // -----[ Internal ]---------------------------------------------------
87    internal_ACCESS_ENTITY = new Tentity_t [_param._nb_entity];
88
89#ifdef POSITION
90    _component->generate_file();
91#endif
92  };
93
94}; // end namespace victim_pseudo_lru
95}; // end namespace victim
96}; // end namespace generic
97
98}; // end namespace behavioural
99}; // end namespace morpheo             
100#endif
Note: See TracBrowser for help on using the repository browser.