Commit 4352e45e authored by Ludovic Apvrille's avatar Ludovic Apvrille

NEw code generator for FPGAs

parent 32025fff
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -271,16 +271,17 @@ public class DiploSimulatorCodeGenerator implements IDiploSimulatorCodeGenerator
//}
} else if (node instanceof HwFPGA) {
final HwFPGA hwFpgaNode = (HwFPGA) node;
//final String schedulerInstName = namesGen.rrSchedulerInstanceName(hwFpgaNode);
//final String schedulerName = namesGen.rrSchedulerName(hwFpgaNode);
//declaration += "RRScheduler* " + schedulerInstName + " = new RRScheduler(\"" + schedulerName + "\", 0, " + (tmlmapping
// .getTMLArchitecture().getMasterClockFrequency() * HwA.DEFAULT_SLICE_TIME) + ", " + (int) Math.ceil((float) (hwaNode
// .clockRatio * Math.max(hwaNode.execiTime, hwaNode.execcTime) * (HwA.DEFAULT_BRANCHING_PREDICTION_PENALTY * HwA
// .DEFAULT_PIPELINE_SIZE + 100 - HwA.DEFAULT_BRANCHING_PREDICTION_PENALTY)) / 100) + " ) " + SCCR;
final String schedulerInstName = namesGen.rrSchedulerInstanceName(hwFpgaNode);
final String schedulerName = namesGen.rrSchedulerName(hwFpgaNode);
declaration += "RRScheduler* " + schedulerInstName + " = new RRScheduler(\"" + schedulerName + "\", 0, " + (tmlmapping
.getTMLArchitecture().getMasterClockFrequency() * HwA.DEFAULT_SLICE_TIME) + ", " + (int) Math.ceil((float) (hwFpgaNode
.clockRatio * Math.max(hwFpgaNode.execiTime, hwFpgaNode.execcTime) * (HwA.DEFAULT_BRANCHING_PREDICTION_PENALTY * HwA
.DEFAULT_PIPELINE_SIZE + 100 - HwA.DEFAULT_BRANCHING_PREDICTION_PENALTY)) / 100) + " ) " + SCCR;
final String hwFpgaInstName = namesGen.hwFpgaInstanceName(hwFpgaNode);
declaration += "FPGA* " + hwFpgaInstName + " = new FPGA(" + hwFpgaNode.getID() + ", \"" + namesGen.hwFpgaName(hwFpgaNode) + "\", ";
declaration += "FPGA* " + hwFpgaInstName + " = new FPGA(" + hwFpgaNode.getID() + ", \"" + namesGen.hwFpgaName(hwFpgaNode) + "\", "
+ schedulerInstName + ", ";
declaration += hwFpgaNode.reconfigurationTime + ", " + hwFpgaNode.goIdleTime + ", " +
hwFpgaNode.maxConsecutiveIdleCycles + ", " + hwFpgaNode.execiTime + ", " +
......@@ -569,6 +570,7 @@ public class DiploSimulatorCodeGenerator implements IDiploSimulatorCodeGenerator
for (final TMLTask task : tmlmapping.getMappedTasks()) {
node = iterator.next();
boolean mappedOnCPU = true;
final String taskClassName = namesGen.taskTypeName(task);
declaration += taskClassName + "* " + namesGen.taskInstanceName(task) + " = new " + taskClassName + "(" + task.getID() + "," + task.getPriority() + ",\"" + namesGen.taskName(task) + "\", array(";
......@@ -597,6 +599,7 @@ public class DiploSimulatorCodeGenerator implements IDiploSimulatorCodeGenerator
} else if (node instanceof HwFPGA) {
final HwFPGA hwFpga = (HwFPGA) node;
declaration += "1 ," + namesGen.hwFpgaInstanceName(hwFpga);
mappedOnCPU = false;
// DB Issue #22: copy paste error?? This causes class cast exception
// declaration+= ((HwCPU)node).nbOfCores;
......@@ -616,7 +619,7 @@ public class DiploSimulatorCodeGenerator implements IDiploSimulatorCodeGenerator
final List<TMLEvent> events = new ArrayList<TMLEvent>(tmlmodeling.getEvents(task));
final List<TMLRequest> requests = new ArrayList<TMLRequest>(tmlmodeling.getRequests(task));
final MappedSystemCTask mst = new MappedSystemCTask(task, channels, events, requests, tmlmapping, mappedChannels);
final MappedSystemCTask mst = new MappedSystemCTask(task, channels, events, requests, tmlmapping, mappedChannels, mappedOnCPU);
tasks.add(mst);
for (final TMLChannel channelb : channels) {
......
......@@ -71,6 +71,7 @@ public class MappedSystemCTask {
// private boolean optimize;
private StaticAnalysis _analysis;
private LiveVariableNode _startAnaNode = null;
private boolean mappedOnCPU;
private final static String DOTH = ".h";
private final static String DOTCPP = ".cpp";
......@@ -83,7 +84,8 @@ public class MappedSystemCTask {
// private final static String EF = "}";
public MappedSystemCTask(TMLTask _task, List<TMLChannel> _channels, List<TMLEvent> _events, List<TMLRequest> _requests, TMLMapping<?> _tmlmapping, Set<Integer> _depChannels) {
public MappedSystemCTask(TMLTask _task, List<TMLChannel> _channels, List<TMLEvent> _events, List<TMLRequest> _requests, TMLMapping<?>
_tmlmapping, Set<Integer> _depChannels, boolean mappedOnCPU) {
task = _task;
channels = _channels;
events = _events;
......@@ -99,6 +101,7 @@ public class MappedSystemCTask {
functionSig = "";
commentText = "";
commentNum = 0;
this.mappedOnCPU = mappedOnCPU;
// optimize=false;
_analysis = new StaticAnalysis(_task, _channels, _events, _requests, _depChannels);
......@@ -231,7 +234,18 @@ public class MappedSystemCTask {
// }
private String makeConstructorSignature() {
String constSig = reference + "(ID iID, Priority iPriority, std::string iName, CPU** iCPUs, unsigned int iNumOfCPUs" + CR;
String constSig;
if (mappedOnCPU) {
constSig = reference + "(ID iID, Priority iPriority, std::string iName, CPU** iCPUs, unsigned int iNumOfCPUs" + CR;
} else {
constSig = reference + "(ID iID, Priority iPriority, std::string iName, FPGA** iCPUs, unsigned int iNumOfCPUs" + CR;
}
for (TMLChannel ch : channels) {
constSig += ", TMLChannel* " + ch.getExtendedName() + CR;
}
......
......@@ -467,7 +467,7 @@ public class TML2MappingSystemC implements IDiploSimulatorCodeGenerator {
events = new ArrayList<TMLEvent>(tmlmodeling.getEvents(task));
requests = new ArrayList<TMLRequest>(tmlmodeling.getRequests(task));
mst = new MappedSystemCTask(task, channels, events, requests, tmlmapping, mappedChannels);
mst = new MappedSystemCTask(task, channels, events, requests, tmlmapping, mappedChannels, true);
//mst.generateSystemC(debug, optimize, dependencies);
//mst.generateSystemC(debug, optimize);
tasks.add(mst);
......
Markdown is supported
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