source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer/Branch_Target_Buffer_Register/src/Branch_Target_Buffer_Register_genMealy_decod.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: 2.2 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Branch_Target_Buffer_Register_genMealy_decod.cpp 123 2009-06-08 20:43:30Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer/Branch_Target_Buffer_Register/include/Branch_Target_Buffer_Register.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace prediction_unit {
17namespace branch_target_buffer {
18namespace branch_target_buffer_register {
19
20#undef  FUNCTION
21#define FUNCTION "Branch_Target_Buffer_Register::genMealy_decod"
22  void Branch_Target_Buffer_Register::genMealy_decod (void)
23  {
24    log_begin(Branch_Target_Buffer_Register,FUNCTION);
25    log_function(Branch_Target_Buffer_Register,FUNCTION,_name.c_str());
26
27    if (PORT_READ(in_NRESET))
28      {
29    for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
30      {
31        Tcontext_t      context   = (_param->_have_port_context_id)?PORT_READ(in_DECOD_CONTEXT_ID  [i]):0;
32        Tgeneral_data_t address   = PORT_READ(in_DECOD_ADDRESS_SRC [i]);
33
34        Tcontrol_t      hit       = false;
35        uint32_t        num_bank  = (address>>_param->_shift_bank)&_param->_mask_bank;
36        uint32_t        num_entry = 0;
37       
38        if (PORT_READ(in_DECOD_VAL [i]))
39          for (;num_entry < _param->_associativity; num_entry ++)
40            {
41              hit = ((reg_BTB[num_bank][num_entry]._val         == 1      ) and
42                     (reg_BTB[num_bank][num_entry]._context     == context) and
43                     (reg_BTB[num_bank][num_entry]._address_src == address));
44
45              if (hit)
46                break;
47            }
48
49        internal_DECOD_HIT       [i] = hit      ;
50        internal_DECOD_NUM_BANK  [i] = num_bank ;
51        internal_DECOD_NUM_ENTRY [i] = num_entry;
52
53        if (_param->_have_port_victim)
54          {
55        PORT_WRITE(out_DECOD_HIT       [i], hit);
56        PORT_WRITE(out_DECOD_HIT_INDEX [i], num_entry);
57          }
58      }
59      }
60    else
61      {
62//      internal_DECOD_HIT       [i] = hit      ;
63//      internal_DECOD_NUM_BANK  [i] = num_bank ;
64//      internal_DECOD_NUM_ENTRY [i] = num_entry;
65      }
66   
67    log_end(Branch_Target_Buffer_Register,FUNCTION);
68  };
69
70}; // end namespace branch_target_buffer_register
71}; // end namespace branch_target_buffer
72}; // end namespace prediction_unit
73}; // end namespace front_end
74}; // end namespace multi_front_end
75}; // end namespace core
76
77}; // end namespace behavioural
78}; // end namespace morpheo             
79#endif
Note: See TracBrowser for help on using the repository browser.