1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id: Branch_Target_Buffer_Glue_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_Glue/include/Branch_Target_Buffer_Glue.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_glue { |
---|
19 | |
---|
20 | #undef FUNCTION |
---|
21 | #define FUNCTION "Branch_Target_Buffer_Glue::genMealy_decod" |
---|
22 | void Branch_Target_Buffer_Glue::genMealy_decod (void) |
---|
23 | { |
---|
24 | log_begin(Branch_Target_Buffer_Glue,FUNCTION); |
---|
25 | log_function(Branch_Target_Buffer_Glue,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 | log_printf(TRACE,Branch_Target_Buffer_Glue,FUNCTION," * DECOD [%d]",i); |
---|
32 | Tcontrol_t val = PORT_READ(in_DECOD_VAL [i]); |
---|
33 | Tcontrol_t register_ack = PORT_READ(in_DECOD_REGISTER_ACK [i]); |
---|
34 | Tcontrol_t victim_ack = (_param->_have_port_victim)?PORT_READ(in_DECOD_VICTIM_ACK [i]):true; |
---|
35 | |
---|
36 | log_printf(TRACE,Branch_Target_Buffer_Glue,FUNCTION," * val : %d", val ); |
---|
37 | log_printf(TRACE,Branch_Target_Buffer_Glue,FUNCTION," * register_ack : %d", register_ack); |
---|
38 | log_printf(TRACE,Branch_Target_Buffer_Glue,FUNCTION," * victim_ack : %d", victim_ack ); |
---|
39 | |
---|
40 | PORT_WRITE(out_DECOD_ACK [i], ( |
---|
41 | // val and |
---|
42 | register_ack and |
---|
43 | victim_ack |
---|
44 | )); |
---|
45 | PORT_WRITE(out_DECOD_REGISTER_VAL [i], ( |
---|
46 | val and |
---|
47 | // register_ack and |
---|
48 | victim_ack |
---|
49 | )); |
---|
50 | if (_param->_have_port_victim) |
---|
51 | { |
---|
52 | PORT_WRITE(out_DECOD_VICTIM_VAL [i], ( |
---|
53 | val and |
---|
54 | register_ack // and |
---|
55 | // victim_ack |
---|
56 | )); |
---|
57 | if (not _param->_is_full_associative) |
---|
58 | { |
---|
59 | Tgeneral_data_t address_src = PORT_READ(in_DECOD_ADDRESS_SRC [i]); |
---|
60 | log_printf(TRACE,Branch_Target_Buffer_Glue,FUNCTION," * address_src : %.8x", address_src); |
---|
61 | |
---|
62 | PORT_WRITE(out_DECOD_VICTIM_ADDRESS [i], (address_src >> _param->_shift_bank)&_param->_mask_bank); |
---|
63 | } |
---|
64 | } |
---|
65 | } |
---|
66 | } |
---|
67 | else |
---|
68 | { |
---|
69 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
70 | { |
---|
71 | PORT_WRITE(out_DECOD_ACK [i], 0); |
---|
72 | PORT_WRITE(out_DECOD_REGISTER_VAL [i], 0); |
---|
73 | if (_param->_have_port_victim) |
---|
74 | PORT_WRITE(out_DECOD_VICTIM_VAL [i], 0); |
---|
75 | } |
---|
76 | } |
---|
77 | |
---|
78 | log_end(Branch_Target_Buffer_Glue,FUNCTION); |
---|
79 | }; |
---|
80 | |
---|
81 | }; // end namespace branch_target_buffer_glue |
---|
82 | }; // end namespace branch_target_buffer |
---|
83 | }; // end namespace prediction_unit |
---|
84 | }; // end namespace front_end |
---|
85 | }; // end namespace multi_front_end |
---|
86 | }; // end namespace core |
---|
87 | }; // end namespace behavioural |
---|
88 | }; // end namespace morpheo |
---|
89 | #endif |
---|