From ff9b8bb838ecdfbfc1dc81038fcf3b2a87636982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Zrounba?= <6691770+clement-z@users.noreply.github.com> Date: Sat, 30 Sep 2023 23:06:01 +0200 Subject: Initial release --- src/devices/crow.h | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 src/devices/crow.h (limited to 'src/devices/crow.h') diff --git a/src/devices/crow.h b/src/devices/crow.h new file mode 100644 index 0000000..d0e6ed2 --- /dev/null +++ b/src/devices/crow.h @@ -0,0 +1,98 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +class CROW : public sc_module { +public: + // Ports + /** The optical input ports. */ + sc_port> p_in; + sc_port> p_add; + /** The electrical output port. */ + sc_port> p_out_t; + sc_port> p_out_d; + + // Member variables + size_t N; + double m_ring_length; + double m_neff = 2.2; + double m_ng = 4.3; + double m_loss_db_cm = 2; + double m_coupling_through = 0.85; + + // Wires + vector>> S_TL; + vector>> S_BL; + vector>> S_TR; + vector>> S_BR; + //sc_signal terminator; + + // Member submodules + vector> wg_top; + vector> wg_bot; + vector> dc; + + + virtual void init() + { + assert(N > 0); + S_TL.clear(); + S_BL.clear(); + S_TR.clear(); + S_BR.clear(); + wg_bot.clear(); + wg_top.clear(); + dc.clear(); + stringstream ss; + string _i; + for (size_t i = 0; i < N; ++i) + { + ss.str(std::string()); + ss << i; + _i = ss.str(); + cout << _i << endl; + S_TL.push_back(make_shared>((string("S_TL") + "_" + _i).c_str())); + S_BL.push_back(make_shared>((string("S_BL") + "_" + _i).c_str())); + S_TR.push_back(make_shared>((string("S_TR") + "_" + _i).c_str())); + S_BR.push_back(make_shared>((string("S_BR") + "_" + _i).c_str())); + wg_bot.push_back(make_shared((string("wg_bot") + "_" + _i).c_str())); + wg_top.push_back(make_shared((string("wg_top") + "_" + _i).c_str())); + dc.push_back(make_shared((string("dc") + "_" + _i).c_str())); + } + ss.str(std::string()); + ss << N; + _i = ss.str(); + cout << _i << endl; + dc.push_back(make_shared((string("dc") + "_" + _i).c_str())); + connect_submodules(); + } + + void connect_submodules(); + + /** Constructor for Waveguide + * + * @param name name of the module + * */ + CROW(sc_module_name name, const size_t &nrings = 3, const double &ring_length = 0.0) + : sc_module(name) + , N(nrings) + , m_ring_length(ring_length) + { + } + + void setRingLength(const double &ring_length) + { + assert(ring_length >= 0); + m_ring_length = ring_length; + } +}; -- cgit v1.2.3