source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/src/Parameters.cpp @ 88

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

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 5.2 KB
Line 
1/*
2 * $Id: Parameters.cpp 88 2008-12-10 18:31:39Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/include/Parameters.h"
9#include "Common/include/Max.h"
10#include "Common/include/BitManipulation.h"
11
12namespace morpheo {
13namespace behavioural {
14namespace core {
15namespace multi_ooo_engine {
16namespace ooo_engine {
17namespace commit_unit {
18
19
20#undef  FUNCTION
21#define FUNCTION "Commit_unit::Parameters"
22  Parameters::Parameters (uint32_t            nb_front_end            ,
23                          uint32_t          * nb_context              ,
24                          uint32_t            nb_rename_unit          ,
25                          uint32_t            size_queue              ,
26                          uint32_t            nb_bank                 ,
27                          uint32_t          * nb_inst_insert          ,
28                          uint32_t          * nb_inst_retire          ,
29                          uint32_t            nb_inst_commit          ,
30                          uint32_t            nb_inst_reexecute       ,
31                          uint32_t            nb_inst_branch_complete ,
32                          uint32_t         ** nb_branch_speculated    ,
33                          uint32_t            size_general_data       ,
34                          uint32_t            size_store_queue_ptr    ,
35                          uint32_t            size_load_queue_ptr     ,
36                          uint32_t            size_general_register   ,
37                          uint32_t            size_special_register   ,
38                          Tpriority_t         priority                ,
39                          Tload_balancing_t   load_balancing          ,
40                          uint32_t            nb_rename_unit_select   ,
41                          bool                is_toplevel):
42    _nb_bank_access_commit (1              ),
43    _retire_ooo            (RETIRE_IN_ORDER)
44  {
45    log_begin(Commit_unit,FUNCTION);
46
47    _nb_front_end             = nb_front_end           ;
48    _nb_context               = nb_context             ;
49    _nb_rename_unit           = nb_rename_unit         ;
50    _size_queue               = size_queue             ;
51    _nb_bank                  = nb_bank                ;
52    _nb_inst_insert           = nb_inst_insert         ;
53    _nb_inst_retire           = nb_inst_retire         ;
54    _nb_inst_commit           = nb_inst_commit         ;
55    _nb_inst_reexecute        = nb_inst_reexecute      ;
56    _nb_inst_branch_complete  = nb_inst_branch_complete;
57    _nb_branch_speculated     = nb_branch_speculated   ;
58    _priority                 = priority               ;
59    _load_balancing           = load_balancing         ;
60    _nb_rename_unit_select    = nb_rename_unit_select  ;
61
62    _size_rename_unit_id      = log2(_nb_rename_unit);
63    _max_nb_context           = max<uint32_t>(_nb_context,_nb_front_end);
64    _max_nb_inst_insert       = max<uint32_t>(_nb_inst_insert,_nb_rename_unit);
65    _max_nb_inst_retire       = max<uint32_t>(_nb_inst_retire,_nb_rename_unit);
66    _size_bank                = _size_queue/_nb_bank;
67    _shift_num_bank           = log2(_size_bank);
68    _mask_size_bank           = gen_mask<Tpacket_t>(log2(_size_bank));
69
70    _have_port_rename_unit_id = _size_rename_unit_id > 0;
71
72    _array_size_depth               = new uint32_t * [_nb_front_end];
73    for (uint32_t i=0; i<_nb_front_end; i++)
74      {
75        _array_size_depth      [i]      = new uint32_t [_nb_context [i]];
76        for (uint32_t j=0; j<_nb_context [i]; j++)
77          _array_size_depth      [i][j] = (_nb_branch_speculated [i][j] == 0)?0:log2(_nb_branch_speculated [i][j]);
78      }
79
80    test();
81
82    if (is_toplevel)
83      {
84        _size_front_end_id        = log2(_nb_front_end);
85        _size_context_id          = log2(_max_nb_context);
86        _size_rob_ptr             = log2(_nb_bank)+log2(_size_bank);
87        _size_instruction_address = size_general_data-2;
88        _size_store_queue_ptr     = size_store_queue_ptr   ;
89        _size_load_queue_ptr      = size_load_queue_ptr    ;
90        _size_general_data        = size_general_data      ;
91        _size_general_register    = size_general_register  ;
92        _size_special_register    = size_special_register  ;
93        _size_depth               = max<uint32_t>(_array_size_depth,_nb_front_end,_nb_context);
94        _size_nb_inst_commit      = log2(_size_queue)+1;
95       
96        _have_port_front_end_id   = _size_front_end_id   > 0;
97        _have_port_context_id     = _size_context_id     > 0;
98        _have_port_rob_ptr        = _size_rob_ptr        > 0;
99        _have_port_load_queue_ptr = _size_load_queue_ptr > 0;
100        _have_port_depth          = _size_depth          > 0;
101       
102        copy();
103      }
104
105    log_end(Commit_unit,FUNCTION);
106  };
107 
108// #undef  FUNCTION
109// #define FUNCTION "Commit_unit::Parameters (copy)"
110//   Parameters::Parameters (Parameters & param)
111//   {
112//     log_begin(Commit_unit,FUNCTION);
113//     test();
114//     log_end(Commit_unit,FUNCTION);
115//   };
116
117#undef  FUNCTION
118#define FUNCTION "Commit_unit::~Parameters"
119  Parameters::~Parameters (void) 
120  {
121    log_begin(Commit_unit,FUNCTION);
122
123    for (uint32_t i=0; i<_nb_front_end; i++)
124      {
125        delete [] _array_size_depth [i];
126      }
127    delete [] _array_size_depth;
128
129    log_end(Commit_unit,FUNCTION);
130  };
131
132#undef  FUNCTION
133#define FUNCTION "Commit_unit::copy"
134  void Parameters::copy (void) 
135  {
136    log_begin(Commit_unit,FUNCTION);
137    log_end(Commit_unit,FUNCTION);
138  };
139
140}; // end namespace commit_unit
141}; // end namespace ooo_engine
142}; // end namespace multi_ooo_engine
143}; // end namespace core
144
145}; // end namespace behavioural
146}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.