source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Ifetch_unit/Ifetch_queue/src/Ifetch_queue_function_no_assoc_genMoore.cpp @ 145

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

1) Add new algo in ifetch queue
2) Add Cancel bit
3) new config

  • Property svn:keywords set to Id
File size: 3.3 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Ifetch_queue_function_no_assoc_genMoore.cpp 136 2009-10-20 18:52:15Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_Front_end/Front_end/Ifetch_unit/Ifetch_queue/include/Ifetch_queue.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace ifetch_unit {
17namespace ifetch_queue {
18
19#undef  FUNCTION
20#define FUNCTION "Ifetch_queue::function_no_assoc_genMoore"
21  void Ifetch_queue::function_no_assoc_genMoore (void)
22  {
23    log_begin(Ifetch_queue,FUNCTION);
24    log_function(Ifetch_queue,FUNCTION,_name.c_str());
25
26    if (PORT_READ(in_NRESET))
27      {
28    // ==========================================================
29    // =====[ ADDRESS ]==========================================
30    // ==========================================================
31    {
32      internal_ADDRESS_ACK = (_queue[reg_PTR_WRITE]->_state == IFETCH_QUEUE_STATE_EMPTY);
33 
34      log_printf(TRACE,Ifetch_queue,FUNCTION,"  * ADDRESS_ACK : %d",internal_ADDRESS_ACK);
35     
36      if (_param->_have_port_ifetch_queue_ptr)
37      PORT_WRITE(out_ADDRESS_IFETCH_QUEUE_ID, reg_PTR_WRITE);
38    }
39
40    // ==========================================================
41    // =====[ DECOD ]============================================
42    // ==========================================================
43    {
44      bool ack = (_queue[reg_PTR_READ]->_state == IFETCH_QUEUE_STATE_HAVE_RSP);
45
46      Tgeneral_address_t address                       = _queue[reg_PTR_READ]->_address;
47      Tinst_ifetch_ptr_t inst_ifetch_ptr               = _queue[reg_PTR_READ]->_inst_ifetch_ptr;
48      Tbranch_state_t    branch_state                  = _queue[reg_PTR_READ]->_branch_state;
49      Tprediction_ptr_t  branch_update_prediction_id   = _queue[reg_PTR_READ]->_branch_update_prediction_id;
50      Texception_t       exception                     = _queue[reg_PTR_READ]->_exception;
51     
52      for (uint32_t i=0; i<_param->_nb_instruction; i++)
53        {
54          internal_DECOD_VAL [i] = ack and _queue[reg_PTR_READ]->_instruction_enable [i];
55
56          log_printf(TRACE,Ifetch_queue,FUNCTION,"  * DECOD_VAL [%d] : %d",i,internal_DECOD_VAL [i]);
57
58          PORT_WRITE(out_DECOD_INSTRUCTION                [i],_queue[reg_PTR_READ]->_instruction [i]);
59          PORT_WRITE(out_DECOD_ADDRESS                    [i],address+i);
60          if (inst_ifetch_ptr == i)
61            {
62          PORT_WRITE(out_DECOD_BRANCH_STATE               [i],branch_state);
63            }
64          else
65            {
66          PORT_WRITE(out_DECOD_BRANCH_STATE               [i], BRANCH_STATE_NONE);
67            }
68          if (_param->_have_port_depth)
69          PORT_WRITE(out_DECOD_BRANCH_UPDATE_PREDICTION_ID[i],branch_update_prediction_id);
70          PORT_WRITE(out_DECOD_EXCEPTION                  [i],exception); // all is same
71        }
72     
73    }
74      }
75    else
76      {
77        // Reset
78        internal_ADDRESS_ACK = 0;
79        for (uint32_t i=0; i<_param->_nb_instruction; i++)
80          internal_DECOD_VAL [i] = 0;
81       
82      }
83
84    // Write Output
85    PORT_WRITE(out_ADDRESS_ACK  , internal_ADDRESS_ACK);
86    for (uint32_t i=0; i<_param->_nb_instruction; i++)
87    PORT_WRITE(out_DECOD_VAL [i], internal_DECOD_VAL [i]);
88
89    log_end(Ifetch_queue,FUNCTION);
90  };
91
92}; // end namespace ifetch_queue
93}; // end namespace ifetch_unit
94}; // end namespace front_end
95}; // end namespace multi_front_end
96}; // end namespace core
97}; // end namespace behavioural
98}; // end namespace morpheo             
99#endif
Note: See TracBrowser for help on using the repository browser.