Thanks for the response Nilay. DPRINTF works, but I'm talking about say a "warn" or "warn_once" m5 debug statement. Or even an "inform" or "panic". I guess error is similar to panic (maybe it should be changed to use m5's panic?).
So the question is, if I want to add some other debug function, where do I add this? I think I may have figured this out: There is a src/mem/protocol/RubySlicc_Util.sm file that list functions that are used. then there is a src/mem/slicc_interface/RubySlicc_Includes.hh file where you can bring in functions that will go to Slicc. I think this type of information will be nice to go in the SLICC Internals section in the documentation. On Sat, May 7, 2011 at 9:23 AM, Nilay Vaish <ni...@cs.wisc.edu> wrote: > Koreay, DPRINTF already works in sm files. Use RubySlicc as the flag. You > can also use error() and assert() functions which have the following > prototypes -- > > void error(std::string msg); > void assert(bool condition); > > -- > Nilay > > > On Fri, 6 May 2011, Korey Sewell wrote: > > I guess I should rephrase this question to this: >> What's the best way to expose a new function to be used in the *.sm SLICC >> files? >> >> On Fri, May 6, 2011 at 3:26 AM, Korey Sewell <ksew...@umich.edu> wrote: >> >> Hi all, >>> I'm trying to drop in warn/inform/panic/dprintf/etc messages into the >>> SLICC >>> files because these functions are pretty invaluable to the being able to >>> validate, debug and document what's going on in your simulation, but I >>> have >>> not been able to get them to work inside a SLICC .sm file. >>> >>> I was hoping that I could place a "base/misc.hh" header file somewhere >>> and >>> magic would ensue but that was not the case :) >>> >>> Instead, it looks like I would have to add my own detection functions for >>> warn/inform/etc. in the SLICC parser, so that when I call those functions >>> in >>> the code, it will recognize it. >>> >>> I am wondering if anyone has had a similar problem like this (in terms of >>> adding random C++ code to a *.sm file) and if so can you give me your >>> perspective on what I would need to do get this working in SLICC. Is this >>> functionality already there in SLICC and I'm just missing something? >>> >>> The current error I receive is this: >>> Exception: MOESI_CMP_directory-L2cache.sm:973: Error: Unrecognized >>> function >>> name: 'warn': >>> File "/y/ksewell/m5-dev/m5-outgoing/SConstruct", line 1025: >>> ... >>> File "/y/ksewell/m5-dev/m5-incoming/src/mem/slicc/ast/AST.py", line 50: >>> self.location.error(message, *args) >>> File "/y/ksewell/m5-dev/m5-incoming/src/mem/slicc/util.py", line 72: >>> raise Exception, "%s: Error: %s" % (self, message) >>> >>> >>> I think this is pretty high utility, so if it's not going to be a >>> "programming adventure", I'd like to go ahead and spend time to get it >>> working. If anyone has any thoughts or suggestions, please let me know >>> what >>> you think. >>> >>> Thanks. >>> >>> -- >>> - Korey >>> >>> >> >> >> -- >> - Korey >> _______________________________________________ >> m5-dev mailing list >> m5-dev@m5sim.org >> http://m5sim.org/mailman/listinfo/m5-dev >> >> _______________________________________________ > m5-dev mailing list > m5-dev@m5sim.org > http://m5sim.org/mailman/listinfo/m5-dev > -- - Korey _______________________________________________ m5-dev mailing list m5-dev@m5sim.org http://m5sim.org/mailman/listinfo/m5-dev