summaryrefslogtreecommitdiff
path: root/src/mem/slicc/ast
diff options
context:
space:
mode:
authorJohn Alsop <johnathan.alsop@amd.com>2018-04-16 19:37:53 -0400
committerAnthony Gutierrez <anthony.gutierrez@amd.com>2018-04-17 17:31:22 +0000
commit2a9573f5942b5416fb0570cf5cb6cdecba733392 (patch)
tree60fc7a2ebd33cf8ee67bcff183f9e892926fab56 /src/mem/slicc/ast
parentc014f4f82eaa89d2bdb3f3c73613b1b49b4a4eec (diff)
downloadgem5-2a9573f5942b5416fb0570cf5cb6cdecba733392.tar.xz
mem-ruby: enable DPRINTFN calls in slicc for temporary debug printing
Change-Id: Ib92f8bb4ab7b61ebc96b935cb8abc42cf5ec6ac8 Reviewed-on: https://gem5-review.googlesource.com/9921 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/mem/slicc/ast')
-rw-r--r--src/mem/slicc/ast/FuncCallExprAST.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mem/slicc/ast/FuncCallExprAST.py b/src/mem/slicc/ast/FuncCallExprAST.py
index 0c9880d6d..b3cc9f1ec 100644
--- a/src/mem/slicc/ast/FuncCallExprAST.py
+++ b/src/mem/slicc/ast/FuncCallExprAST.py
@@ -74,6 +74,24 @@ class FuncCallExprAST(ExprAST):
return self.symtab.find("void", Type)
+ if self.proc_name == "DPRINTFN":
+ format = "%s" % (self.exprs[0].inline())
+ format_length = len(format)
+ str_list = []
+
+ for i in range(1, len(self.exprs)):
+ str_list.append("%s" % self.exprs[i].inline())
+
+ if len(str_list) == 0:
+ code('DPRINTFN("$0: $1")',
+ self.exprs[0].location, format[2:format_length-2])
+ else:
+ code('DPRINTFN("$0: $1", $2)',
+ self.exprs[0].location, format[2:format_length-2],
+ ', '.join(str_list))
+
+ return self.symtab.find("void", Type)
+
# hack for adding comments to profileTransition
if self.proc_name == "APPEND_TRANSITION_COMMENT":
# FIXME - check for number of parameters