Ejemplo n.º 1
0
void parser_t::frontier()
{
	// don't do much
	pstring attachat = get_identifier();
	require_token(m_tok_comma);
	double r_IN = eval_param(get_token());
	require_token(m_tok_comma);
	double r_OUT = eval_param(get_token());
	require_token(m_tok_param_right);

	m_setup.register_frontier(attachat, r_IN, r_OUT);
}
Ejemplo n.º 2
0
void parser_t::device(const pstring &dev_type)
{
	if (m_setup.is_library_item(dev_type))
	{
		pstring devname = get_identifier();
		m_setup.namespace_push(devname);
		m_setup.include(dev_type);
		m_setup.namespace_pop();
		require_token(m_tok_param_right);
	}
	else
	{
		base_factory_t *f = m_setup.factory().factory_by_name(dev_type);
		plib::pstring_vector_t termlist = f->term_param_list();
		plib::pstring_vector_t def_params = f->def_params();

		std::size_t cnt;

		pstring devname = get_identifier();

		m_setup.register_dev(dev_type, m_setup.build_fqn(devname));

		m_setup.log().debug("Parser: IC: {1}\n", devname);

		cnt = 0;
		while (cnt < def_params.size())
		{
			pstring paramfq = devname + "." + def_params[cnt];

			m_setup.log().debug("Defparam: {1}\n", paramfq);
			require_token(m_tok_comma);
			token_t tok = get_token();
			if (tok.is_type(STRING))
			{
				m_setup.register_param(paramfq, tok.str());
			}
			else
			{
				nl_double val = eval_param(tok);
				m_setup.register_param(paramfq, val);
			}
			cnt++;
		}

		token_t tok = get_token();
		cnt = 0;
		while (tok.is(m_tok_comma) && cnt < termlist.size())
		{
			pstring output_name = get_identifier();

			m_setup.register_link(devname + "." + termlist[cnt], output_name);

			cnt++;
			tok = get_token();
		}
		if (cnt != termlist.size())
			m_setup.log().fatal("netlist: input count mismatch for {1} - expected {2} found {3}\n", devname, termlist.size(), cnt);
		require_token(tok, m_tok_param_right);
	}
}
Ejemplo n.º 3
0
void netlist_parser::netdev_device(const pstring &dev_type, const pstring &default_param, bool isString)
{
	netlist_device_t *dev;

	skipws();
	pstring devname = getname2(',', ')');
	pstring defparam = devname + "." + default_param;
	dev = m_setup.factory().new_device_by_name(dev_type, m_setup);
	m_setup.register_dev(dev, devname);
	NL_VERBOSE_OUT(("Parser: IC: %s\n", devname.cstr()));
	if (getc() != ')')
	{
		// have a default param
		skipws();
		if (isString)
		{
			pstring val = getname(')');
			ungetc();
			NL_VERBOSE_OUT(("Parser: Default param: %s %s\n", defparam.cstr(), val.cstr()));
			m_setup.register_param(defparam, val);
		}
		else
		{
			double val = eval_param();
			NL_VERBOSE_OUT(("Parser: Default param: %s %f\n", defparam.cstr(), val));
			m_setup.register_param(defparam, val);
		}
	}
	check_char(')');
}
Ejemplo n.º 4
0
void netlist_parser::netdev_param()
{
	pstring param;
	nl_double val;
	param = get_identifier();
	require_token(m_tok_comma);
	val = eval_param(get_token());
	NL_VERBOSE_OUT(("Parser: Param: %s %f\n", param.cstr(), val));
	m_setup.register_param(param, val);
	require_token(m_tok_param_right);
}
Ejemplo n.º 5
0
void netlist_parser::netdev_param()
{
	pstring param;
	double val;
	skipws();
	param = getname(',');
	skipws();
	val = eval_param();
	NL_VERBOSE_OUT(("Parser: Param: %s %f\n", param.cstr(), val));
	m_setup.register_param(param, val);
	check_char(')');
}
Ejemplo n.º 6
0
void netlist_parser::device(const pstring &dev_type)
{
	pstring devname;
	net_device_t_base_factory *f = m_setup.factory().factory_by_name(dev_type, m_setup);
	netlist_device_t *dev;
	nl_util::pstring_list termlist = f->term_param_list();
	nl_util::pstring_list def_params = f->def_params();

	std::size_t cnt;

	devname = get_identifier();

	dev = f->Create();
	m_setup.register_dev(dev, devname);

	NL_VERBOSE_OUT(("Parser: IC: %s\n", devname.cstr()));

	cnt = 0;
	while (cnt < def_params.size())
	{
		pstring paramfq = devname + "." + def_params[cnt];

		NL_VERBOSE_OUT(("Defparam: %s\n", paramfq.cstr()));
		require_token(m_tok_comma);
		token_t tok = get_token();
		if (tok.is_type(STRING))
		{
			m_setup.register_param(paramfq, tok.str());
		}
		else
		{
			nl_double val = eval_param(tok);
			m_setup.register_param(paramfq, val);
		}
		cnt++;
	}

	token_t tok = get_token();
	cnt = 0;
	while (tok.is(m_tok_comma) && cnt < termlist.size())
	{
		pstring output_name = get_identifier();

		m_setup.register_link(devname + "." + termlist[cnt], output_name);

		cnt++;
		tok = get_token();
	}
	if (cnt != termlist.size())
		m_setup.netlist().error("netlist: input count mismatch for %s - expected %" SIZETFMT " found %" SIZETFMT "\n", devname.cstr(), termlist.size(), cnt);
	require_token(tok, m_tok_param_right);
}
Ejemplo n.º 7
0
void netlist_parser::netdev_device(const pstring &dev_type)
{
	pstring devname;
	net_device_t_base_factory *f = m_setup.factory().factory_by_name(dev_type, m_setup);
	netlist_device_t *dev;
	nl_util::pstring_list termlist = f->term_param_list();
	pstring def_param = f->def_param();

	int cnt;

	skipws();
	devname = getname2(',', ')');
	dev = f->Create();
	m_setup.register_dev(dev, devname);

	NL_VERBOSE_OUT(("Parser: IC: %s\n", devname.cstr()));

	if (def_param != "")
	{
        pstring paramfq = devname + "." + def_param;
	    NL_VERBOSE_OUT(("Defparam: %s\n", def_param.cstr()));
        check_char(',');
	    skipws();
	    if (peekc() == '"')
	    {
            pstring val = getstring();
            m_setup.register_param(paramfq, val);
	    }
	    else
	    {
	        double val = eval_param();
	        m_setup.register_param(paramfq, val);
	    }
	    if (termlist.count() > 0)
	        check_char(',');
	}

	cnt = 0;
	while (getc() != ')' && cnt < termlist.count())
	{
		skipws();
		pstring output_name = getname2(',', ')');

		m_setup.register_link(devname + "." + termlist[cnt], output_name);

		skipws();
		cnt++;
	}
    if (cnt != termlist.count())
        fatalerror("netlist: input count mismatch for %s - expected %d found %d\n", devname.cstr(), termlist.count(), cnt);
}
Ejemplo n.º 8
0
void netlist_parser::netdev_const(const pstring &dev_name)
{
	pstring name;
	netlist_device_t *dev;
	pstring paramfq;
	double val;

	skipws();
	name = getname(',');
	dev = m_setup.factory().new_device_by_name(dev_name, m_setup);
	m_setup.register_dev(dev, name);
	skipws();
	val = eval_param();
	paramfq = name + ".CONST";
	NL_VERBOSE_OUT(("Parser: Const: %s %f\n", name.cstr(), val));
	check_char(')');
	m_setup.register_param(paramfq, val);
}
Ejemplo n.º 9
0
void parser_t::netdev_param()
{
	pstring param;
	param = get_identifier();
	require_token(m_tok_comma);
	token_t tok = get_token();
	if (tok.is_type(STRING))
	{
		NL_VERBOSE_OUT(("Parser: Param: %s %s\n", param.cstr(), tok.str().cstr()));
		m_setup.register_param(param, tok.str());
	}
	else
	{
		nl_double val = eval_param(tok);
	NL_VERBOSE_OUT(("Parser: Param: %s %f\n", param.cstr(), val));
	m_setup.register_param(param, val);
	}
	require_token(m_tok_param_right);
}
Ejemplo n.º 10
0
void parser_t::netdev_param()
{
    pstring param;
    param = get_identifier();
    require_token(m_tok_comma);
    token_t tok = get_token();
    if (tok.is_type(STRING))
    {
        m_setup.log().debug("Parser: Param: {1} {2}\n", param, tok.str());
        m_setup.register_param(param, tok.str());
    }
    else
    {
        nl_double val = eval_param(tok);
        m_setup.log().debug("Parser: Param: {1} {2}\n", param, val);
        m_setup.register_param(param, val);
    }
    require_token(m_tok_param_right);
}
Ejemplo n.º 11
0
void parser_t::device(const pstring &dev_type)
{
	factory::element_t *f = m_setup.factory().factory_by_name(dev_type);
	auto paramlist = plib::psplit(f->param_desc(), ",");

	pstring devname = get_identifier();

	m_setup.register_dev(dev_type, devname);
	m_setup.log().debug("Parser: IC: {1}\n", devname);

	for (pstring tp : paramlist)
	{
		require_token(m_tok_comma);
		if (plib::startsWith(tp, "+"))
		{
			pstring output_name = get_identifier();
			m_setup.log().debug("Link: {1} {2}\n", tp, output_name);

			m_setup.register_link(devname + "." + tp.substr(1), output_name);
		}
		else
		{
			pstring paramfq = devname + "." + tp;

			m_setup.log().debug("Defparam: {1}\n", paramfq);
			token_t tok = get_token();
			if (tok.is_type(STRING))
			{
				m_setup.register_param(paramfq, tok.str());
			}
			else
			{
				nl_double val = eval_param(tok);
				m_setup.register_param(paramfq, val);
			}
		}
	}

	// error(plib::pfmt("Input count mismatch for {1} - expected {2} found {3}")(devname)(termlist.size())(cnt));
	require_token(m_tok_param_right);
}