From 07ea0891f1699f6194a05516948ce3824fb8fb38 Mon Sep 17 00:00:00 2001 From: Derek Hower <drh5@cs.wisc.edu> Date: Tue, 19 Jan 2010 17:11:36 -0600 Subject: ruby: new atomics implementation This patch changes the way that Ruby handles atomic RMW instructions. This implementation, unlike the prior one, is protocol independent. It works by locking an address from the sequencer immediately after the read portion of an RMW completes. When that address is locked, the coherence controller will only satisfy requests coming from one port (e.g., the mandatory queue) and will ignore all others. After the write portion completed, the line is unlocked. This should also work with multi-line atomics, as long as the blocks are always acquired in the same order. --- src/mem/slicc/ast/PeekStatementAST.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/mem/slicc/ast/PeekStatementAST.py') diff --git a/src/mem/slicc/ast/PeekStatementAST.py b/src/mem/slicc/ast/PeekStatementAST.py index 5186bf0d5..b63ce6516 100644 --- a/src/mem/slicc/ast/PeekStatementAST.py +++ b/src/mem/slicc/ast/PeekStatementAST.py @@ -29,8 +29,8 @@ from slicc.ast.StatementAST import StatementAST from slicc.symbols import Var class PeekStatementAST(StatementAST): - def __init__(self, slicc, queue_name, type_ast, statements, method): - super(PeekStatementAST, self).__init__(slicc) + def __init__(self, slicc, queue_name, type_ast, pairs, statements, method): + super(PeekStatementAST, self).__init__(slicc, pairs) self.queue_name = queue_name self.type_ast = type_ast @@ -63,6 +63,17 @@ class PeekStatementAST(StatementAST): in_msg_ptr = dynamic_cast<const $mtid *>(($qcode).${{self.method}}()); assert(in_msg_ptr != NULL); ''') + if self.pairs.has_key("block_on"): + address_field = self.pairs['block_on'] + code(''' + if ( (m_is_blocking == true) && + (m_block_map.count(in_msg_ptr->m_$address_field) == 1) ) { + if (m_block_map[in_msg_ptr->m_$address_field] != &$qcode) { + $qcode.delayHead(); + continue; + } + } + ''') # The other statements self.statements.generate(code, return_type) -- cgit v1.2.3