On Tue, 19 May 2015, Brad Beckmann wrote:



Brad Beckmann wrote:
    I think exceptions are needed because SLICC creates the AST in a single 
pass.  I certainly don't know how to do this in another way.  Derek Hower could 
provide you a more detailed response.

Nilay Vaish wrote:
    I am also against using exceptions for doing actual work.  Exceptions are 
for error handling, not for writing code.
    I think the following would work.  The SLICC syntax would be:

    in_port(ResponseQueue_in, {ResponseMsg, TgtResponseMsg}, responseFromDir, 
rank=3)

    The order of the message types would decide the order in which each type is 
tried.

    The generated code would look like:
    // Declare message
    const $mtid* in_msg_ptr M5_VAR_USED;
    if (check for first type) {
       do the required work
    }  else if (check for next type) {
    } else {
      fatal / panic.
    }

Your suggestion results in more complicated nested code. One of the benefits of this patch is it allows the SLICC developer to write the in_port logic as two separate sets of conditional logic.



Scratch the SLICC syntax I was suggesting. I think that is not going to work. But the generated C++ code can still look what I am suggesting. Again exceptions are for error handling and not for doing actual work.

--
Nilay
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to