slicc: support for arbitrary DPRINTF flags (not just RubySlicc)
This patch allows DPRINTFs to be used in SLICC state machines similar to how they are used by the rest of gem5. Previously all DPRINTFs in the .sm files had to use the RubySlicc flag.
This commit is contained in:
parent
9324239922
commit
3454a4a36e
3 changed files with 31 additions and 8 deletions
|
@ -1,5 +1,6 @@
|
||||||
# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
|
# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
|
||||||
# Copyright (c) 2009 The Hewlett-Packard Development Company
|
# Copyright (c) 2009 The Hewlett-Packard Development Company
|
||||||
|
# Copyright (c) 2013 Advanced Micro Devices, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -53,6 +54,8 @@ class FuncCallExprAST(ExprAST):
|
||||||
# handled differently. Hence the check whether or not
|
# handled differently. Hence the check whether or not
|
||||||
# the str_list is empty.
|
# the str_list is empty.
|
||||||
|
|
||||||
|
dflag = "%s" % (self.exprs[0].name)
|
||||||
|
machine.addDebugFlag(dflag)
|
||||||
format = "%s" % (self.exprs[1].inline())
|
format = "%s" % (self.exprs[1].inline())
|
||||||
format_length = len(format)
|
format_length = len(format)
|
||||||
str_list = []
|
str_list = []
|
||||||
|
@ -61,10 +64,11 @@ class FuncCallExprAST(ExprAST):
|
||||||
str_list.append("%s" % self.exprs[i].inline())
|
str_list.append("%s" % self.exprs[i].inline())
|
||||||
|
|
||||||
if len(str_list) == 0:
|
if len(str_list) == 0:
|
||||||
code('DPRINTF(RubySlicc, "$0: $1")',
|
code('DPRINTF($0, "$1: $2")',
|
||||||
self.exprs[0].location, format[2:format_length-2])
|
dflag, self.exprs[0].location, format[2:format_length-2])
|
||||||
else:
|
else:
|
||||||
code('DPRINTF(RubySlicc, "$0: $1", $2)',
|
code('DPRINTF($0, "$1: $2", $3)',
|
||||||
|
dflag,
|
||||||
self.exprs[0].location, format[2:format_length-2],
|
self.exprs[0].location, format[2:format_length-2],
|
||||||
', '.join(str_list))
|
', '.join(str_list))
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
|
# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
|
||||||
# Copyright (c) 2009 The Hewlett-Packard Development Company
|
# Copyright (c) 2009 The Hewlett-Packard Development Company
|
||||||
|
# Copyright (c) 2013 Advanced Micro Devices, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
|
# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
|
||||||
# Copyright (c) 2009 The Hewlett-Packard Development Company
|
# Copyright (c) 2009 The Hewlett-Packard Development Company
|
||||||
|
# Copyright (c) 2013 Advanced Micro Devices, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -86,6 +87,9 @@ class StateMachine(Symbol):
|
||||||
self.objects = []
|
self.objects = []
|
||||||
self.TBEType = None
|
self.TBEType = None
|
||||||
self.EntryType = None
|
self.EntryType = None
|
||||||
|
self.debug_flags = set()
|
||||||
|
self.debug_flags.add('RubyGenerated')
|
||||||
|
self.debug_flags.add('RubySlicc')
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "[StateMachine: %s]" % self.ident
|
return "[StateMachine: %s]" % self.ident
|
||||||
|
@ -114,6 +118,9 @@ class StateMachine(Symbol):
|
||||||
|
|
||||||
self.actions[action.ident] = action
|
self.actions[action.ident] = action
|
||||||
|
|
||||||
|
def addDebugFlag(self, flag):
|
||||||
|
self.debug_flags.add(flag)
|
||||||
|
|
||||||
def addRequestType(self, request_type):
|
def addRequestType(self, request_type):
|
||||||
assert self.table is None
|
assert self.table is None
|
||||||
self.request_types[request_type.ident] = request_type
|
self.request_types[request_type.ident] = request_type
|
||||||
|
@ -270,6 +277,7 @@ class $py_ident(RubyController):
|
||||||
#include "mem/ruby/common/Consumer.hh"
|
#include "mem/ruby/common/Consumer.hh"
|
||||||
#include "mem/ruby/slicc_interface/AbstractController.hh"
|
#include "mem/ruby/slicc_interface/AbstractController.hh"
|
||||||
#include "params/$c_ident.hh"
|
#include "params/$c_ident.hh"
|
||||||
|
|
||||||
''')
|
''')
|
||||||
|
|
||||||
seen_types = set()
|
seen_types = set()
|
||||||
|
@ -441,22 +449,26 @@ void unset_tbe(${{self.TBEType.c_ident}}*& m_tbe_ptr);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <typeinfo>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
#include "base/compiler.hh"
|
#include "base/compiler.hh"
|
||||||
#include "base/cprintf.hh"
|
#include "base/cprintf.hh"
|
||||||
#include "debug/RubyGenerated.hh"
|
|
||||||
#include "debug/RubySlicc.hh"
|
''')
|
||||||
|
for f in self.debug_flags:
|
||||||
|
code('#include "debug/${{f}}.hh"')
|
||||||
|
code('''
|
||||||
#include "mem/protocol/${ident}_Controller.hh"
|
#include "mem/protocol/${ident}_Controller.hh"
|
||||||
#include "mem/protocol/${ident}_Event.hh"
|
#include "mem/protocol/${ident}_Event.hh"
|
||||||
#include "mem/protocol/${ident}_State.hh"
|
#include "mem/protocol/${ident}_State.hh"
|
||||||
#include "mem/protocol/Types.hh"
|
#include "mem/protocol/Types.hh"
|
||||||
#include "mem/ruby/system/System.hh"
|
#include "mem/ruby/system/System.hh"
|
||||||
|
|
||||||
''')
|
''')
|
||||||
for include_path in includes:
|
for include_path in includes:
|
||||||
code('#include "${{include_path}}"')
|
code('#include "${{include_path}}"')
|
||||||
|
@ -1053,16 +1065,21 @@ $c_ident::functionalWriteBuffers(PacketPtr& pkt)
|
||||||
// ${ident}: ${{self.short}}
|
// ${ident}: ${{self.short}}
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <typeinfo>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
#include "base/misc.hh"
|
#include "base/misc.hh"
|
||||||
#include "debug/RubySlicc.hh"
|
|
||||||
|
''')
|
||||||
|
for f in self.debug_flags:
|
||||||
|
code('#include "debug/${{f}}.hh"')
|
||||||
|
code('''
|
||||||
#include "mem/protocol/${ident}_Controller.hh"
|
#include "mem/protocol/${ident}_Controller.hh"
|
||||||
#include "mem/protocol/${ident}_Event.hh"
|
#include "mem/protocol/${ident}_Event.hh"
|
||||||
#include "mem/protocol/${ident}_State.hh"
|
#include "mem/protocol/${ident}_State.hh"
|
||||||
|
|
||||||
''')
|
''')
|
||||||
|
|
||||||
if outputRequest_types:
|
if outputRequest_types:
|
||||||
|
@ -1071,6 +1088,7 @@ $c_ident::functionalWriteBuffers(PacketPtr& pkt)
|
||||||
code('''
|
code('''
|
||||||
#include "mem/protocol/Types.hh"
|
#include "mem/protocol/Types.hh"
|
||||||
#include "mem/ruby/system/System.hh"
|
#include "mem/ruby/system/System.hh"
|
||||||
|
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue