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; --- 430 unchanged lines hidden (view full) --- 439#include <iostream> 440#include <string> 441 442#include "mem/ruby/common/Global.hh" 443''') 444 if self.isStateDecl: 445 code('#include "mem/protocol/AccessPermission.hh"') 446 |
447 if self.isMachineType: 448 code('#include "base/misc.hh"') 449 code('#include "mem/protocol/GenericMachineType.hh"') 450 code('#include "mem/ruby/common/Address.hh"') 451 code('#include "mem/ruby/system/NodeID.hh"') 452 code('struct MachineID;') 453 |
454 code(''' 455 456// Class definition 457/** \\enum ${{self.c_ident}} 458 * \\brief ${{self.desc}} 459 */ 460enum ${{self.c_ident}} { 461 ${{self.c_ident}}_FIRST, --- 28 unchanged lines hidden (view full) --- 490 code(''' 491int ${{self.c_ident}}_base_level(const ${{self.c_ident}}& obj); 492MachineType ${{self.c_ident}}_from_base_level(int); 493int ${{self.c_ident}}_base_number(const ${{self.c_ident}}& obj); 494int ${{self.c_ident}}_base_count(const ${{self.c_ident}}& obj); 495''') 496 497 for enum in self.enums.itervalues(): |
498 if enum.ident == "DMA": 499 code(''' 500MachineID map_Address_to_DMA(const Address &addr); 501''') 502 code(''' |
503 |
504MachineID get${{enum.ident}}MachineID(NodeID RubyNode); 505''') 506 507 code(''' 508inline GenericMachineType 509ConvertMachToGenericMach(MachineType machType) 510{ 511''') 512 for enum in self.enums.itervalues(): 513 code(''' 514 if (machType == MachineType_${{enum.ident}}) 515 return GenericMachineType_${{enum.ident}}; 516''') 517 code(''' 518 panic("cannot convert to a GenericMachineType"); 519} 520''') 521 |
522 if self.isStateDecl: 523 code(''' 524 525// Code to convert the current state to an access permission 526AccessPermission ${{self.c_ident}}_to_permission(const ${{self.c_ident}}& obj); 527 528''') 529 --- 44 unchanged lines hidden (view full) --- 574 } 575} 576 577''') 578 579 if self.isMachineType: 580 for enum in self.enums.itervalues(): 581 code('#include "mem/protocol/${{enum.ident}}_Controller.hh"') |
582 code('#include "mem/ruby/system/MachineID.hh"') |
583 584 code(''' 585// Code for output operator 586ostream& 587operator<<(ostream& out, const ${{self.c_ident}}& obj) 588{ 589 out << ${{self.c_ident}}_to_string(obj); 590 out << flush; --- 157 unchanged lines hidden (view full) --- 748 code(''' 749 case ${{self.c_ident}}_NUM: 750 default: 751 panic("Invalid range for type ${{self.c_ident}}"); 752 } 753} 754''') 755 |
756 for enum in self.enums.itervalues(): 757 if enum.ident == "DMA": 758 code(''' 759MachineID 760map_Address_to_DMA(const Address &addr) 761{ 762 MachineID dma = {MachineType_DMA, 0}; 763 return dma; 764} 765''') 766 767 code(''' 768 769MachineID 770get${{enum.ident}}MachineID(NodeID RubyNode) 771{ 772 MachineID mach = {MachineType_${{enum.ident}}, RubyNode}; 773 return mach; 774} 775''') 776 |
777 # Write the file 778 code.write(path, "%s.cc" % self.c_ident) 779 780__all__ = [ "Type" ] |