Ejemplo n.º 1
0
        //RUN
        private void button4_Click(object sender, EventArgs e)
        {
            program      = System.IO.File.ReadAllText(PATH);
            instructions = new List <string>(program.Split('\n'));
            Assembler();

            int    exitCode;
            string errors;
            string output;

            ExecutionHandler.CompileAll(out exitCode, out errors);

            if (exitCode != 0)
            {
                GUIDriver.mainForm.OnCompiled(exitCode, errors);
                GUIDriver.ShowIDE();
                return;
            }


            ExecutionHandler.Simulate(out exitCode, out errors, out output);

            if (exitCode != 0 && exitCode != -1)
            {
                GUIDriver.mainForm.OnSimulated(exitCode, errors, output);
                GUIDriver.ShowIDE();
                return;
            }

            ExecutionHandler.DrawWave();
        }
Ejemplo n.º 2
0
        private void Run_Click(object sender, EventArgs e)
        {
            StreamReader sr  = new StreamReader(Path.Combine(Application.StartupPath, "Testbench.v"));
            string       all = sr.ReadToEnd();

            sr.Close();
            if (!all.Contains("endmodule"))
            {
                string[]     FooterText = { "join", "always", "begin", "#1", " CLK = ~CLK;", "end", "endmodule" };
                StreamWriter sw         = new StreamWriter(Path.Combine(Application.StartupPath, "Testbench.v"), true);
                foreach (string line in FooterText)
                {
                    sw.WriteLine(line);
                }

                sw.Close();
            }

            //Start Icarus and Waveform

            //Opening the file
            string text = " ";

            try
            {
                FileHandler.OpenFileAbsolute(Path.Combine(Application.StartupPath, "Testbench.v"), out text);
            }
            catch (Exception ex)
            {
                GUIDriver.ShowIDE();
                return;
            }

            GUIDriver.mainForm.OnFileOpened(text);

            int    exitCode;
            string errors;
            string output;

            ExecutionHandler.CompileAll(out exitCode, out errors);

            if (exitCode != 0)
            {
                GUIDriver.mainForm.OnCompiled(exitCode, errors);
                GUIDriver.ShowIDE();
                return;
            }


            ExecutionHandler.Simulate(out exitCode, out errors, out output);

            if (exitCode != 0 && exitCode != -1)
            {
                GUIDriver.mainForm.OnSimulated(exitCode, errors, output);
                GUIDriver.ShowIDE();
                return;
            }

            ExecutionHandler.DrawWave();
        }
Ejemplo n.º 3
0
        private void compileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            toolStripStatusLabel1.Text = "Running the compiler...";
            string errors = "";
            int    exitCode;

            ExecutionHandler.CompileAll(out exitCode, out errors);

            OnCompiled(exitCode, errors);
        }
Ejemplo n.º 4
0
        private void simulateToolStripMenuItem_Click(object sender, EventArgs e)
        {
            toolStripStatusLabel1.Text = "Running the simulator...";
            string errors = "";
            string output = "";
            int    exitCode;

            ExecutionHandler.Simulate(out exitCode, out errors, out output);

            OnSimulated(exitCode, errors, output);
        }
Ejemplo n.º 5
0
 private void waveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     toolStripStatusLabel1.Text = "Drawing Wave...";
     ExecutionHandler.DrawWave();
     toolStripStatusLabel1.Text = "Wave Drawing Ended";
 }