source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Reservation_station/src/Reservation_station_genMoore.cpp @ 123

Last change on this file since 123 was 123, checked in by rosiere, 15 years ago

1) Fix performance
2) add auto generation to SPECINT2000
3) add reset in genMoore and genMealy

  • Property svn:keywords set to Id
File size: 5.5 KB
Line 
1#ifdef SYSTEMC
2//#if defined(STATISTICS) or defined(VHDL_TESTBENCH)
3/*
4 * $Id: Reservation_station_genMoore.cpp 123 2009-06-08 20:43:30Z rosiere $
5 *
6 * [ Description ]
7 *
8 */
9
10#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Reservation_station/include/Reservation_station.h"
11
12namespace morpheo                    {
13namespace behavioural {
14namespace core {
15namespace multi_execute_loop {
16namespace execute_loop {
17namespace multi_read_unit {
18namespace read_unit {
19namespace reservation_station {
20
21
22#undef  FUNCTION
23#define FUNCTION "Reservation_station::genMoore"
24  void Reservation_station::genMoore (void)
25  {
26    log_begin(Reservation_station,FUNCTION);
27    log_function(Reservation_station,FUNCTION,_name.c_str());
28
29    if (PORT_READ(in_NRESET))
30      {
31    // ~~~~~[ Interface "insert" ]~~~~~~~~~~~~~~~~~~~~~~~~
32   
33    // accept a new instructions when reservation_station is not full
34#ifdef  SYSTEMC_VHDL_COMPATIBILITY
35    for (internal_INSERT_SLOT=0; (internal_INSERT_SLOT<_param->_size_queue) and (_queue_valid[internal_INSERT_SLOT]==true); internal_INSERT_SLOT++);
36    internal_INSERT_ACK = (internal_INSERT_SLOT<_param->_size_queue);
37#else
38    internal_INSERT_ACK = not _queue_control->full();
39#endif   
40
41    // ~~~~~[ Interface "retire" ]~~~~~~~~~~~~~~~~~~~~~~~
42
43    uint32_t index_queue=0;
44    const uint32_t nb_slot_scan = _param->_size_queue-_param->_nb_inst_retire+1;
45
46    for (uint32_t i=0; i<_param->_nb_inst_retire; i++)
47      {
48        bool     val        = false;
49        uint32_t index_find = 0;
50
51        log_printf(TRACE,Reservation_station,FUNCTION,"  * RETIRE [%d]",i);
52
53        for (; (
54#ifndef  SYSTEMC_VHDL_COMPATIBILITY
55                (index_queue<_queue_control->nb_elt()) and
56#endif
57                (index_queue>=i) and
58                (index_queue<nb_slot_scan+i) and
59                (val==false));
60             index_queue++)
61          {
62#ifdef  SYSTEMC_VHDL_COMPATIBILITY
63            index_find = index_queue;
64#else
65            index_find = (*_queue_control)[index_queue];
66#endif
67            internal_RETIRE_SLOT [i] = index_queue;
68
69            val   = 
70              (
71#ifdef  SYSTEMC_VHDL_COMPATIBILITY
72               _queue_valid [index_queue] and
73#endif
74               _queue[index_find]._data_ra_val and
75               _queue[index_find]._data_rb_val and
76               _queue[index_find]._data_rc_val
77               );
78
79            log_printf(
80#ifdef  SYSTEMC_VHDL_COMPATIBILITY
81                       TRACE,Reservation_station,FUNCTION,"    [%d] valid : %d, data ra %d, rb %d, rc %d - %d",
82                       index_find,
83                       _queue_valid [index_queue],
84#else
85                       TRACE,Reservation_station,FUNCTION,"    [%d] data ra %d, rb %d, rc %d - %d",
86                       index_find,
87#endif
88                       _queue[index_find]._data_ra_val,
89                       _queue[index_find]._data_rb_val,
90                       _queue[index_find]._data_rc_val,
91                       val);
92          }
93
94        internal_RETIRE_VAL [i] = val;
95
96        if (val)
97          {
98
99// #ifdef  SYSTEMC_VHDL_COMPATIBILITY
100//          index_find = internal_RETIRE_SLOT [i];
101// #else
102//          index_find = (*_queue_control)[internal_RETIRE_SLOT [i]];
103// #endif
104            if (_param->_have_port_context_id)
105            PORT_WRITE(out_RETIRE_CONTEXT_ID    [i],_queue[index_find]._context_id);
106            if (_param->_have_port_front_end_id)
107            PORT_WRITE(out_RETIRE_FRONT_END_ID  [i],_queue[index_find]._front_end_id);
108            if (_param->_have_port_ooo_engine_id)
109            PORT_WRITE(out_RETIRE_OOO_ENGINE_ID [i],_queue[index_find]._ooo_engine_id);
110            if (_param->_have_port_rob_ptr)
111            PORT_WRITE(out_RETIRE_ROB_ID        [i],_queue[index_find]._rob_id);
112            PORT_WRITE(out_RETIRE_OPERATION     [i],_queue[index_find]._operation);
113            PORT_WRITE(out_RETIRE_TYPE          [i],_queue[index_find]._type);
114            PORT_WRITE(out_RETIRE_STORE_QUEUE_PTR_WRITE [i],_queue[index_find]._store_queue_ptr_write);
115            PORT_WRITE(out_RETIRE_STORE_QUEUE_PTR_READ  [i],_queue[index_find]._store_queue_ptr_read );
116            PORT_WRITE(out_RETIRE_STORE_QUEUE_EMPTY     [i],_queue[index_find]._store_queue_empty    );
117            if (_param->_have_port_load_queue_ptr)
118            PORT_WRITE(out_RETIRE_LOAD_QUEUE_PTR_WRITE  [i],_queue[index_find]._load_queue_ptr_write );
119            PORT_WRITE(out_RETIRE_HAS_IMMEDIAT  [i],_queue[index_find]._has_immediat);
120            PORT_WRITE(out_RETIRE_IMMEDIAT      [i],_queue[index_find]._immediat);
121            PORT_WRITE(out_RETIRE_DATA_RA       [i],_queue[index_find]._data_ra);
122            PORT_WRITE(out_RETIRE_DATA_RB       [i],_queue[index_find]._data_rb);
123            PORT_WRITE(out_RETIRE_DATA_RC       [i],_queue[index_find]._data_rc);
124            PORT_WRITE(out_RETIRE_WRITE_RD      [i],_queue[index_find]._write_rd);
125            PORT_WRITE(out_RETIRE_NUM_REG_RD    [i],_queue[index_find]._num_reg_rd);
126            PORT_WRITE(out_RETIRE_WRITE_RE      [i],_queue[index_find]._write_re);
127            PORT_WRITE(out_RETIRE_NUM_REG_RE    [i],_queue[index_find]._num_reg_re);
128          }
129      }
130      }
131    else
132      {
133        // Reset
134        internal_INSERT_ACK = 0;
135        // internal_INSERT_SLOT
136       
137        for (uint32_t i=0; i<_param->_nb_inst_retire; i++)
138          {
139            internal_RETIRE_VAL [i] = 0;
140            // internal_RETIRE_SLOT [i];
141          }
142      }
143
144    // Write Output
145    PORT_WRITE(out_INSERT_ACK    , internal_INSERT_ACK);
146    for (uint32_t i=0; i<_param->_nb_inst_retire; i++)
147    PORT_WRITE(out_RETIRE_VAL [i], internal_RETIRE_VAL [i]);
148
149    log_end(Reservation_station,FUNCTION);
150  };
151
152}; // end namespace reservation_station
153}; // end namespace read_unit
154}; // end namespace multi_read_unit
155}; // end namespace execute_loop
156}; // end namespace multi_execute_loop
157}; // end namespace core
158
159}; // end namespace behavioural
160}; // end namespace morpheo             
161#endif
162//#endif
Note: See TracBrowser for help on using the repository browser.