isa_parser.py (7092:fbdf4fca0844) isa_parser.py (7720:65d338a8dba4)
1# Copyright (c) 2003-2005 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 667 unchanged lines hidden (view full) ---

676 return self.buildWriteCode()
677 return ''
678
679 # Return the memory access size *in bits*, suitable for
680 # forming a type via "uint%d_t". Divide by 8 if you want bytes.
681 def makeAccSize(self):
682 return self.size
683
1# Copyright (c) 2003-2005 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 667 unchanged lines hidden (view full) ---

676 return self.buildWriteCode()
677 return ''
678
679 # Return the memory access size *in bits*, suitable for
680 # forming a type via "uint%d_t". Divide by 8 if you want bytes.
681 def makeAccSize(self):
682 return self.size
683
684class PCOperand(Operand):
684class PCStateOperand(Operand):
685 def makeConstructor(self):
686 return ''
687
688 def makeRead(self):
685 def makeConstructor(self):
686 return ''
687
688 def makeRead(self):
689 return '%s = xc->readPC();\n' % self.base_name
689 return '%s = xc->pcState();\n' % self.base_name
690
691 def makeWrite(self):
690
691 def makeWrite(self):
692 return 'xc->setPC(%s);\n' % self.base_name
692 return 'xc->pcState(%s);\n' % self.base_name
693
693
694class UPCOperand(Operand):
694 def makeDecl(self):
695 return 'TheISA::PCState ' + self.base_name + ' M5_VAR_USED;\n';
696
697class PCOperand(Operand):
695 def makeConstructor(self):
696 return ''
697
698 def makeRead(self):
698 def makeConstructor(self):
699 return ''
700
701 def makeRead(self):
699 if self.read_code != None:
700 return self.buildReadCode('readMicroPC')
701 return '%s = xc->readMicroPC();\n' % self.base_name
702 return '%s = xc->instAddr();\n' % self.base_name
702
703
703 def makeWrite(self):
704 if self.write_code != None:
705 return self.buildWriteCode('setMicroPC')
706 return 'xc->setMicroPC(%s);\n' % self.base_name
707
708class NUPCOperand(Operand):
704class UPCOperand(Operand):
709 def makeConstructor(self):
710 return ''
711
712 def makeRead(self):
713 if self.read_code != None:
705 def makeConstructor(self):
706 return ''
707
708 def makeRead(self):
709 if self.read_code != None:
714 return self.buildReadCode('readNextMicroPC')
715 return '%s = xc->readNextMicroPC();\n' % self.base_name
710 return self.buildReadCode('microPC')
711 return '%s = xc->microPC();\n' % self.base_name
716
712
717 def makeWrite(self):
718 if self.write_code != None:
719 return self.buildWriteCode('setNextMicroPC')
720 return 'xc->setNextMicroPC(%s);\n' % self.base_name
721
722class NPCOperand(Operand):
723 def makeConstructor(self):
724 return ''
725
726 def makeRead(self):
727 if self.read_code != None:
713class NPCOperand(Operand):
714 def makeConstructor(self):
715 return ''
716
717 def makeRead(self):
718 if self.read_code != None:
728 return self.buildReadCode('readNextPC')
729 return '%s = xc->readNextPC();\n' % self.base_name
719 return self.buildReadCode('nextInstAddr')
720 return '%s = xc->nextInstAddr();\n' % self.base_name
730
721
731 def makeWrite(self):
732 if self.write_code != None:
733 return self.buildWriteCode('setNextPC')
734 return 'xc->setNextPC(%s);\n' % self.base_name
735
736class NNPCOperand(Operand):
737 def makeConstructor(self):
738 return ''
739
740 def makeRead(self):
741 if self.read_code != None:
742 return self.buildReadCode('readNextNPC')
743 return '%s = xc->readNextNPC();\n' % self.base_name
744
745 def makeWrite(self):
746 if self.write_code != None:
747 return self.buildWriteCode('setNextNPC')
748 return 'xc->setNextNPC(%s);\n' % self.base_name
749
750class OperandList(object):
751 '''Find all the operands in the given code block. Returns an operand
752 descriptor list (instance of class OperandList).'''
753 def __init__(self, parser, code):
754 self.items = []
755 self.bases = {}
756 # delete comments so we don't match on reg specifiers inside
757 code = commentRE.sub('', code)

--- 1325 unchanged lines hidden ---
722class OperandList(object):
723 '''Find all the operands in the given code block. Returns an operand
724 descriptor list (instance of class OperandList).'''
725 def __init__(self, parser, code):
726 self.items = []
727 self.bases = {}
728 # delete comments so we don't match on reg specifiers inside
729 code = commentRE.sub('', code)

--- 1325 unchanged lines hidden ---