diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2014-10-11 15:02:23 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2014-10-11 15:02:23 -0500 |
commit | e8ed7b1d1b5bef31e9874f679a5797c2e00d06f1 (patch) | |
tree | 421c9c50377aa664958685914f5504c4c019e21f /ext/dsent/model/optical/OpticalTestModel.cc | |
parent | a098fad174d8559037602b248b8e6f7f46bfebbb (diff) | |
download | gem5-e8ed7b1d1b5bef31e9874f679a5797c2e00d06f1.tar.xz |
ext: add the source code for DSENT
This patch adds a tool called DSENT to the ext/ directory. DSENT
is a tool that models power and area for on-chip networks. The next
patch adds a script for using the tool.
Diffstat (limited to 'ext/dsent/model/optical/OpticalTestModel.cc')
-rw-r--r-- | ext/dsent/model/optical/OpticalTestModel.cc | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/ext/dsent/model/optical/OpticalTestModel.cc b/ext/dsent/model/optical/OpticalTestModel.cc new file mode 100644 index 000000000..c821c4841 --- /dev/null +++ b/ext/dsent/model/optical/OpticalTestModel.cc @@ -0,0 +1,121 @@ +#include "model/optical/OpticalTestModel.h" +#include "model/optical_graph/OpticalGraph.h" +#include "model/optical_graph/OpticalWaveguide.h" +#include "model/optical/RingModulator.h" +#include "model/optical/RingFilter.h" +#include "model/optical/RingDetector.h" +#include "model/optical/LaserSource.h" + +namespace DSENT +{ + OpticalTestModel::OpticalTestModel(const String& instance_name_, const TechModel* tech_model_) + : OpticalModel(instance_name_, tech_model_) + { + initParameters(); + initProperties(); + } + + OpticalTestModel::~OpticalTestModel() + {} + + void OpticalTestModel::initParameters() + { + return; + } + + void OpticalTestModel::initProperties() + { + return; + } + + void OpticalTestModel::constructModel() + { + unsigned int wavelengths = 64; + unsigned int number_readers = 1; + + createWaveguide("LaserToMod", makeWavelengthGroup(0, wavelengths-1)); + + // Create laser + LaserSource* laser = new LaserSource("Laser", getTechModel()); + laser->setParameter("OutStart", 0); + laser->setParameter("OutEnd", wavelengths-1); + laser->construct(); + + // Create modulator + RingModulator* modulator = new RingModulator("Modulator", getTechModel()); + modulator->setParameter("InStart", 0); + modulator->setParameter("InEnd", wavelengths-1); + modulator->setParameter("ModStart", 0); + modulator->setParameter("ModEnd", wavelengths-1); + modulator->construct(); + + for (unsigned int i = 0; i <= number_readers; ++i) + { + String n = (String) i; + createWaveguide("WaveguideDet-" + n, makeWavelengthGroup(0, wavelengths-1)); + } + + // Create a SWMR Configuration + for (unsigned int i = 0; i < number_readers; ++i) + { + String n = (String) i; + + // Create resonant ring detector + RingDetector* detector = new RingDetector("Detector-" + n, getTechModel()); + detector->setParameter("InStart", 0); + detector->setParameter("InEnd", wavelengths-1); + detector->setParameter("DetStart", 0); + detector->setParameter("DetEnd", wavelengths-1); + detector->setParameter("DropAll", "FALSE"); + detector->setParameter("SenseAmp", "TRUE"); + detector->construct(); + + opticalPortConnect(detector, "In", "WaveguideDet-" + n); + opticalPortConnect(detector, "Out", "WaveguideDet-" + (String) (i + 1)); + + addSubInstances(detector, 1.0); + } + + opticalPortConnect(laser, "Out", "LaserToMod"); + opticalPortConnect(modulator, "In", "LaserToMod"); + opticalPortConnect(modulator, "Out", "WaveguideDet-0"); + + addSubInstances(laser, 1.0); + addSubInstances(modulator, 1.0); + } + + void OpticalTestModel::updateModel() + { + double data_rate = 8e9; + double extinction_ratio = 5; + double insertion_loss = 3; + + Model* laser = getSubInstance("Laser"); + laser->update(); + + getWaveguide("LaserToMod")->setLoss(10); + + Model* modulator = getSubInstance("Modulator"); + modulator->setProperty("ExtinctionRatio", extinction_ratio); + modulator->setProperty("InsertionLoss", insertion_loss); + modulator->setProperty("DataRate", data_rate); + modulator->setProperty("P(In)", 0.5); + modulator->setProperty("Act(In)", 1.0); + modulator->update(); + + unsigned int number_readers = 1; + for (unsigned int i = 0; i < number_readers; ++i) + { + Model* detector = getSubInstance("Detector-" + (String) i); + detector->setProperty("ExtinctionRatio", extinction_ratio); + detector->setProperty("DataRate", data_rate); + detector->setProperty("P(In)", 0.5); + detector->setProperty("Act(In)", 1.0); + detector->update(); + } + + + } + +} // namespace DSENT + |