source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/src/Return_Address_Stack_genMealy_decod.cpp @ 118

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

1) Stat List : scan all queue to find free register
2) Write_queue : test "genMealy" add bypass [0]
3) Functionnal_unit : add const parameters to add or not the pipeline_in
4) Load Store Unit : if load make an exception, free nb_check
5) Debug, change test to add model

  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Return_Address_Stack_genMealy_decod.cpp 118 2009-05-20 22:01:32Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack/include/Return_Address_Stack.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace prediction_unit {
17namespace return_address_stack {
18
19
20#undef  FUNCTION
21#define FUNCTION "Return_Address_Stack::genMealy_decod"
22  void Return_Address_Stack::genMealy_decod (void)
23  {
24    log_begin(Return_Address_Stack,FUNCTION);
25    log_function(Return_Address_Stack,FUNCTION,_name.c_str());
26
27    if (PORT_READ(in_NRESET) == 1)
28      {
29#ifdef DEBUG_TEST
30    // just to test if have many transaction on a same context
31    bool context_valid [_param->_nb_context];
32    for (uint32_t i=0; i<_param->_nb_context; i++)
33      context_valid [i] = true;
34#endif
35
36    for (uint32_t i=0; i<_param->_nb_inst_decod; i++)
37      {
38        // Read context number
39        Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_DECOD_CONTEXT_ID [i]):0;
40
41#ifdef DEBUG_TEST
42        if (PORT_READ(in_DECOD_VAL [i]))
43          {
44            if (context_valid[context] == false)
45              ERRORMORPHEO(FUNCTION,"Can't have 2 transactions with the same context_id");
46            context_valid[context] = false;
47          }
48#endif
49
50        Tptr_t     top  = reg_TOP[context];
51        Tcontrol_t push = PORT_READ(in_DECOD_PUSH [i]);
52
53        // if push : value is hit
54        // if pop  : val and not miss
55        //   when the predictor : if hit = 0, wait (is not accurate)
56        internal_DECOD_HIT [i] = (push or (reg_NB_ELT[context]>0));
57        PORT_WRITE(out_DECOD_HIT         [i], internal_DECOD_HIT [i]);
58
59        // if pop  : address_pop   = stack [top]
60        // if push : stock [top+1] = address_push; also stock [top+1] is erase ! give the old value at the update table
61        if (push)
62          top = (top+1)%_param->_size_queue[context];
63
64        PORT_WRITE(out_DECOD_ADDRESS_POP [i], reg_stack[context][top]._address);
65        PORT_WRITE(out_DECOD_INDEX       [i], top);
66      }
67      }
68    log_end(Return_Address_Stack,FUNCTION);
69  };
70
71}; // end namespace return_address_stack
72}; // end namespace prediction_unit
73}; // end namespace front_end
74}; // end namespace multi_front_end
75}; // end namespace core
76}; // end namespace behavioural
77}; // end namespace morpheo             
78#endif
Note: See TracBrowser for help on using the repository browser.