Exemple #1
0
        public void objektNoveId(String id, String nId)
        {
            Objekt o = objekty[id];

            objekty.Remove(id);
            objekty[nId] = o;
        }
Exemple #2
0
        String generujProgram(Struktura korenProgramu)
        {
            String program = Objekt.tabulator(1) + "always {\r\n";

            /*foreach (Objekt o in objekty.Values)
             * {
             *      if (o is VolanieFunkcie)
             *      {
             *              program += o.generujInit();
             *      }
             * }*/
            if (vystupy != null)
            {
                for (int i = 0; i < vystupy.Count; i++)
                {
                    program += Objekt.tabulator(2) + vystupy[i].meno + " = ";
                    if (vystupy[i].bitSirka == 1)
                    {
                        program += "0";
                    }
                    else
                    {
                        program += vystupy[i].bitSirka + "x{{" + vystupy[i].bitDlzka + "hxx}}";
                    }
                    program += ";\r\n";
                }
            }
            foreach (Struktura s in korenProgramu.deti)
            {
                program += s.strukturujLucidKod(this, 2);
            }
            program += Objekt.tabulator(1) + "}\r\n}";
            return(program);
        }
Exemple #3
0
        String generujRegistreAClkModuly(Dictionary <String, String> moduly)
        {
            if (!Projekt.DATABAZA[meno].clkRstSignal || (registre.Count == 0 && moduly.Count == 0))
            {
                return("");
            }
            String vysl = "";

            vysl += Objekt.tabulator(1) + ".clk(clk) {\r\n" + Objekt.tabulator(2) + ".rst(rst) {\r\n";
            for (int i = 0; i < registre.Count; i++)
            {
                vysl += Objekt.tabulator(3) + "dff " + registre[i].meno;
                if (registre[i].bitSirka > 1)
                {
                    vysl += "[" + registre[i].bitSirka + "]";
                }
                vysl += "[" + registre[i].bitDlzka + "]";
                vysl += ";\r\n";
            }
            foreach (KeyValuePair <String, String> entry in moduly)
            {
                vysl += Objekt.tabulator(2) + entry.Value + " " + entry.Key + ";\r\n";
            }
            vysl += Objekt.tabulator(2) + "}\r\n" + Objekt.tabulator(1) + "}\r\n\r\n";

            return(vysl);
        }
Exemple #4
0
        String generujIo()
        {
            String io = "";

            foreach (BodkaInfo info in vstupy)
            {
                io += Objekt.tabulator(2) + "input " + info.meno;
                if (info.bitSirka > 1)
                {
                    io += "[" + info.bitSirka + "]";
                }
                io += "[" + info.bitDlzka + "],\r\n";
            }
            for (int i = 0; i < vystupy.Count; i++)
            {
                BodkaInfo info = vystupy[i];
                io += Objekt.tabulator(2) + "output " + info.meno;
                if (info.bitSirka > 1)
                {
                    io += "[" + info.bitSirka + "]";
                }
                io += "[" + info.bitDlzka + "]";
                if (i + 1 < vystupy.Count)
                {
                    io += ",";
                }
                io += "\r\n";
            }
            io += Objekt.tabulator(1) + ") {\r\n\r\n";
            return(io);
        }
Exemple #5
0
        public void priradObjektIfBloku(Objekt o)
        {
            IfBlok blok = null;

            for (int i = 0; i < ifBloky.Count; i++)
            {
                IfBlok tempBlok = ifBloky[i];
                if (tempBlok.jeVBloku(o.getX(), o.getY()))
                {
                    if (blok == null)
                    {
                        blok = tempBlok;
                    }
                    else if (o.getX() - blok.getX() > o.getX() - tempBlok.getX())
                    {
                        blok = tempBlok;
                    }
                }
            }
            if (blok != null)
            {
                if (!blok.objekty.Contains(o))
                {
                    blok.objekty.Add(o);
                    o.ifBlok = blok;
                }
            }
            else if (o.ifBlok != null)
            {
                o.ifBlok.objekty.Remove(o);
            }
        }
Exemple #6
0
        String generujLucidProjektInfo(Dictionary <String, Objekt> generovaneModuly)
        {
            String vysl = "";

            vysl += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
            vysl += "<project name=\"" + meno + "\" board=\"Mojo V3\" language=\"Lucid\">\r\n";
            vysl += Objekt.tabulator(1) + "<files>\r\n";
            vysl += Objekt.tabulator(2) + "<src top=\"true\">mojo_top.luc</src>\r\n";
            foreach (String modul in generovaneModuly.Keys)
            {
                vysl += Objekt.tabulator(2) + "<src>" + modul + generovaneModuly[modul].typModulu() + "</src>\r\n";
            }
            foreach (Modul m in moduly)
            {
                vysl += Objekt.tabulator(2) + "<src>" + m.meno + ".luc</src>\r\n";
            }
            vysl += Objekt.tabulator(2) + "<ucf lib=\"true\">mojo.ucf</ucf>\r\n";
            vysl += Objekt.tabulator(2) + "<component>spi_slave.luc</component>\r\n";
            vysl += Objekt.tabulator(2) + "<component>uart_rx.luc</component>\r\n";
            vysl += Objekt.tabulator(2) + "<component>cclk_detector.luc</component>\r\n";
            vysl += Objekt.tabulator(2) + "<component>reset_conditioner.luc</component>\r\n";
            vysl += Objekt.tabulator(2) + "<component>uart_tx.luc</component>\r\n";
            vysl += Objekt.tabulator(2) + "<component>avr_interface.luc</component>\r\n";
            vysl += Objekt.tabulator(1) + "</files>\r\n";
            vysl += "</project>\r\n";
            return(vysl);
        }
Exemple #7
0
 public ObjektBodka(int nX, int nY, Brush nStav, Objekt nObj, int nId, BodkaInfo nInfo)
     : base(nX, nY, 4, nStav)
 {
     obj = nObj;
     id  = nId;
     if (nInfo != null)
     {
         info = new BodkaInfo(nInfo.meno, nInfo.bitSirka, nInfo.bitSirkaZmena, nInfo.bitDlzka, nInfo.bitDlzkaZmena);
     }
 }
Exemple #8
0
        String generujModuly(Dictionary <String, String> moduly)
        {
            String vysl = "";

            foreach (KeyValuePair <String, String> entry in moduly)
            {
                vysl += Objekt.tabulator(1) + entry.Value + " " + entry.Key + ";\r\n";
            }
            return(vysl + "\r\n");
        }
Exemple #9
0
        String generujModul()
        {
            String modul = "module " + meno + " (\r\n";

            if (Projekt.DATABAZA[meno].clkRstSignal)
            {
                modul += Objekt.tabulator(2) + "input clk,\r\n";
                modul += Objekt.tabulator(2) + "input rst,\r\n";
            }
            return(modul);
        }
Exemple #10
0
        public String strukturujLucidKod(Modul f, int tab)
        {
            String vysl;

            if (deti.Count > 0)
            {
                deti.Sort();
                vysl = f.objekty[id].generujLucidKod(f, tab);
                foreach (Struktura s in deti)
                {
                    vysl += s.strukturujLucidKod(f, tab + 1);
                }
                vysl += Objekt.tabulator(tab) + "}\r\n";
            }
            else
            {
                vysl = f.objekty[id].generujLucidKod(f, tab);
            }
            return(vysl);
        }
Exemple #11
0
 void nastavOpVlastnosti(Objekt o)
 {
     o.nastavEditovaciePrvky(panel1);
     if (o is Register)
     {
         registerComboBox();
     }
     else if (o is IoOperacia)
     {
         if (o.op == "in")
         {
             vstupComboBox();
         }
         else if (o.op == "out")
         {
             vystupComboBox();
         }
     }
     o.pridajOkTlacitko(this);
 }