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_update.cpp @ 88

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

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Branch_Target_Buffer_Register_genMealy_update.cpp 88 2008-12-10 18:31:39Z 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_update"
22  void Branch_Target_Buffer_Register::genMealy_update (void)
23  {
24    log_begin(Branch_Target_Buffer_Register,FUNCTION);
25    log_function(Branch_Target_Buffer_Register,FUNCTION,_name.c_str());
26
27    for (uint32_t i=0; i<_param->_nb_inst_update; i++)
28      {
29        Tcontext_t      context   = (_param->_have_port_context_id)?PORT_READ(in_UPDATE_CONTEXT_ID  [i]):0;
30        Tgeneral_data_t address   = PORT_READ(in_UPDATE_ADDRESS_SRC [i]);
31
32        Tcontrol_t      hit       = false;
33        uint32_t        num_bank  = (address>>_param->_shift_bank)&_param->_mask_bank;
34        uint32_t        num_entry = 0;
35       
36        if (PORT_READ(in_UPDATE_VAL [i]))
37          for (;num_entry < _param->_associativity; num_entry ++)
38            {
39              hit = ((reg_BTB[num_bank][num_entry]._val         == 1      ) and
40                     (reg_BTB[num_bank][num_entry]._context     == context) and
41                     (reg_BTB[num_bank][num_entry]._address_src == address));
42
43              if (hit)
44                break;
45            }
46
47        internal_UPDATE_HIT       [i] = hit      ;
48        internal_UPDATE_NUM_BANK  [i] = num_bank ;
49        internal_UPDATE_NUM_ENTRY [i] = num_entry;
50
51        if (_param->_have_port_victim)
52          {
53        PORT_WRITE(out_UPDATE_HIT [i], hit);
54        PORT_WRITE(out_UPDATE_HIT_INDEX [i], num_entry);
55          }
56      }
57
58    log_end(Branch_Target_Buffer_Register,FUNCTION);
59  };
60
61}; // end namespace branch_target_buffer_register
62}; // end namespace branch_target_buffer
63}; // end namespace prediction_unit
64}; // end namespace front_end
65}; // end namespace multi_front_end
66}; // end namespace core
67
68}; // end namespace behavioural
69}; // end namespace morpheo             
70#endif
Note: See TracBrowser for help on using the repository browser.