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; --- 337 unchanged lines hidden (view full) --- 346 if self.TBEType != None: 347 code(''' 348 349// Set and Reset for tbe variable 350void set_tbe(${{self.TBEType.c_ident}}*& m_tbe_ptr, ${ident}_TBE* m_new_tbe); 351void unset_tbe(${{self.TBEType.c_ident}}*& m_tbe_ptr); 352''') 353 |
354 # Prototype the actions that the controller can take |
355 code(''' 356 357// Actions 358''') 359 if self.TBEType != None and self.EntryType != None: 360 for action in self.actions.itervalues(): 361 code('/** \\brief ${{action.desc}} */') |
362 code('void ${{action.ident}}(${{self.TBEType.c_ident}}*& ' 363 'm_tbe_ptr, ${{self.EntryType.c_ident}}*& ' 364 'm_cache_entry_ptr, const Address& addr);') |
365 elif self.TBEType != None: 366 for action in self.actions.itervalues(): 367 code('/** \\brief ${{action.desc}} */') |
368 code('void ${{action.ident}}(${{self.TBEType.c_ident}}*& ' 369 'm_tbe_ptr, const Address& addr);') |
370 elif self.EntryType != None: 371 for action in self.actions.itervalues(): 372 code('/** \\brief ${{action.desc}} */') |
373 code('void ${{action.ident}}(${{self.EntryType.c_ident}}*& ' 374 'm_cache_entry_ptr, const Address& addr);') |
375 else: 376 for action in self.actions.itervalues(): 377 code('/** \\brief ${{action.desc}} */') 378 code('void ${{action.ident}}(const Address& addr);') 379 380 # the controller internal variables 381 code(''' 382 --- 51 unchanged lines hidden (view full) --- 434 435 # include object classes 436 seen_types = set() 437 for var in self.objects: 438 if var.type.ident not in seen_types and not var.type.isPrimitive: 439 code('#include "mem/protocol/${{var.type.c_ident}}.hh"') 440 seen_types.add(var.type.ident) 441 |
442 num_in_ports = len(self.in_ports) 443 |
444 code(''' 445$c_ident * 446${c_ident}Params::create() 447{ 448 return new $c_ident(this); 449} 450 451int $c_ident::m_num_controllers = 0; --- 10 unchanged lines hidden (view full) --- 462#endif 463 464/** \\brief constructor */ 465$c_ident::$c_ident(const Params *p) 466 : AbstractController(p) 467{ 468 m_machineID.type = MachineType_${ident}; 469 m_machineID.num = m_version; |
470 m_num_controllers++; 471 472 m_in_ports = $num_in_ports; |
473''') |
474 code.indent() 475 476 # 477 # After initializing the universal machine parameters, initialize the |
478 # this machines config parameters. Also if these configuration params 479 # include a sequencer, connect the it to the controller. |
480 # |
481 for param in self.config_parameters: |
482 if param.pointer: 483 code('m_${{param.name}}_ptr = p->${{param.name}};') 484 else: 485 code('m_${{param.name}} = p->${{param.name}};') |
486 if re.compile("sequencer").search(param.name): 487 code('m_${{param.name}}_ptr->setController(this);') |
488 |
489 for var in self.objects: 490 if var.ident.find("mandatoryQueue") >= 0: 491 code(''' 492m_${{var.c_ident}}_ptr = new ${{var.type.c_ident}}(); 493m_${{var.c_ident}}_ptr->setReceiver(this); 494''') 495 else: 496 if "network" in var and "physical_network" in var and \ --- 170 unchanged lines hidden (view full) --- 667 668 code.dedent() 669 code(''' 670 AbstractController::init(); 671 resetStats(); 672} 673''') 674 |
675 mq_ident = "NULL" |
676 for port in self.in_ports: 677 if port.code.find("mandatoryQueue_ptr") >= 0: |
678 mq_ident = "m_%s_mandatoryQueue_ptr" % self.ident |
679 |
680 seq_ident = "NULL" 681 for param in self.config_parameters: 682 if param.name == "sequencer": 683 assert(param.pointer) 684 seq_ident = "m_%s_ptr" % param.name 685 686 code(''' 687 --- 827 unchanged lines hidden --- |