コード例 #1
0
        private MICROINSTRUCTTION getInstruction()
        {
            MICROINSTRUCTTION instruction = new MICROINSTRUCTTION();

            instruction.csNC      = NC.Checked;
            instruction.csRST     = RST.Checked;
            instruction.csWMFC    = WMFC.Checked;
            instruction.csRW      = RW.Checked;
            instruction.csSETC    = SETC.Checked;
            instruction.csHLT     = HLT.Checked;
            instruction.csX       = X.Checked;
            instruction.csALU     = ALU.SelectedIndex;
            instruction.csBusAin  = BusAin.SelectedIndex;
            instruction.csBusBout = BusBout.SelectedIndex;
            instruction.csBusCin  = BusCin.SelectedIndex;
            instruction.csBusCout = BusCout.SelectedIndex;
            if (NXT.SelectedIndex == -1)
            {
                NXT.SelectedIndex = 0;
            }
            instruction.csNxt0 = (NXT.SelectedIndex & 1) > 0;
            instruction.csNxt1 = (NXT.SelectedIndex & 2) > 0;
            instruction.csNxt2 = (NXT.SelectedIndex & 4) > 0;
            return(instruction);
        }
コード例 #2
0
 private string instructionToBin(MICROINSTRUCTTION x)
 {
     return(getBin(x.csALU) + getBin(x.csBusAin) + getBin(x.csBusBout)
            + getBin(x.csBusCin) + getBin(x.csBusCout) + zo(x.csRST)
            + zo(x.csRW) + zo(x.csSETC) + zo(x.csWMFC) + zo(x.csNC) + zo(x.csX)
            + zo(x.csHLT) + zo(x.csNxt2) + zo(x.csNxt1) + zo(x.csNxt0));
 }
コード例 #3
0
        private void Add_Click(object sender, EventArgs e)
        {
            MICROINSTRUCTTION instruction = getInstruction();
            string            inst        = parseInstruction(instruction);

            Microprogram.Items.Add(inst);
            microInstructions.Add(instruction);
            microInstructionsOut.Add(inst);
            clearCurrentInst();
        }
コード例 #4
0
        private string parseInstruction(MICROINSTRUCTTION instruction)
        {
            string inst = "";
            bool   spc  = false;

            if (instruction.csBusBout != -1)
            {
                inst += (spc ? "   " : "") + BusBout.Text + "-Bout"; spc = true;
            }
            if (instruction.csBusCout != -1)
            {
                inst += (spc ? "   " : "") + BusCout.Text + "-Cout"; spc = true;
            }
            if (instruction.csBusCin != -1)
            {
                inst += (spc ? "   " : "") + BusCin.Text + "-Cin"; spc = true;
            }
            if (instruction.csNC)
            {
                inst += (spc ? "   " : "") + "NC"; spc = true;
            }
            if (instruction.csWMFC)
            {
                inst += (spc ? "   " : "") + (instruction.csRW ? "Wr" : "Rd") + "   WMFC"; spc = true;
            }
            if (instruction.csSETC)
            {
                inst += (spc ? "   " : "") + "SETC"; spc = true;
            }
            if (instruction.csALU != -1)
            {
                inst += (spc ? "   " : "") + ALU.Text; spc = true;
            }
            if (instruction.csBusAin != -1)
            {
                inst += (spc ? "   " : "") + BusAin.Text + "-Ain"; spc = true;
            }
            if (instruction.csRST)
            {
                inst += (spc ? "   " : "") + "RST"; spc = true;
            }
            if (instruction.csX)
            {
                inst += (spc ? "   " : "") + "X"; spc = true;
            }
            if (instruction.csNxt1 || instruction.csNxt0 || instruction.csNxt2)
            {
                inst += (spc ? "   " : "") + NXT.Text; spc = true;
            }
            if (instruction.csHLT)
            {
                inst += (spc ? "   " : "") + "HLT"; spc = true;
            }
            return(inst);
        }
コード例 #5
0
        private void Microprogram_SelectedIndexChanged(object sender, EventArgs e)
        {
            MICROINSTRUCTTION instruction = microInstructions.ElementAt(Microprogram.SelectedIndex);

            NC.Checked            = instruction.csNC;
            RST.Checked           = instruction.csRST;
            WMFC.Checked          = instruction.csWMFC;
            RW.Checked            = instruction.csRW;
            SETC.Checked          = instruction.csSETC;
            HLT.Checked           = instruction.csHLT;
            X.Checked             = instruction.csX;
            ALU.SelectedIndex     = instruction.csALU;
            BusAin.SelectedIndex  = instruction.csBusAin;
            BusBout.SelectedIndex = instruction.csBusBout;
            BusCin.SelectedIndex  = instruction.csBusCin;
            BusCout.SelectedIndex = instruction.csBusCout;
            NXT.SelectedIndex     = Convert.ToInt32(instruction.csNxt0) + Convert.ToInt32(instruction.csNxt1) * 2 + Convert.ToInt32(instruction.csNxt2) * 4;
        }