#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; } };