Deleted Added
sdiff udiff text old ( 10962:7233a5f7ac8f ) new ( 10963:51f40b101a56 )
full compact
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;

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

174 for action in self.actions.itervalues():
175 if not action.used:
176 error_msg = "Unused action: %s" % action.ident
177 if "desc" in action:
178 error_msg += ", " + action.desc
179 action.warning(error_msg)
180 self.table = table
181
182 def writeCodeFiles(self, path, includes):
183 self.printControllerPython(path)
184 self.printControllerHH(path)
185 self.printControllerCC(path, includes)
186 self.printCSwitch(path)
187 self.printCWakeup(path, includes)
188
189 def printControllerPython(self, path):

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

418 code('''
419/** \\file $c_ident.cc
420 *
421 * Auto generated C++ code started by $__file__:$__line__
422 * Created by slicc definition of Module "${{self.short}}"
423 */
424
425#include <sys/types.h>
426#include <unistd.h>
427
428#include <cassert>
429#include <sstream>
430#include <string>
431
432#include "base/compiler.hh"
433#include "base/cprintf.hh"

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

930 continue
931
932 code('''
933/** \\brief ${{action.desc}} */
934void
935$c_ident::${{action.ident}}(${{self.TBEType.c_ident}}*& m_tbe_ptr, ${{self.EntryType.c_ident}}*& m_cache_entry_ptr, const Address& addr)
936{
937 DPRINTF(RubyGenerated, "executing ${{action.ident}}\\n");
938 ${{action["c_code"]}}
939}
940
941''')
942 elif self.TBEType != None:
943 for action in self.actions.itervalues():
944 if "c_code" not in action:
945 continue
946

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

1023 if len(self.request_types) == 0:
1024 outputRequest_types = False
1025
1026 code('''
1027// Auto generated C++ code started by $__file__:$__line__
1028// ${ident}: ${{self.short}}
1029
1030#include <sys/types.h>
1031#include <unistd.h>
1032
1033#include <cassert>
1034
1035#include "base/misc.hh"
1036#include "debug/RubySlicc.hh"
1037#include "mem/protocol/${ident}_Controller.hh"
1038#include "mem/protocol/${ident}_Event.hh"

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

1046#include "mem/protocol/Types.hh"
1047#include "mem/ruby/system/System.hh"
1048''')
1049
1050
1051 for include_path in includes:
1052 code('#include "${{include_path}}"')
1053
1054 code('''
1055
1056using namespace std;
1057
1058void
1059${ident}_Controller::wakeup()
1060{
1061 int counter = 0;
1062 while (true) {
1063 // Some cases will put us into an infinite loop without this limit
1064 assert(counter <= m_transitions_per_cycle);
1065 if (counter == m_transitions_per_cycle) {
1066 // Count how often we are fully utilized
1067 m_fully_busy_cycles++;
1068
1069 // Wakeup in another cycle and try again
1070 scheduleEvent(Cycles(1));

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

1079 #
1080 for port in self.in_ports:
1081 code.indent()
1082 code('// ${ident}InPort $port')
1083 if port.pairs.has_key("rank"):
1084 code('m_cur_in_port = ${{port.pairs["rank"]}};')
1085 else:
1086 code('m_cur_in_port = 0;')
1087 code('${{port["c_code_in_port"]}}')
1088 code.dedent()
1089
1090 code('')
1091
1092 code.dedent()
1093 code.dedent()
1094 code('''
1095 break; // If we got this far, we have nothing left todo
1096 }
1097}
1098''')
1099
1100 code.write(path, "%s_Wakeup.cc" % self.ident)
1101
1102 def printCSwitch(self, path):
1103 '''Output switch statement for transition table'''

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

1165 code('doTransitionWorker(event, state, next_state, m_tbe_ptr, m_cache_entry_ptr, addr);')
1166 elif self.TBEType != None:
1167 code('doTransitionWorker(event, state, next_state, m_tbe_ptr, addr);')
1168 elif self.EntryType != None:
1169 code('doTransitionWorker(event, state, next_state, m_cache_entry_ptr, addr);')
1170 else:
1171 code('doTransitionWorker(event, state, next_state, addr);')
1172
1173 code('''
1174
1175if (result == TransitionResult_Valid) {
1176 DPRINTF(RubyGenerated, "next_state: %s\\n",
1177 ${ident}_State_to_string(next_state));
1178 countTransition(state, event);
1179
1180 DPRINTFR(ProtocolTrace, "%15d %3s %10s%20s %6s>%-6s %s %s\\n",

--- 344 unchanged lines hidden ---