예제 #1
0
파일: In_Branch.cs 프로젝트: wiglz4/ARMsim
 public In_Branch(Registers toRegister, Memory toMemory, uint toInstruction, bool toDisassembling)
 {
     myRegister = toRegister;
     myMemory = toMemory;
     disassembling = toDisassembling;
     instruction = toInstruction;
 }
예제 #2
0
파일: CPU.cs 프로젝트: wiglz4/ARMsim
 //Method:       Constructor
 //Purpose:      Sets CPU up for use.
 //Variables:    toMemory - Memory object that Computer setup.
 //              toRegisters - Registers object that Computer setup.
 //              programCounter - uint signifying where to start fetch at.
 public CPU(Memory toMemory, Registers toRegisters, uint programCounter)
 {
     disassembling = false;
     myMemory = toMemory;
     myRegisters = toRegisters;
     myRegisters.WriteWord(15, programCounter);
 }
예제 #3
0
 public In_ls_OperandTwo(Registers toRegisters, uint toInstruction)
 {
     instruction = toInstruction;
     myRegisters = toRegisters;
     if (Instructions.getSectionValue(23, 23, instruction) == 0)
     {
         uSign = "-";
     }
 }
예제 #4
0
파일: Computer.cs 프로젝트: wiglz4/ARMsim
 //Method:       Constructor
 //Purpose:      Sets Computer up for use.
 //Variables:    toOptions -   Options parsed from command line input.
 public Computer(Options toOptions)
 {
     myOptions = toOptions;
     myRam = new Memory(myOptions.GetMemSize());
     myRam.myComputer = this;
     myLoader = new Loader(myOptions, myRam);
     myLoader.Load();
     myRegisters = new Registers();
     myCPU = new CPU(myRam, myRegisters, myLoader.getProgramCounter());
     trace = true;
     FileStream myFileStream = new FileStream("trace.log", FileMode.Create);
     myFileStream.Close();
     stepNum = 0;
     storedBranchPC = 0;
     input = new Queue<char>();
     outputQ = new Queue<char>();
 }
예제 #5
0
        //stores generic information about all decoded arm instructions

        //decodes bits 27-26 and returns specified instruction type
        public static Instructions decode(uint instruction, Registers myRegisters, Memory myMemory, bool disassembling)
        {

            // check opcodes here
            dontDoItBro = false;
            firstOpcode = passOpcode(getSectionValue(31, 28, instruction), myMemory);
            if (firstOpcode == null)
            {
                dontDoItBro = true;
                return null;
                //get outta here. this instructions a bad one
            }

            //handle specials here
            In_Special sInstruction = new In_Special(myRegisters, myMemory, instruction, disassembling);

            if (sInstruction.isSpecial())
            {
                return sInstruction;
            }

            if (getSectionValue(27, 20, instruction) == 18 && getSectionValue(7, 4, instruction) == 1)
            {
                return new In_Branch(myRegisters, myMemory, instruction, disassembling);
            }

            else
            {
                //previously checked only bits 27, - 26
                uint type = getSectionValue(27, 25, instruction);
                if (type == 0 || type == 1)
                {
                    return new In_DataProcessing(myRegisters, myMemory, instruction, disassembling);
                }
                if (type == 2 || type == 3 || type == 4)
                {
                    return new In_LoadStore(myRegisters, myMemory, instruction, disassembling);
                }
                else
                {
                    return new In_Branch(myRegisters, myMemory, instruction, disassembling);
                }
            }
        }
예제 #6
0
 public In_dp_OperandTwo(Registers toRegisters, uint toInstruction)
 {
     instruction = toInstruction;
     myRegisters = toRegisters;
 }
예제 #7
0
 public In_dp_OperandTwo(Registers toRegisters, uint toInstruction)
 {
     instruction = toInstruction;
     myRegisters = toRegisters;
 }