From addadebf1ddb6a0fcb770ad68470d39c38ddd80b Mon Sep 17 00:00:00 2001 From: Rodrigo CORTES PORTO <Rodrigo.Cortes-porto@lip6.fr> Date: Tue, 17 Jul 2018 17:23:09 +0200 Subject: [PATCH] Merging syscams branch. Adding code to generate AMS cluster-gpio2vci module- in the topCell --- .../ddtranslatorSoclib/AvatarAmsCluster.java | 91 +++++++++++++++++++ .../AvatarddSpecification.java | 16 ++++ .../toTopCell/Declaration.java | 23 +++++ .../ddtranslatorSoclib/toTopCell/Header.java | 5 + .../toTopCell/MappingTable.java | 11 ++- .../ddtranslatorSoclib/toTopCell/NetList.java | 65 +++++++++++++ .../toTopCell/Platforminfo.java | 7 ++ .../ddtranslatorSoclib/toTopCell/Signal.java | 55 ++++++----- .../ui/AvatarDeploymentPanelTranslator.java | 16 ++++ 9 files changed, 265 insertions(+), 24 deletions(-) create mode 100644 src/main/java/ddtranslatorSoclib/AvatarAmsCluster.java diff --git a/src/main/java/ddtranslatorSoclib/AvatarAmsCluster.java b/src/main/java/ddtranslatorSoclib/AvatarAmsCluster.java new file mode 100644 index 0000000000..92f13021d6 --- /dev/null +++ b/src/main/java/ddtranslatorSoclib/AvatarAmsCluster.java @@ -0,0 +1,91 @@ +/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille + * Daniela Genius, Lip6, UMR 7606 + * + * ludovic.apvrille AT enst.fr + * daniela.genius@lip6.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + + + + +/** + * Class AvatarAmsCluster + * Creation: 18/06/2018 + * @version 1.0 13/07/2018 + * @author Rodrigo CORTES PORTO */ + + +package ddtranslatorSoclib; + +public class AvatarAmsCluster extends AvatarComponent { + + private String amsClusterName; + private int no_amsCluster; + private int no_cluster; + private int no_target; + + public AvatarAmsCluster(String _amsClusterName, int _no_amsCluster, int _no_cluster) { + amsClusterName = _amsClusterName; + no_amsCluster = _no_amsCluster; + no_cluster = _no_cluster; + } + + public String getAmsClusterName() { + return amsClusterName; + } + + public int getNo_amsCluster() { + return no_amsCluster; + } + + public int getNo_cluster() { + return no_cluster; + } + + public int getNo_target() { + return no_target; + } + + public void setNo_cluster(int _no_cluster) { + no_cluster = _no_cluster; + } + + public void setNo_target(int _no_target) { + no_target = _no_target; + } +} + diff --git a/src/main/java/ddtranslatorSoclib/AvatarddSpecification.java b/src/main/java/ddtranslatorSoclib/AvatarddSpecification.java index d8126780f2..2720b8094b 100755 --- a/src/main/java/ddtranslatorSoclib/AvatarddSpecification.java +++ b/src/main/java/ddtranslatorSoclib/AvatarddSpecification.java @@ -244,6 +244,18 @@ There always is a RAM0, a TTY and an interconnect (Bus or VGMN or crossbar) othe return hwas; }*/ + public LinkedList<AvatarAmsCluster> getAllAmsCluster(){ + //int i=0; + LinkedList<AvatarAmsCluster> amsClusters = new LinkedList<AvatarAmsCluster>(); + for (AvatarComponent amsCluster : components ) + { + if (amsCluster instanceof AvatarAmsCluster){ + amsClusters.add((AvatarAmsCluster)amsCluster); + } + } + return amsClusters; + } + public int getNbCPU(){ return (getAllCPU()).size(); } @@ -272,6 +284,10 @@ There always is a RAM0, a TTY and an interconnect (Bus or VGMN or crossbar) othe return (getAllCoproMWMR()).size(); } + public int getNbAmsCluster(){ + return (getAllAmsCluster()).size(); + } + // for construction of the central interconnect public int getNb_init(){ diff --git a/src/main/java/ddtranslatorSoclib/toTopCell/Declaration.java b/src/main/java/ddtranslatorSoclib/toTopCell/Declaration.java index b30cd44132..b89634fbd7 100755 --- a/src/main/java/ddtranslatorSoclib/toTopCell/Declaration.java +++ b/src/main/java/ddtranslatorSoclib/toTopCell/Declaration.java @@ -581,6 +581,29 @@ public class Declaration } } + /** AMS Clusters + */ + if (nb_clusters == 0) + { + for (AvatarAmsCluster amsCluster:TopCellGenerator.avatardd.getAllAmsCluster ()) + { + declaration += + "caba::Gpio2Vci<vci_param> " + amsCluster.getAmsClusterName () + + "(\"" + amsCluster.getAmsClusterName () + "\", IntTab(" + + amsCluster.getNo_target () + "), maptab);" + CR; + } + } else //nb_clusters != 0 + { + for (AvatarAmsCluster amsCluster:TopCellGenerator.avatardd.getAllAmsCluster ()) + { + declaration += + "caba::Gpio2Vci<vci_param> " + amsCluster.getAmsClusterName () + + "(\"" + amsCluster.getAmsClusterName () + "\", IntTab(" + + amsCluster.getNo_cluster () + "," + amsCluster.getNo_target () + + "), maptab);" + CR; + } + } + return declaration; } diff --git a/src/main/java/ddtranslatorSoclib/toTopCell/Header.java b/src/main/java/ddtranslatorSoclib/toTopCell/Header.java index c3d304aced..12ea703fd7 100755 --- a/src/main/java/ddtranslatorSoclib/toTopCell/Header.java +++ b/src/main/java/ddtranslatorSoclib/toTopCell/Header.java @@ -64,6 +64,7 @@ public class Header public static String getHeader () { int with_vgsb = TopCellGenerator.avatardd.getAllBus ().size (); + int with_amsCluster = TopCellGenerator.avatardd.getNbAmsCluster(); header = "//-------------------------------Header------------------------------------" @@ -152,6 +153,10 @@ public class Header "#include \"vci_rttimer.h\"" + CR + "#include \"vci_logger.h\"" + CR + "#include \"vci_local_crossbar.h\"" + CR2; + if (with_amsCluster > 0) { + header += "#include \"gpio2vci.h\"" + CR2; + } + header = header + "namespace {" + CR + "std::vector<std::string> stringArray(" + CR + " const char *first, ... )" + CR diff --git a/src/main/java/ddtranslatorSoclib/toTopCell/MappingTable.java b/src/main/java/ddtranslatorSoclib/toTopCell/MappingTable.java index c78a6fd576..f7678b70c4 100755 --- a/src/main/java/ddtranslatorSoclib/toTopCell/MappingTable.java +++ b/src/main/java/ddtranslatorSoclib/toTopCell/MappingTable.java @@ -167,7 +167,16 @@ public class MappingTable { mapping = mapping + "maptab.add(Segment(\"vci_ethernet\", 0xd5000000, 0x00000020, IntTab("+(l+2)+"), false));" + CR; mapping = mapping + "maptab.add(Segment(\"vci_block_device\", 0xd1200000, 0x00000020, IntTab("+(l+3)+"), false));" + CR2; //mapping = mapping + "maptab.add(Segment(\"vci_locks\", 0xC0200000, 0x00000100, IntTab("+(l+4)+"), false));" + CR2; - + +//AMS Cluster: TODO: Need to adapt this to new version and improve address calculation. + i=l+4; + for (AvatarAmsCluster amsCluster:TopCellGenerator.avatardd.getAllAmsCluster ()) { + amsCluster.setNo_target(i); + mapping += "maptab.add(Segment(\"gpio2vci"+amsCluster.getNo_amsCluster()+"\" , 0xd"+ + Integer.toHexString(7+amsCluster.getNo_amsCluster()) + + "200000, 0x00000010, IntTab(" +amsCluster.getNo_target() +"), false));" + CR; + i++; + } /* Instanciation of the MWMR wrappers for hardware accellerators */ /* The accelerators themselves are specifies on DIPLODOCUS level */ diff --git a/src/main/java/ddtranslatorSoclib/toTopCell/NetList.java b/src/main/java/ddtranslatorSoclib/toTopCell/NetList.java index 5c2b98e119..413b8882df 100755 --- a/src/main/java/ddtranslatorSoclib/toTopCell/NetList.java +++ b/src/main/java/ddtranslatorSoclib/toTopCell/NetList.java @@ -50,6 +50,7 @@ import ddtranslatorSoclib.AvatarCPU; import ddtranslatorSoclib.AvatarCoproMWMR; import ddtranslatorSoclib.AvatarRAM; import ddtranslatorSoclib.AvatarTTY; +import ddtranslatorSoclib.AvatarAmsCluster; public class NetList { @@ -779,6 +780,53 @@ public class NetList int p = 0; + //AMS Cluster Netlist + netlist = netlist + "// AMS Cluster netlist" + CR2; + i = 0; + for (AvatarAmsCluster amsCluster:TopCellGenerator.avatardd.getAllAmsCluster ()) + { + netlist = + netlist + amsCluster.getAmsClusterName () + ".p_clk(signal_clk);" + CR; + netlist = + netlist + amsCluster.getAmsClusterName () + ".p_resetn(signal_resetn);" + CR; + netlist = + netlist + amsCluster.getAmsClusterName () + ".p_vci(signal_vci_gpio2vci" + i + ");" + CR; + netlist = + netlist + amsCluster.getAmsClusterName () + ".p_rdata_ams(signal_from_ams" + i + ");" + CR; + netlist = + netlist + amsCluster.getAmsClusterName () + ".p_wdata_ams(signal_to_ams" + i + ");" + CR2; + if (nb_clusters == 0) + { + if (icn == "vgmn") + { + netlist = + netlist + "vgmn.p_to_target[" + + amsCluster.getNo_target () + "](signal_vci_gpio2vci" + i + + ");" + CR2; + } + else + { + netlist = + netlist + "vgsb.p_to_target[" + + amsCluster.getNo_target () + "](signal_vci_gpio2vci" + i + + ");" + CR2; + } + } + + //we have a clustered architecture: identify local crossbar + else + { + for (j = 0; j < nb_clusters; j++) + { + netlist = + netlist + "crossbar" + j + ".p_to_target[" + + amsCluster.getNo_target () + "](signal_vci_gpio2vci" + j + + ");" + CR2; + } + } + i++; + } + //generate trace file if marked trace option if (tracing) @@ -865,6 +913,23 @@ public class NetList } } } + + i = 0; + for (AvatarAmsCluster amsCluster:TopCellGenerator.avatardd.getAllAmsCluster ()) + { + + netlist += + "sc_trace(tf,signal_vci_gpio2vci" + i + + ",\"signal_vci_gpio2vci" + i + "\");" + CR; + netlist += + "sc_trace(tf,signal_from_ams" + i + + ",\"signal_from_ams" + i + "\");" + CR; + netlist += + "sc_trace(tf,signal_to_ams" + i + + ",\"signal_to_ams" + i + "\");" + CR; + i++; + } + netlist = netlist + " sc_core::sc_start(sc_core::sc_time(0, sc_core::SC_NS));" + CR; diff --git a/src/main/java/ddtranslatorSoclib/toTopCell/Platforminfo.java b/src/main/java/ddtranslatorSoclib/toTopCell/Platforminfo.java index c384202c6c..b45598dba8 100755 --- a/src/main/java/ddtranslatorSoclib/toTopCell/Platforminfo.java +++ b/src/main/java/ddtranslatorSoclib/toTopCell/Platforminfo.java @@ -61,6 +61,9 @@ public class Platforminfo int with_vgsb = TopCellGenerator.avatardd.getAllBus ().size (); int nb_hwa = TopCellGenerator.avatardd.getAllCoproMWMR ().size (); + //Determine if AMS Cluster is present in Avatar DD + int with_amsCluster = TopCellGenerator.avatardd.getNbAmsCluster(); + //bus can be other than VGSB (CAN...), for the moment restricted to VGSB String platforminfo = CR; platforminfo += "use = [" + CR @@ -128,6 +131,10 @@ public class Platforminfo } } + if (with_amsCluster > 0) { + platforminfo += "Uses('caba:gpio2vci')," + CR; + } + platforminfo += "Uses('common:elf_file_loader')," + CR + "Uses('common:plain_file_loader')," + CR + diff --git a/src/main/java/ddtranslatorSoclib/toTopCell/Signal.java b/src/main/java/ddtranslatorSoclib/toTopCell/Signal.java index a233537b4e..a6df8964e2 100755 --- a/src/main/java/ddtranslatorSoclib/toTopCell/Signal.java +++ b/src/main/java/ddtranslatorSoclib/toTopCell/Signal.java @@ -51,6 +51,7 @@ package ddtranslatorSoclib.toTopCell; import ddtranslatorSoclib.AvatarCoproMWMR; import ddtranslatorSoclib.AvatarRAM; import ddtranslatorSoclib.AvatarTTY; +import ddtranslatorSoclib.AvatarAmsCluster; public class Signal { @@ -138,41 +139,49 @@ for (AvatarCoproMWMR copro : TopCellGenerator.avatardd.getAllCoproMWMR()) { for (AvatarRAM ram : TopCellGenerator.avatardd.getAllRAM()){ // signal = signal + "soclib::caba::VciSignals<vci_param> signal_vci_vciram" + ram.getIndex() // + "(\"signal_vci_vciram" + ram.getIndex() + "\");" + CR2; - signal = signal + "soclib::caba::VciSignals<vci_param> signal_vci_vciram" + i + signal = signal + "soclib::caba::VciSignals<vci_param> signal_vci_vciram" + i + "(\"signal_vci_vciram" + i + "\");" + CR2; - i++; + i++; } i = 0; for (AvatarTTY tty : TopCellGenerator.avatardd.getAllTTY()){ //signal = signal + "soclib::caba::VciSignals<vci_param> signal_vci_tty"+tty.getNo_tty()+"(\"signal_vci_tty"+tty.getNo_tty()+"\");" + CR2; -signal = signal + "soclib::caba::VciSignals<vci_param> signal_vci_tty"+i+"(\"signal_vci_tty"+i+"\");" + CR2; -i++; + signal = signal + "soclib::caba::VciSignals<vci_param> signal_vci_tty"+i+"(\"signal_vci_tty"+i+"\");" + CR2; + i++; } // signal = signal + " sc_core::sc_signal<bool> signal_xicu_irq[xicu_n_irq];" + CR2; // System.out.print("number of processors : " + TopCellGenerator.avatardd.getNbCPU()+"\n"); - - } - - - -else{ - for (AvatarRAM ram : TopCellGenerator.avatardd.getAllRAM()) - signal = signal + "soclib::caba::VciSignals<vci_param> signal_vci_vciram" + ram.getIndex() - + "(\"signal_vci_vciram" + ram.getIndex() + "\");" + CR2; i=0; - for (AvatarTTY tty : TopCellGenerator.avatardd.getAllTTY()){ - // signal = signal + "soclib::caba::VciSignals<vci_param> signal_vci_tty"+tty.getNo_tty()+"(\"signal_vci_tty"+tty.getNo_tty()+"\");" + CR2; -signal = signal + "soclib::caba::VciSignals<vci_param> signal_vci_tty"+i+"(\"signal_vci_tty"+i+"\");" + CR2; - i++; - } - int p=0; - // if (with_hw_accellerator>0){ //DG 23.08. - - + i = 0; + for (AvatarAmsCluster amsCluster:TopCellGenerator.avatardd.getAllAmsCluster ()) { + signal = signal + "soclib::caba::VciSignals<vci_param> signal_vci_gpio2vci"+i+"(\"signal_vci_gpio2vci"+i+"\");" + CR; + signal = signal + "sc_signal< vci_param::data_t > signal_to_ams"+i+"(\"signal_to_ams"+i+"\");" + CR; + signal = signal + "sc_signal< vci_param::data_t > signal_from_ams"+i+"(\"signal_from_ams"+i+"\");" + CR2; + i++; + } + } else { + for (AvatarRAM ram : TopCellGenerator.avatardd.getAllRAM()) + signal = signal + "soclib::caba::VciSignals<vci_param> signal_vci_vciram" + ram.getIndex() + + "(\"signal_vci_vciram" + ram.getIndex() + "\");" + CR2; i=0; + for (AvatarTTY tty : TopCellGenerator.avatardd.getAllTTY()){ + // signal = signal + "soclib::caba::VciSignals<vci_param> signal_vci_tty"+tty.getNo_tty()+"(\"signal_vci_tty"+tty.getNo_tty()+"\");" + CR2; + signal = signal + "soclib::caba::VciSignals<vci_param> signal_vci_tty"+i+"(\"signal_vci_tty"+i+"\");" + CR2; + i++; + } + int p=0; + // if (with_hw_accellerator>0){ //DG 23.08. + + i = 0; + for (AvatarAmsCluster amsCluster:TopCellGenerator.avatardd.getAllAmsCluster ()) { + signal = signal + "soclib::caba::VciSignals<vci_param> signal_vci_gpio2vci"+i+"(\"signal_vci_gpio2vci"+i+"\");" + CR; + signal = signal + "sc_signal< vci_param::data_t > signal_to_ams"+i+"(\"signal_to_ams"+i+"\");" + CR; + signal = signal + "sc_signal< vci_param::data_t > signal_from_ams"+i+"(\"signal_from_ams"+i+"\");" + CR2; + i++; + } -} + } return signal; } diff --git a/src/main/java/ui/AvatarDeploymentPanelTranslator.java b/src/main/java/ui/AvatarDeploymentPanelTranslator.java index b386c6dc8e..5855820431 100644 --- a/src/main/java/ui/AvatarDeploymentPanelTranslator.java +++ b/src/main/java/ui/AvatarDeploymentPanelTranslator.java @@ -78,6 +78,7 @@ public class AvatarDeploymentPanelTranslator private int nb_target = 6; private int no_tty = 0; + private int no_amsCluster = 0; private int nb_clusters = 0; private List < TGComponent > tgcComponents; @@ -383,6 +384,21 @@ public class AvatarDeploymentPanelTranslator avatarComponents.add (avram); } } + else if (dp instanceof ADDClusterNode) + { + ADDClusterNode amsCluster = (ADDClusterNode) dp; + + String amsClusterName = amsCluster.getNodeName (); + System.out.println("****TEST inside ADDclusterNode IF - name: " + amsClusterName); + System.out.println("****TEST ADDclusterNode no_amsCluster: " + no_amsCluster); + + AvatarAmsCluster avamscluster = new AvatarAmsCluster (amsClusterName, no_amsCluster, no_amsCluster); + nb_target++; + no_amsCluster++; + avatarMap.put (dp, avamscluster); + avatarComponents.add (avamscluster); + + } } -- GitLab