mem-ruby: able to define resource stalls handlers
authorTiago Mück <tiago.muck@arm.com>
Fri, 28 Feb 2020 21:32:00 +0000 (15:32 -0600)
committerTiago Mück <tiago.muck@arm.com>
Mon, 7 Dec 2020 19:53:43 +0000 (19:53 +0000)
commit4e2216d68b14e51351c6c87708820fdeac1f1608
treec13f32eb83ddcf7814ba2760a21379d224545cd4
parentca29eef37e010c6c5e02a212302a799f7fb5a37d
mem-ruby: able to define resource stalls handlers

Input ports can specify a custom handler that is called
on resource stalls. The handler should return 'true' to
indicate the stall was handled and new messages from that
queue can be processed on that cycle. When it returns
'false' or no handler is defined, a resource stall is
generated.

Handlers are defined using the 'rsc_stall_handler' (for
resource stalls) and the 'prot_stall_handler' (for
protocol stalls) parameters. For example:

in_port(mandatory_in, RubyRequest, mandatoryQueue,
        rsc_stall_handler=mandatory_in_stall_handler) {
    ...
}

bool mandatory_in_stall_handler() {
    // Do something here to handle the stall !
    return true;
    // or return false if we don't want to do anything
}

Note: this patch required a change to the generate()
functions interface in the SLICC compiler, so we
could propagate a reference to the in_port to the
appropriate generate() functions. The updated interface
allows passing and forwarding of keyword arguments.

Change-Id: I3481d130d5eb411e6760a54d098d3da5de511c86
Signed-off-by: Tiago Mück <tiago.muck@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31265
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
29 files changed:
src/mem/slicc/ast/AssignStatementAST.py
src/mem/slicc/ast/CheckAllocateStatementAST.py
src/mem/slicc/ast/CheckNextCycleAST.py
src/mem/slicc/ast/CheckProbeStatementAST.py
src/mem/slicc/ast/DeferEnqueueingStatementAST.py
src/mem/slicc/ast/EnqueueStatementAST.py
src/mem/slicc/ast/EnumExprAST.py
src/mem/slicc/ast/ExprAST.py
src/mem/slicc/ast/ExprStatementAST.py
src/mem/slicc/ast/FuncCallExprAST.py
src/mem/slicc/ast/FuncDeclAST.py
src/mem/slicc/ast/IfStatementAST.py
src/mem/slicc/ast/InPortDeclAST.py
src/mem/slicc/ast/IsValidPtrExprAST.py
src/mem/slicc/ast/LiteralExprAST.py
src/mem/slicc/ast/LocalVariableAST.py
src/mem/slicc/ast/MethodCallExprAST.py
src/mem/slicc/ast/NewExprAST.py
src/mem/slicc/ast/ObjDeclAST.py
src/mem/slicc/ast/OodAST.py
src/mem/slicc/ast/OperatorExprAST.py
src/mem/slicc/ast/PeekStatementAST.py
src/mem/slicc/ast/ReturnStatementAST.py
src/mem/slicc/ast/StallAndWaitStatementAST.py
src/mem/slicc/ast/StatementListAST.py
src/mem/slicc/ast/StaticCastAST.py
src/mem/slicc/ast/TypeFieldEnumAST.py
src/mem/slicc/ast/TypeFieldStateAST.py
src/mem/slicc/ast/VarExprAST.py