| 9 | using namespace aff3ct::module; |
| 10 | |
| 11 | Decoder ::Decoder(const int K, const int N) |
| 12 | : spu::module::Stateful() |
| 13 | , K(K) |
| 14 | , N(N) |
| 15 | , auto_reset(true) |
| 16 | , mask(std::numeric_limits<int>::max()) |
| 17 | , CWD(this->get_n_frames()) |
| 18 | { |
| 19 | const std::string name = "Decoder"; |
| 20 | this->set_name(name); |
| 21 | this->set_short_name(name); |
| 22 | |
| 23 | if (K <= 0) |
| 24 | { |
| 25 | std::stringstream message; |
| 26 | message << "'K' has to be greater than 0 ('K' = " << K << ")."; |
| 27 | throw spu::tools::invalid_argument(__FILE__, __LINE__, __func__, message.str()); |
| 28 | } |
| 29 | |
| 30 | if (N <= 0) |
| 31 | { |
| 32 | std::stringstream message; |
| 33 | message << "'N' has to be greater than 0 ('N' = " << N << ")."; |
| 34 | throw spu::tools::invalid_argument(__FILE__, __LINE__, __func__, message.str()); |
| 35 | } |
| 36 | |
| 37 | if (K > N) |
| 38 | { |
| 39 | std::stringstream message; |
| 40 | message << "'K' has to be smaller or equal to 'N' ('K' = " << K << ", 'N' = " << N << ")."; |
| 41 | throw spu::tools::invalid_argument(__FILE__, __LINE__, __func__, message.str()); |
| 42 | } |
| 43 | |
| 44 | this->tasks_with_nullptr.resize((size_t)dec::tsk::SIZE); |
| 45 | } |
| 46 | |
| 47 | Decoder* |
| 48 | Decoder ::clone() const |