1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 2# Copyright (c) 2009 The Hewlett-Packard Development Company |
3# Copyright (c) 2013 Advanced Micro Devices, Inc. |
4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions are 8# met: redistributions of source code must retain the above copyright 9# notice, this list of conditions and the following disclaimer; 10# redistributions in binary form must reproduce the above copyright 11# notice, this list of conditions and the following disclaimer in the --- 70 unchanged lines hidden (view full) --- 82 self.functions = [] 83 84 # Data members in the State Machine that have been declared inside 85 # the {} machine. Note that these along with the config params 86 # form the entire set of data members of the machine. 87 self.objects = [] 88 self.TBEType = None 89 self.EntryType = None |
90 self.debug_flags = set() 91 self.debug_flags.add('RubyGenerated') 92 self.debug_flags.add('RubySlicc') |
93 94 def __repr__(self): 95 return "[StateMachine: %s]" % self.ident 96 97 def addState(self, state): 98 assert self.table is None 99 self.states[state.ident] = state 100 --- 12 unchanged lines hidden (view full) --- 113 if action.short == other.short: 114 other.warning("Duplicate action shorthand: %s" % other.ident) 115 other.warning(" shorthand = %s" % other.short) 116 action.warning("Duplicate action shorthand: %s" % action.ident) 117 action.error(" shorthand = %s" % action.short) 118 119 self.actions[action.ident] = action 120 |
121 def addDebugFlag(self, flag): 122 self.debug_flags.add(flag) 123 |
124 def addRequestType(self, request_type): 125 assert self.table is None 126 self.request_types[request_type.ident] = request_type 127 128 def addTransition(self, trans): 129 assert self.table is None 130 self.transitions.append(trans) 131 --- 140 unchanged lines hidden (view full) --- 272#include <sstream> 273#include <string> 274 275#include "mem/protocol/TransitionResult.hh" 276#include "mem/protocol/Types.hh" 277#include "mem/ruby/common/Consumer.hh" 278#include "mem/ruby/slicc_interface/AbstractController.hh" 279#include "params/$c_ident.hh" |
280 |
281''') 282 283 seen_types = set() 284 for var in self.objects: 285 if var.type.ident not in seen_types and not var.type.isPrimitive: 286 code('#include "mem/protocol/${{var.type.c_ident}}.hh"') 287 seen_types.add(var.type.ident) 288 --- 155 unchanged lines hidden (view full) --- 444 code(''' 445/** \\file $c_ident.cc 446 * 447 * Auto generated C++ code started by $__file__:$__line__ 448 * Created by slicc definition of Module "${{self.short}}" 449 */ 450 451#include <sys/types.h> |
452#include <unistd.h> 453 454#include <cassert> 455#include <sstream> 456#include <string> |
457#include <typeinfo> |
458 459#include "base/compiler.hh" 460#include "base/cprintf.hh" |
461 462''') 463 for f in self.debug_flags: 464 code('#include "debug/${{f}}.hh"') 465 code(''' |
466#include "mem/protocol/${ident}_Controller.hh" 467#include "mem/protocol/${ident}_Event.hh" 468#include "mem/protocol/${ident}_State.hh" 469#include "mem/protocol/Types.hh" 470#include "mem/ruby/system/System.hh" |
471 |
472''') 473 for include_path in includes: 474 code('#include "${{include_path}}"') 475 476 code(''' 477 478using namespace std; 479''') --- 580 unchanged lines hidden (view full) --- 1060 if len(self.request_types) == 0: 1061 outputRequest_types = False 1062 1063 code(''' 1064// Auto generated C++ code started by $__file__:$__line__ 1065// ${ident}: ${{self.short}} 1066 1067#include <sys/types.h> |
1068#include <unistd.h> 1069 1070#include <cassert> |
1071#include <typeinfo> |
1072 1073#include "base/misc.hh" |
1074 1075''') 1076 for f in self.debug_flags: 1077 code('#include "debug/${{f}}.hh"') 1078 code(''' |
1079#include "mem/protocol/${ident}_Controller.hh" 1080#include "mem/protocol/${ident}_Event.hh" 1081#include "mem/protocol/${ident}_State.hh" |
1082 |
1083''') 1084 1085 if outputRequest_types: 1086 code('''#include "mem/protocol/${ident}_RequestType.hh"''') 1087 1088 code(''' 1089#include "mem/protocol/Types.hh" 1090#include "mem/ruby/system/System.hh" |
1091 |
1092''') 1093 1094 1095 for include_path in includes: 1096 code('#include "${{include_path}}"') 1097 1098 port_to_buf_map, in_msg_bufs, msg_bufs = self.getBufferMaps(ident) 1099 --- 512 unchanged lines hidden --- |