StateMachine.py (7805:f249937228b5) StateMachine.py (7832:de7601e6e19d)
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
2# Copyright (c) 2009 The Hewlett-Packard Development Company
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 324 unchanged lines hidden (view full) ---

333
334 code('''
335/** \\file $c_ident.cc
336 *
337 * Auto generated C++ code started by $__file__:$__line__
338 * Created by slicc definition of Module "${{self.short}}"
339 */
340
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
2# Copyright (c) 2009 The Hewlett-Packard Development Company
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 324 unchanged lines hidden (view full) ---

333
334 code('''
335/** \\file $c_ident.cc
336 *
337 * Auto generated C++ code started by $__file__:$__line__
338 * Created by slicc definition of Module "${{self.short}}"
339 */
340
341#include <cassert>
341#include <sstream>
342#include <string>
343
344#include "base/cprintf.hh"
345#include "mem/protocol/${ident}_Controller.hh"
346#include "mem/protocol/${ident}_State.hh"
347#include "mem/protocol/${ident}_Event.hh"
348#include "mem/protocol/Types.hh"

--- 406 unchanged lines hidden (view full) ---

755
756 code = self.symtab.codeFormatter()
757 ident = self.ident
758
759 code('''
760// Auto generated C++ code started by $__file__:$__line__
761// ${ident}: ${{self.short}}
762
342#include <sstream>
343#include <string>
344
345#include "base/cprintf.hh"
346#include "mem/protocol/${ident}_Controller.hh"
347#include "mem/protocol/${ident}_State.hh"
348#include "mem/protocol/${ident}_Event.hh"
349#include "mem/protocol/Types.hh"

--- 406 unchanged lines hidden (view full) ---

756
757 code = self.symtab.codeFormatter()
758 ident = self.ident
759
760 code('''
761// Auto generated C++ code started by $__file__:$__line__
762// ${ident}: ${{self.short}}
763
764#include <cassert>
765
763#include "base/misc.hh"
764#include "mem/ruby/common/Global.hh"
765#include "mem/ruby/slicc_interface/RubySlicc_includes.hh"
766#include "mem/protocol/${ident}_Controller.hh"
767#include "mem/protocol/${ident}_State.hh"
768#include "mem/protocol/${ident}_Event.hh"
769#include "mem/protocol/Types.hh"
770#include "mem/ruby/system/System.hh"

--- 53 unchanged lines hidden (view full) ---

824
825 code = self.symtab.codeFormatter()
826 ident = self.ident
827
828 code('''
829// Auto generated C++ code started by $__file__:$__line__
830// ${ident}: ${{self.short}}
831
766#include "base/misc.hh"
767#include "mem/ruby/common/Global.hh"
768#include "mem/ruby/slicc_interface/RubySlicc_includes.hh"
769#include "mem/protocol/${ident}_Controller.hh"
770#include "mem/protocol/${ident}_State.hh"
771#include "mem/protocol/${ident}_Event.hh"
772#include "mem/protocol/Types.hh"
773#include "mem/ruby/system/System.hh"

--- 53 unchanged lines hidden (view full) ---

827
828 code = self.symtab.codeFormatter()
829 ident = self.ident
830
831 code('''
832// Auto generated C++ code started by $__file__:$__line__
833// ${ident}: ${{self.short}}
834
835#include <cassert>
836
832#include "base/misc.hh"
837#include "base/misc.hh"
838#include "base/trace.hh"
833#include "mem/ruby/common/Global.hh"
834#include "mem/protocol/${ident}_Controller.hh"
835#include "mem/protocol/${ident}_State.hh"
836#include "mem/protocol/${ident}_Event.hh"
837#include "mem/protocol/Types.hh"
838#include "mem/ruby/system/System.hh"
839
840#define HASH_FUN(state, event) ((int(state)*${ident}_Event_NUM)+int(event))

--- 17 unchanged lines hidden (view full) ---

858
859 TransitionResult result =
860 doTransitionWorker(event, state, next_state, addr);
861
862 if (result == TransitionResult_Valid) {
863 DPRINTF(RubyGenerated, "next_state: %s\\n",
864 ${ident}_State_to_string(next_state));
865 m_profiler.countTransition(state, event);
839#include "mem/ruby/common/Global.hh"
840#include "mem/protocol/${ident}_Controller.hh"
841#include "mem/protocol/${ident}_State.hh"
842#include "mem/protocol/${ident}_Event.hh"
843#include "mem/protocol/Types.hh"
844#include "mem/ruby/system/System.hh"
845
846#define HASH_FUN(state, event) ((int(state)*${ident}_Event_NUM)+int(event))

--- 17 unchanged lines hidden (view full) ---

864
865 TransitionResult result =
866 doTransitionWorker(event, state, next_state, addr);
867
868 if (result == TransitionResult_Valid) {
869 DPRINTF(RubyGenerated, "next_state: %s\\n",
870 ${ident}_State_to_string(next_state));
871 m_profiler.countTransition(state, event);
866 if (Debug::getProtocolTrace()) {
867 g_system_ptr->getProfiler()->profileTransition("${ident}",
868 m_version, addr,
869 ${ident}_State_to_string(state),
870 ${ident}_Event_to_string(event),
871 ${ident}_State_to_string(next_state),
872 GET_TRANSITION_COMMENT());
873 }
874 CLEAR_TRANSITION_COMMENT();
875 ${ident}_setState(addr, next_state);
872 DPRINTFR(ProtocolTrace, "%7d %3s %10s%20s %6s>%-6s %s %s\\n",
873 g_eventQueue_ptr->getTime(), m_version, "${ident}",
874 ${ident}_Event_to_string(event),
875 ${ident}_State_to_string(state),
876 ${ident}_State_to_string(next_state),
877 addr, GET_TRANSITION_COMMENT());
876
878
879 CLEAR_TRANSITION_COMMENT();
880 ${ident}_setState(addr, next_state);
877 } else if (result == TransitionResult_ResourceStall) {
881 } else if (result == TransitionResult_ResourceStall) {
878 if (Debug::getProtocolTrace()) {
879 g_system_ptr->getProfiler()->profileTransition("${ident}",
880 m_version, addr,
881 ${ident}_State_to_string(state),
882 ${ident}_Event_to_string(event),
883 ${ident}_State_to_string(next_state),
884 "Resource Stall");
885 }
882 DPRINTFR(ProtocolTrace, "%7s %3s %10s%20s %6s>%-6s %s %s\\n",
883 g_eventQueue_ptr->getTime(), m_version, "${ident}",
884 ${ident}_Event_to_string(event),
885 ${ident}_State_to_string(state),
886 ${ident}_State_to_string(next_state),
887 addr, "Resource Stall");
886 } else if (result == TransitionResult_ProtocolStall) {
887 DPRINTF(RubyGenerated, "stalling\\n");
888 } else if (result == TransitionResult_ProtocolStall) {
889 DPRINTF(RubyGenerated, "stalling\\n");
888 if (Debug::getProtocolTrace()) {
889 g_system_ptr->getProfiler()->profileTransition("${ident}",
890 m_version, addr,
891 ${ident}_State_to_string(state),
892 ${ident}_Event_to_string(event),
893 ${ident}_State_to_string(next_state),
894 "Protocol Stall");
895 }
890 DPRINTFR(ProtocolTrace, "%7s %3s %10s%20s %6s>%-6s %s %s\\n",
891 g_eventQueue_ptr->getTime(), m_version, "${ident}",
892 ${ident}_Event_to_string(event),
893 ${ident}_State_to_string(state),
894 ${ident}_State_to_string(next_state),
895 addr, "Protocol Stall");
896 }
897
898 return result;
899}
900
901TransitionResult
902${ident}_Controller::doTransitionWorker(${ident}_Event event,
903 ${ident}_State state,

--- 84 unchanged lines hidden (view full) ---

988
989 code('''
990// Auto generated C++ code started by $__file__:$__line__
991// ${ident}: ${{self.short}}
992
993#ifndef __${ident}_PROFILE_DUMPER_HH__
994#define __${ident}_PROFILE_DUMPER_HH__
995
896 }
897
898 return result;
899}
900
901TransitionResult
902${ident}_Controller::doTransitionWorker(${ident}_Event event,
903 ${ident}_State state,

--- 84 unchanged lines hidden (view full) ---

988
989 code('''
990// Auto generated C++ code started by $__file__:$__line__
991// ${ident}: ${{self.short}}
992
993#ifndef __${ident}_PROFILE_DUMPER_HH__
994#define __${ident}_PROFILE_DUMPER_HH__
995
996#include <cassert>
996#include <iostream>
997#include <vector>
998
999#include "${ident}_Profiler.hh"
1000#include "${ident}_Event.hh"
1001
1002typedef std::vector<${ident}_Profiler *> ${ident}_profilers;
1003

--- 79 unchanged lines hidden (view full) ---

1083
1084 code('''
1085// Auto generated C++ code started by $__file__:$__line__
1086// ${ident}: ${{self.short}}
1087
1088#ifndef __${ident}_PROFILER_HH__
1089#define __${ident}_PROFILER_HH__
1090
997#include <iostream>
998#include <vector>
999
1000#include "${ident}_Profiler.hh"
1001#include "${ident}_Event.hh"
1002
1003typedef std::vector<${ident}_Profiler *> ${ident}_profilers;
1004

--- 79 unchanged lines hidden (view full) ---

1084
1085 code('''
1086// Auto generated C++ code started by $__file__:$__line__
1087// ${ident}: ${{self.short}}
1088
1089#ifndef __${ident}_PROFILER_HH__
1090#define __${ident}_PROFILER_HH__
1091
1092#include <cassert>
1091#include <iostream>
1092
1093#include "mem/ruby/common/Global.hh"
1094#include "mem/protocol/${ident}_State.hh"
1095#include "mem/protocol/${ident}_Event.hh"
1096
1097class ${ident}_Profiler
1098{

--- 21 unchanged lines hidden (view full) ---

1120 def printProfilerCC(self, path):
1121 code = self.symtab.codeFormatter()
1122 ident = self.ident
1123
1124 code('''
1125// Auto generated C++ code started by $__file__:$__line__
1126// ${ident}: ${{self.short}}
1127
1093#include <iostream>
1094
1095#include "mem/ruby/common/Global.hh"
1096#include "mem/protocol/${ident}_State.hh"
1097#include "mem/protocol/${ident}_Event.hh"
1098
1099class ${ident}_Profiler
1100{

--- 21 unchanged lines hidden (view full) ---

1122 def printProfilerCC(self, path):
1123 code = self.symtab.codeFormatter()
1124 ident = self.ident
1125
1126 code('''
1127// Auto generated C++ code started by $__file__:$__line__
1128// ${ident}: ${{self.short}}
1129
1130#include <cassert>
1131
1128#include "mem/protocol/${ident}_Profiler.hh"
1129
1130${ident}_Profiler::${ident}_Profiler()
1131{
1132 for (int state = 0; state < ${ident}_State_NUM; state++) {
1133 for (int event = 0; event < ${ident}_Event_NUM; event++) {
1134 m_possible[state][event] = false;
1135 m_counters[state][event] = 0;

--- 242 unchanged lines hidden ---
1132#include "mem/protocol/${ident}_Profiler.hh"
1133
1134${ident}_Profiler::${ident}_Profiler()
1135{
1136 for (int state = 0; state < ${ident}_State_NUM; state++) {
1137 for (int event = 0; event < ${ident}_Event_NUM; event++) {
1138 m_possible[state][event] = false;
1139 m_counters[state][event] = 0;

--- 242 unchanged lines hidden ---