示例#1
0
        private static string MemoryAccess(string control, string result) //add pc so i can jump and link
        {
            Datamem.writeEHB = control.Substring(14, 5).Replace("_", ""); //Write enable, half and byte
            Datamem.DataIn(result, Register.data2);                       //perform operation

            string data = Extender.Extend(Datamem.DataOut(result).Substring(16, 16), control.Substring(20, 3));

            m4to1 = new Mux(new String[] { Datamem.DataOut(result), data, result })
            {
                select = control.Substring(26, 2)
            };
            return(m4to1.Selected());
        }
示例#2
0
        private static string AddressCalc(string instruction, string control)
        {
            c2to1 = new Mux(new String[] { Register.data1, instruction.Substring(6, 5) });
            d2to1 = new Mux(new String[] { Register.data2, Extender.Extend(instruction.Substring(16, 16), control.Substring(20, 1) + "0") });
            string selection = control.Substring(4, 4).Replace("_", "");

            c2to1.select = selection[0].ToString();
            d2to1.select = selection[1].ToString();

            string result = ALU.Result(c2to1.Selected(), d2to1.Selected(), control.Substring(9, 4));

            return(result);
        }