StateMachine.py (10078:9400a90ec5d1) | StateMachine.py (10121:64545628f5a7) |
---|---|
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 | 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 |
|
354 code(''' 355 356// Actions 357''') 358 if self.TBEType != None and self.EntryType != None: 359 for action in self.actions.itervalues(): 360 code('/** \\brief ${{action.desc}} */') | 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}} */') |
361 code('void ${{action.ident}}(${{self.TBEType.c_ident}}*& m_tbe_ptr, ${{self.EntryType.c_ident}}*& m_cache_entry_ptr, const Address& addr);') | 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);') |
362 elif self.TBEType != None: 363 for action in self.actions.itervalues(): 364 code('/** \\brief ${{action.desc}} */') | 365 elif self.TBEType != None: 366 for action in self.actions.itervalues(): 367 code('/** \\brief ${{action.desc}} */') |
365 code('void ${{action.ident}}(${{self.TBEType.c_ident}}*& m_tbe_ptr, const Address& addr);') | 368 code('void ${{action.ident}}(${{self.TBEType.c_ident}}*& ' 369 'm_tbe_ptr, const Address& addr);') |
366 elif self.EntryType != None: 367 for action in self.actions.itervalues(): 368 code('/** \\brief ${{action.desc}} */') | 370 elif self.EntryType != None: 371 for action in self.actions.itervalues(): 372 code('/** \\brief ${{action.desc}} */') |
369 code('void ${{action.ident}}(${{self.EntryType.c_ident}}*& m_cache_entry_ptr, const Address& addr);') | 373 code('void ${{action.ident}}(${{self.EntryType.c_ident}}*& ' 374 'm_cache_entry_ptr, const Address& addr);') |
370 else: 371 for action in self.actions.itervalues(): 372 code('/** \\brief ${{action.desc}} */') 373 code('void ${{action.ident}}(const Address& addr);') 374 375 # the controller internal variables 376 code(''' 377 --- 51 unchanged lines hidden (view full) --- 429 430 # include object classes 431 seen_types = set() 432 for var in self.objects: 433 if var.type.ident not in seen_types and not var.type.isPrimitive: 434 code('#include "mem/protocol/${{var.type.c_ident}}.hh"') 435 seen_types.add(var.type.ident) 436 | 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 |
|
437 code(''' 438$c_ident * 439${c_ident}Params::create() 440{ 441 return new $c_ident(this); 442} 443 444int $c_ident::m_num_controllers = 0; --- 10 unchanged lines hidden (view full) --- 455#endif 456 457/** \\brief constructor */ 458$c_ident::$c_ident(const Params *p) 459 : AbstractController(p) 460{ 461 m_machineID.type = MachineType_${ident}; 462 m_machineID.num = m_version; | 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; |
|
463''') | 473''') |
464 num_in_ports = len(self.in_ports) 465 code(' m_in_ports = $num_in_ports;') | |
466 code.indent() 467 468 # 469 # After initializing the universal machine parameters, initialize the | 474 code.indent() 475 476 # 477 # After initializing the universal machine parameters, initialize the |
470 # this machines config parameters. Also detemine if these configuration 471 # params include a sequencer. This information will be used later for 472 # contecting the sequencer back to the L1 cache controller. | 478 # this machines config parameters. Also if these configuration params 479 # include a sequencer, connect the it to the controller. |
473 # | 480 # |
474 contains_dma_sequencer = False 475 sequencers = [] | |
476 for param in self.config_parameters: | 481 for param in self.config_parameters: |
477 if param.name == "dma_sequencer": 478 contains_dma_sequencer = True 479 elif re.compile("sequencer").search(param.name): 480 sequencers.append(param.name) | |
481 if param.pointer: 482 code('m_${{param.name}}_ptr = p->${{param.name}};') 483 else: 484 code('m_${{param.name}} = p->${{param.name}};') | 482 if param.pointer: 483 code('m_${{param.name}}_ptr = p->${{param.name}};') 484 else: 485 code('m_${{param.name}} = p->${{param.name}};') |
485 486 # 487 # For the l1 cache controller, add the special atomic support which 488 # includes passing the sequencer a pointer to the controller. 489 # 490 for seq in sequencers: 491 code(''' 492m_${{seq}}_ptr->setController(this); 493 ''') 494 495 # 496 # For the DMA controller, pass the sequencer a pointer to the 497 # controller. 498 # 499 if self.ident == "DMA": 500 if not contains_dma_sequencer: 501 self.error("The DMA controller must include the sequencer " \ 502 "configuration parameter") 503 504 code(''' 505m_dma_sequencer_ptr->setController(this); 506''') | 486 if re.compile("sequencer").search(param.name): 487 code('m_${{param.name}}_ptr->setController(this);') |
507 | 488 |
508 code('m_num_controllers++;') | |
509 for var in self.objects: 510 if var.ident.find("mandatoryQueue") >= 0: 511 code(''' 512m_${{var.c_ident}}_ptr = new ${{var.type.c_ident}}(); 513m_${{var.c_ident}}_ptr->setReceiver(this); 514''') 515 else: 516 if "network" in var and "physical_network" in var and \ --- 170 unchanged lines hidden (view full) --- 687 688 code.dedent() 689 code(''' 690 AbstractController::init(); 691 resetStats(); 692} 693''') 694 | 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 |
695 has_mandatory_q = False | 675 mq_ident = "NULL" |
696 for port in self.in_ports: 697 if port.code.find("mandatoryQueue_ptr") >= 0: | 676 for port in self.in_ports: 677 if port.code.find("mandatoryQueue_ptr") >= 0: |
698 has_mandatory_q = True | 678 mq_ident = "m_%s_mandatoryQueue_ptr" % self.ident |
699 | 679 |
700 if has_mandatory_q: 701 mq_ident = "m_%s_mandatoryQueue_ptr" % self.ident 702 else: 703 mq_ident = "NULL" 704 | |
705 seq_ident = "NULL" 706 for param in self.config_parameters: 707 if param.name == "sequencer": 708 assert(param.pointer) 709 seq_ident = "m_%s_ptr" % param.name 710 711 code(''' 712 --- 827 unchanged lines hidden --- | 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 --- |