From e8ed7b1d1b5bef31e9874f679a5797c2e00d06f1 Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Sat, 11 Oct 2014 15:02:23 -0500 Subject: 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. --- ext/dsent/model/OpticalModel.h | 143 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 ext/dsent/model/OpticalModel.h (limited to 'ext/dsent/model/OpticalModel.h') diff --git a/ext/dsent/model/OpticalModel.h b/ext/dsent/model/OpticalModel.h new file mode 100644 index 000000000..0b4f27d37 --- /dev/null +++ b/ext/dsent/model/OpticalModel.h @@ -0,0 +1,143 @@ +#ifndef __DSENT_MODEL_OPTICALMODEL_H__ +#define __DSENT_MODEL_OPTICALMODEL_H__ + +#include "util/CommonType.h" +#include "model/ElectricalModel.h" + +namespace DSENT +{ + class PortInfo; + class EventInfo; + class OpticalWaveguide; + class OpticalLaser; + class OpticalFilter; + class OpticalModulator; + class OpticalDetector; + class OpticalReceiver; + class OpticalTransmitter; + + // A Wavelength group consisting of start and end wavelength indices + // Assuming it is the same as a net index so I can use the PortInfo class + typedef NetIndex WavelengthGroup; + + // Helper function for making waveguide groups + inline WavelengthGroup makeWavelengthGroup(int start_index_, int end_index_) + { + ASSERT(end_index_ >= start_index_, (String) "[Error] Invalid wavelength group range " + + "[" + (String) start_index_ + ":" + (String) end_index_ + "]"); + + return WavelengthGroup(start_index_, end_index_); + } + + // Helper function for making wavelength groups + inline WavelengthGroup makeWavelengthGroup(int index_) + { + return makeWavelengthGroup(index_, index_); + } + + // OpticalModel specifies optical connectivity to other optical models as well + class OpticalModel : public ElectricalModel + { + + public: + OpticalModel(const String& instance_name_, const TechModel* tech_model_); + virtual ~OpticalModel(); + + public: + //----------------------------------------------------------------- + // Connectivity specification + //----------------------------------------------------------------- + + /* + + // Waveguide multiplier + void setWaveguideMultiplier(unsigned int waveguide_multiplier_); + unsigned int getWaveguideMultiplier(); + + */ + // Input Ports + void createOpticalInputPort(const String& name_, const WavelengthGroup& wavelengths_); + const Map* getOpticalInputs() const; + PortInfo* getOpticalInputPort(const String& name_); + const PortInfo* getOpticalInputPort(const String& name_) const; + + // Output Ports + void createOpticalOutputPort(const String& name_, const WavelengthGroup& wavelengths_); + const Map* getOpticalOutputs() const; + PortInfo* getOpticalOutputPort(const String& name_); + const PortInfo* getOpticalOutputPort(const String& name_) const; + + // Optical Waveguides + void createWaveguide(const String& name_, const WavelengthGroup& wavelengths_); + const Map* getWaveguides() const; + OpticalWaveguide* getWaveguide(const String& name_); + + // Assign a waveguide to be downstream from another waveguide + void opticalAssign(const String& downstream_waveguide_name_, const String& upstream_waveguide_name_); + + // Connect a port (input or output) to some waveguide + void opticalPortConnect(OpticalModel* connect_model_, const String& connect_port_name_, const String& connect_waveguide_name_); + //----------------------------------------------------------------- + + //----------------------------------------------------------------- + // Optical Graph Model Components + //----------------------------------------------------------------- + // Optical Laser Sources + + void createLaser(const String& name_, const WavelengthGroup& wavelengths_); + const Map* getLasers() const; + OpticalLaser* getLaser(const String& name_); + // Optical Laser Sources + void createFilter(const String& name_, const WavelengthGroup& wavelengths_, bool drop_all_, const WavelengthGroup& drop_wavelengths_); + const Map* getFilters() const; + OpticalFilter* getFilter(const String& name_); + // Optical Modulators + void createModulator(const String& name_, const WavelengthGroup& wavelengths_, bool opt_loss_, OpticalTransmitter* transmitter_); + const Map* getModulators() const; + OpticalModulator* getModulator(const String& name_); + // Optical Detectors + void createDetector(const String& name_, const WavelengthGroup& wavelengths_, OpticalReceiver* receiver_); + const Map* getDetectors() const; + OpticalDetector* getDetector(const String& name_); + + //----------------------------------------------------------------- + + protected: + // In an OpticalModel, the complete optical port-to-port connectivity + // of all sub-instances must be specified. Addition/Removal optical + // ports or port-related nets cannot happen after this step + //virtual void constructModel() = 0; + // In an OpticalModel, updateModel MUST finish all necessary + // calculations such that loss and wavelength power can be calculated + //virtual void updateModel() = 0; + // In an OpticalModel, evaluateModel should calculate all wavelength + // power, updating power and energy events as necessary + //virtual void evaluateModel() = 0; + + private: + // Private copy constructor. Use clone to perform copy operation. + OpticalModel(const OpticalModel& model_); + + private: + // Map of all input ports + Map* m_optical_input_ports_; + // Map of all output ports + Map* m_optical_output_ports_; + + // Optical graph model elements + // Map of all waveguides + Map* m_waveguides_; + // Map of all laser source elements + Map* m_lasers_; + // Map of all filter elements + Map* m_filters_; + // Map of all modulator elements + Map* m_modulators_; + // Map of all photodetector elements + Map* m_detectors_; + + }; // class OpticalModel +} // namespace DSENT + +#endif // __DSENT_MODEL_OPTICALMODEL_H__ + -- cgit v1.2.3