StateMachine.py (9364:e5fc9d588132) | StateMachine.py (9366:bf8eb26c7b7e) |
---|---|
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 2# Copyright (c) 2009 The Hewlett-Packard Development Company 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 27 unchanged lines hidden (view full) --- 36 "uint32_t" : "UInt32", 37 "std::string": "String", 38 "bool": "Bool", 39 "CacheMemory": "RubyCache", 40 "WireBuffer": "RubyWireBuffer", 41 "Sequencer": "RubySequencer", 42 "DirectoryMemory": "RubyDirectoryMemory", 43 "MemoryControl": "MemoryControl", | 1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 2# Copyright (c) 2009 The Hewlett-Packard Development Company 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 27 unchanged lines hidden (view full) --- 36 "uint32_t" : "UInt32", 37 "std::string": "String", 38 "bool": "Bool", 39 "CacheMemory": "RubyCache", 40 "WireBuffer": "RubyWireBuffer", 41 "Sequencer": "RubySequencer", 42 "DirectoryMemory": "RubyDirectoryMemory", 43 "MemoryControl": "MemoryControl", |
44 "DMASequencer": "DMASequencer" | 44 "DMASequencer": "DMASequencer", 45 "Prefetcher":"Prefetcher" |
45 } 46 47class StateMachine(Symbol): 48 def __init__(self, symtab, ident, location, pairs, config_parameters): 49 super(StateMachine, self).__init__(symtab, ident, location, pairs) 50 self.table = None 51 self.config_parameters = config_parameters | 46 } 47 48class StateMachine(Symbol): 49 def __init__(self, symtab, ident, location, pairs, config_parameters): 50 super(StateMachine, self).__init__(symtab, ident, location, pairs) 51 self.table = None 52 self.config_parameters = config_parameters |
53 self.prefetchers = [] |
|
52 53 for param in config_parameters: 54 if param.pointer: 55 var = Var(symtab, param.name, location, param.type_ast.type, 56 "(*m_%s_ptr)" % param.name, {}, self) 57 else: 58 var = Var(symtab, param.name, location, param.type_ast.type, 59 "m_%s" % param.name, {}, self) 60 self.symtab.registerSym(param.name, var) | 54 55 for param in config_parameters: 56 if param.pointer: 57 var = Var(symtab, param.name, location, param.type_ast.type, 58 "(*m_%s_ptr)" % param.name, {}, self) 59 else: 60 var = Var(symtab, param.name, location, param.type_ast.type, 61 "m_%s" % param.name, {}, self) 62 self.symtab.registerSym(param.name, var) |
63 if str(param.type_ast.type) == "Prefetcher": 64 self.prefetchers.append(var) |
|
61 62 self.states = orderdict() 63 self.events = orderdict() 64 self.actions = orderdict() 65 self.request_types = orderdict() 66 self.transitions = [] 67 self.in_ports = [] 68 self.functions = [] 69 self.objects = [] 70 self.TBEType = None 71 self.EntryType = None | 65 66 self.states = orderdict() 67 self.events = orderdict() 68 self.actions = orderdict() 69 self.request_types = orderdict() 70 self.transitions = [] 71 self.in_ports = [] 72 self.functions = [] 73 self.objects = [] 74 self.TBEType = None 75 self.EntryType = None |
72 | |
73 self.message_buffer_names = [] 74 | 76 self.message_buffer_names = [] 77 |
78 |
|
75 def __repr__(self): 76 return "[StateMachine: %s]" % self.ident 77 78 def addState(self, state): 79 assert self.table is None 80 self.states[state.ident] = state 81 82 def addEvent(self, event): --- 541 unchanged lines hidden (view full) --- 624''') 625 626 if vtype.isBuffer: 627 if "recycle_latency" in var: 628 code('$vid->setRecycleLatency(${{var["recycle_latency"]}});') 629 else: 630 code('$vid->setRecycleLatency(m_recycle_latency);') 631 | 79 def __repr__(self): 80 return "[StateMachine: %s]" % self.ident 81 82 def addState(self, state): 83 assert self.table is None 84 self.states[state.ident] = state 85 86 def addEvent(self, event): --- 541 unchanged lines hidden (view full) --- 628''') 629 630 if vtype.isBuffer: 631 if "recycle_latency" in var: 632 code('$vid->setRecycleLatency(${{var["recycle_latency"]}});') 633 else: 634 code('$vid->setRecycleLatency(m_recycle_latency);') 635 |
636 # Set the prefetchers 637 code() 638 for prefetcher in self.prefetchers: 639 code('${{prefetcher.code}}.setController(this);') |
|
632 633 # Set the queue consumers 634 code() 635 for port in self.in_ports: 636 code('${{port.code}}.setConsumer(this);') 637 638 # Set the queue descriptions 639 code() --- 1071 unchanged lines hidden --- | 640 641 # Set the queue consumers 642 code() 643 for port in self.in_ports: 644 code('${{port.code}}.setConsumer(this);') 645 646 # Set the queue descriptions 647 code() --- 1071 unchanged lines hidden --- |