void Decoder_LDPC_IEEE_802_11ad::Init()
{

	// Set code and decoder parameters
	Set_LDPC_Parameters();

	mean_iterations.Reset();
    flipped_bits.Reset();

	// Resize output buffers and internal RAMs.
	try
	{
		// Output RAM content for each iteration.
		output_bits().Resize(num_iterations(), num_variable_nodes_);
		output_bits_llr_app().Resize(num_iterations(), num_variable_nodes_);

		// Decoder RAMs
		app_ram_.Resize(dst_parallelism_, num_variable_nodes_ / dst_parallelism_);
		msg_ram_.Resize(dst_parallelism_, num_check_nodes_ * max_check_degree_ / dst_parallelism_);
	}
	catch(bad_alloc&)
	{
		Msg(ERROR, instance_name(), "Memory allocation failure!");
		throw;
	}

	param_list_.config_modified(false);
	input_data_list_.port_modified(false);
}
bool device_image_interface::open_image_file(emu_options &options)
{
	const char* path = options.value(instance_name());
	if (strlen(path)>0)
	{
		set_init_phase();
		if (load_internal(path, FALSE, 0, NULL, TRUE)==IMAGE_INIT_PASS)
		{
			if (software_entry()==NULL) return true;
		}
	}
	return false;
}
Example #3
0
bool device_image_interface::open_image_file(emu_options &options)
{
	const char* path = options.value(instance_name());
	if (*path != 0)
	{
		set_init_phase();
		if (load_internal(path, false, 0, nullptr, true) == image_init_result::PASS)
		{
			if (software_entry()==nullptr) return true;
		}
	}
	return false;
}
Example #4
0
void device_image_interface::software_get_default_slot(astring &result, const char *default_card_slot)
{
	const char *path = device().mconfig().options().value(instance_name());
	result.reset();
	if (strlen(path) > 0)
	{
		result.cpy(default_card_slot);
		software_part *swpart = find_software_item(path, true);
		if (swpart != NULL)
		{
			const char *slot = swpart->feature("slot");
			if (slot != NULL)
				result.cpy(slot);
		}
	}
}
Example #5
0
void
be_visitor_valuetype_cs::gen_ostream_operator_r (be_valuetype *node,
                                                 unsigned long &index)
{
  TAO_OutStream *os = this->ctx_->stream ();
  AST_Type *parent = node->inherits_concrete ();

  // Recurse up the parent chain.
  if (parent != 0)
    {
      this->gen_ostream_operator_r (be_valuetype::narrow_from_decl (parent),
                                    index);
    }

  // Generate output for the members of whichever recursion we are in.
  for (UTL_ScopeActiveIterator i (node, UTL_Scope::IK_decls);
       !i.is_done ();
       i.next ())
    {
      be_field *f = be_field::narrow_from_decl (i.item ());
      be_attribute *attr =
        be_attribute::narrow_from_decl (i.item ());

      // No way to access the private members from generated code.
      if (f == 0
          || f->visibility () != AST_Field::vis_PUBLIC
          || attr != 0)
        {
          continue;
        }

      if (index++ != 0)
        {
          *os << " << \", \"";
        }

      *os << be_nl
          << "     << ";

      ACE_CString instance_name ("this->");
      instance_name += f->local_name ()->get_string ();
      f->gen_member_ostream_operator (os,
                                      instance_name.c_str (),
                                      false,
                                      true);
    }
}
Example #6
0
std::string device_image_interface::software_get_default_slot(const char *default_card_slot) const
{
	const char *path = device().mconfig().options().value(instance_name());
	std::string result;
	if (*path != '\0')
	{
		result.assign(default_card_slot);
		const software_part *swpart = find_software_item(path, true);
		if (swpart != nullptr)
		{
			const char *slot = swpart->feature("slot");
			if (slot != nullptr)
				result.assign(slot);
		}
	}
	return result;
}
int Decoder_LDPC_IEEE_802_11ad::Run()
{

	unsigned int pchk_satisfied;
	unsigned int iter = 0;
	bool next_iter_is_last_iter = false; 
	bool last_iter = false; 

	decoding_successful().Write(false);
	num_modified_systematic_bits().Write(0);

	if(param_list_.config_modified())
		Init();

	// Read the channel values and store them in app_ram_.
	Init_APP_RAM(is_IRA_code_, input_bits_llr(), app_ram_);

	do
	{
		// Perform one ldpc decoder iteration.
		switch(scheduling())
		{
		case LAYERED:
			pchk_satisfied = Decode_Layered(app_ram_, msg_ram_, iter);
			break;

		case TWO_PHASE:
			pchk_satisfied = Decode_Two_Phase(app_ram_, msg_ram_, iter, app_parity_check());
			break;

		default:
			pchk_satisfied = 0;
			Msg(ERROR, instance_name(), "Selected scheduling not supported for these codes!");
			break;
		}

		/*
		 * Read the app_ram_ and store APP values in output_bits_llr_app() and
		 * hard decoded bits in output_bits buffer.
		 */
		Read_APP_RAM(app_ram_, iter, output_bits_llr_app(), output_bits());

		// Check whether all parity checks were satisfied in the previous iteration.
		last_iter = next_iter_is_last_iter;

		// Are all parity checks satisfied?
		if (pchk_satisfied == num_check_nodes_)
		{
			decoding_successful().Write(true);
			next_iter_is_last_iter = true; // Do one more iteration, as it is done in hardware!
		}

        // Store the number of flipped bits
        if (iter != 0) {
            flipped_bits(iter)().Write(Calc_Flipped_Bits(iter, output_bits()));
        }

		// Increase iteration counter.
		iter++;

		mean_iterations(iter)().Write(iter);


	/*
	 * Abort conditions:
	 * 1) maximum number of iterations is reached
	 * 2) all parity checks are satisfied: Since the hardware performs one more
	 * iteration after all parity checks are satisfied, we delay the stopping
	 * in the software as well.
	 */
	} while (iter < num_iterations() &&
	         last_iter == false);

	// Write the number of unsatisfied parity checks.
	num_unsatisfied_parity_checks().Write(num_check_nodes_ - pchk_satisfied);

	// Set number of used iterations in output buffer.
	iterations_performed().Write(iter);

	// Get statistic about modified bits.
	num_modified_systematic_bits().Write(Calc_Modified_Systematic_Bits(iter, input_bits_llr(), output_bits()));

	// Fill the output buffer and the status port for the remaining iterations.
	for(unsigned int i = iter; i < num_iterations(); i++)
	{
		mean_iterations(i + 1)().Write(iter);
		output_bits_llr_app()[i] = output_bits_llr_app()[iter - 1];
		output_bits()[i]         = output_bits()[iter - 1];
	}

	return 0;
}
Example #8
0
void
be_union::gen_ostream_operator (TAO_OutStream *os,
                                bool /*use_underscore*/)
{
  *os << be_nl
      << "std::ostream& operator<< (" << be_idt << be_idt_nl
      << "std::ostream &strm," << be_nl
      << "const " << this->name () << " &_tao_union" << be_uidt_nl
      << ")" << be_uidt_nl
      << "{" << be_idt_nl
      << "strm << \"" << this->name () << "(\";" << be_nl_2
      << "switch (_tao_union._d ())" << be_nl
      << "{" << be_idt;

  for (long i = 0; i < this->pd_decls_used; ++i)
    {
      be_union_branch *ub =
        be_union_branch::narrow_from_decl (this->pd_decls[i]);

      // We don't want any decls, just members.
      if (ub == 0)
        {
          continue;
        }

      *os << be_nl;

      unsigned long ll_len = ub->label_list_length ();

      for (unsigned long j = 0; j < ll_len; ++j)
        {
          // Check if we are printing the default case.
          if (ub->label (j)->label_kind () == AST_UnionLabel::UL_default)
            {
              *os << "default:";
            }
          else
            {
              *os << "case ";

              ub->gen_label_value (os, j);

              *os << ":";
            }

          if (j == ll_len - 1)
            {
              *os << be_idt_nl;
            }
          else
            {
              *os << be_nl;
            }
        }

      ACE_CString instance_name ("_tao_union.");
      instance_name += ub->local_name ()->get_string ();

      *os << "strm << ";

      be_type *ub_ft = be_type::narrow_from_decl (ub->field_type ());
      AST_Decl::NodeType ub_nt = ub_ft->node_type ();
      // catch anonymous Array member types
      bool ub_use_underscore = ub_nt == AST_Decl::NT_array;

      ub->gen_member_ostream_operator (os,
                                       instance_name.c_str (),
                                       ub_use_underscore,
                                       true);

      *os << ";" << be_nl
          << "break;" << be_uidt;
    }

  // Some compilers complain unless this is present, but only
  // if not all values are covered in case statements.
  if (this->gen_empty_default_label ())
    {
      *os << be_nl
          << "default:" << be_idt_nl
          << "break;" << be_uidt;
    }

  *os << be_uidt_nl
      << "}" << be_nl_2
      << "return strm << \")\";" << be_uidt_nl
      << "}" << be_nl;
}