1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id: Branch_Target_Buffer_Register_genMealy_decod.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 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace core { |
---|
14 | namespace multi_front_end { |
---|
15 | namespace front_end { |
---|
16 | namespace prediction_unit { |
---|
17 | namespace branch_target_buffer { |
---|
18 | namespace 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 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
28 | { |
---|
29 | Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_DECOD_CONTEXT_ID [i]):0; |
---|
30 | Tgeneral_data_t address = PORT_READ(in_DECOD_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_DECOD_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_DECOD_HIT [i] = hit ; |
---|
48 | internal_DECOD_NUM_BANK [i] = num_bank ; |
---|
49 | internal_DECOD_NUM_ENTRY [i] = num_entry; |
---|
50 | |
---|
51 | if (_param->_have_port_victim) |
---|
52 | { |
---|
53 | PORT_WRITE(out_DECOD_HIT [i], hit); |
---|
54 | PORT_WRITE(out_DECOD_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 |
---|