Commit 77c13763 authored by Daniela Genius's avatar Daniela Genius
Browse files

debut d'arborescence systemCAMS

parent ee14b5a1
/**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.
*/
/* Generator of the top cell for simulation with SoCLib virtual component
library */
/* authors: v1.0 Raja GATGOUT 2014
v2.0 Daniela GENIUS, Julien HENON 2015 */
package ddtranslatorSoclib.toTopCell;
import avatartranslator.AvatarRelation;
import avatartranslator.AvatarSpecification;
import ddtranslatorSoclib.*;
import ddtranslatorSoclib.toSoclib.*;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
public class TopCellGenerator
{
private static final String MAPPING_TXT = "mapping.txt"; //$NON-NLS-1$
//--------------- accessing Avatardd -----------------
public static AvatarddSpecification avatardd;
// ---------------------------------------------------
public static AvatarSpecification avspec;
public String VCIparameters;
public String config;
public String mainFile;
public String src;
public String top;
public String deployinfo;
public String deployinfo_map;
public String deployinfo_ram;
public String platform_desc;
public String procinfo;
public String nbproc;
public final String DOTH = ".h";
public final String DOTCPP = ".cpp";
public final String SYSTEM_INCLUDE = "#include \"systemc.h\"";
public final String CR = "\n";
public final String CR2 = "\n\n";
public final String SCCR = ";\n";
public final String EFCR = "}\n";
public final String EFCR2 = "}\n\n";
public final String EF = "}";
public final String COTE = "";
public final String NAME_RST = "signal_resetn";
public final String TYPEDEF = "typedef";
private final static String GENERATED_PATH = "generated_topcell" + File.separator;
private boolean tracing;
public TopCellGenerator(AvatarddSpecification dd, boolean _tracing, AvatarSpecification _avspec){
avatardd = dd;
tracing =_tracing;
avspec =_avspec;
}
public String generateTopCell() {
String icn;
/* first test validity of the hardware platform*/
/* if there is one VGMN, this is the central interconnect */
if(TopCellGenerator.avatardd.getNbVgmn()>1){
System.out.println("***Warning: No more than one central VGMN***");
}
if(TopCellGenerator.avatardd.getNbVgmn()==1){
System.out.println("***VGMN based***");
icn="vgmn";
}
else{
System.out.println("***VGSB based ***");
icn="vgsb";
}
for (AvatarConnector connector : avatardd.getConnectors()){
/* Central interconnect or local crossbars */
if(TopCellGenerator.avatardd.getNbCrossbar()>0){
System.out.println("***Clustered Interconnect***");
}
makeVCIparameters();
makeConfig();
String top = Header.getHeader() +
Code.getCode() +
MappingTable.getMappingTable() +
Loader.getLoader(avspec) +
Declaration.getDeclarations(avspec) +
Signal.getSignal() +
NetList.getNetlist(icn,tracing) +
Simulation.getSimulation();
return (top);
}
public List<String> readInMapping() {
List<String> mappingLines = new ArrayList<String>();
try {
BufferedReader in = new BufferedReader(new FileReader(MAPPING_TXT));
String line = null;
while ((line = in.readLine()) != null) {
System.out.println(" Line read : " + line);
mappingLines.add(line);// read one line of the file;
}
in.close();
} catch (IOException e) {
e.printStackTrace();
}
return mappingLines;
}
public void saveFile(String path) {
try {
System.err.println(path + GENERATED_PATH + "top.cc");
FileWriter fw = new FileWriter(path + GENERATED_PATH + "/top.cc");
top = generateTopCell();
fw.write(top);
fw.close();
} catch (IOException ex) {
}
saveFileDeploy(path);
saveFilePlatform(path);
saveFileProcinfo(path);
saveFileNBproc(path);
}
public void saveFileDeploy(String path) {
try {
System.err.println(path + GENERATED_PATH + "deployinfo.h");
FileWriter fw = new FileWriter(path + GENERATED_PATH + "/deployinfo.h");
deployinfo = Deployinfo.getDeployInfo();
fw.write(deployinfo);
fw.close();
System.err.println(path + GENERATED_PATH + "deployinfo_map.h");
FileWriter fw_map = new FileWriter(path + GENERATED_PATH + "/deployinfo_map.h");
deployinfo_map = Deployinfo.getDeployInfoMap(avspec);
fw_map.write(deployinfo_map);
fw_map.close();
//ajout CD 9.6
System.err.println(path + GENERATED_PATH + "deployinfo_ram.h");
FileWriter fw_ram = new FileWriter(path + GENERATED_PATH + "/deployinfo_ram.h");
deployinfo_ram = Deployinfo.getDeployInfoRam(avspec);
fw_ram.write(deployinfo_ram);
fw_ram.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void saveFileProcinfo(String path) {
try {
System.err.println(path + GENERATED_PATH + "procinfo.mk");
FileWriter fw = new FileWriter(path + GENERATED_PATH + "/procinfo.mk");
procinfo = Deployinfo.getProcInfo();
fw.write(procinfo);
fw.close();
} catch (IOException ex) {
}
}
public void saveFileNBproc(String path) {
try {
System.err.println(path + GENERATED_PATH + "nbproc");
FileWriter fw = new FileWriter(path + GENERATED_PATH + "/nbproc");
nbproc = Deployinfo.getNbProc();
fw.write(nbproc);
fw.close();
} catch (IOException ex) {
}
}
public void saveFilePlatform(String path) {
try {
System.err.println(path + GENERATED_PATH + "platform_desc");
FileWriter fw = new FileWriter(path + GENERATED_PATH + "/platform_desc");
platform_desc = Platforminfo.getPlatformInfo();
fw.write(platform_desc);
fw.close();
} catch (IOException ex) {
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment