Пример #1
0
ATTR_HOT void nld_d_to_a_proxy::update()
{
	const int state = INPLOGIC(m_I);
	if (state != m_last_state)
	{
		m_last_state = state;
		const nl_double R = state ? logic_family().m_R_high : logic_family().m_R_low;
		const nl_double V = state ? logic_family().m_high_V : logic_family().m_low_V;

		// We only need to update the net first if this is a time stepping net
		if (m_is_timestep)
		{
			m_RV.update_dev();
		}
		m_RV.set(NL_FCONST(1.0) / R, V, 0.0);
		m_RV.m_P.schedule_after(NLTIME_FROM_NS(1));
	}
}
Пример #2
0
/*
 * nld_74123.c
 *
 */

#include "nld_74123.h"

#define R_OFF (1E20)
#define R_ON (m_RI.Value())

NETLIB_NAMESPACE_DEVICES_START()

NETLIB_UPDATE(74123)
{
	netlist_sig_t m_trig;
	netlist_sig_t res = !INPLOGIC(m_CLRQ);
	netlist_time t_AB_to_Q = NLTIME_FROM_NS(10);
	netlist_time t_C_to_Q = NLTIME_FROM_NS(10);

	if (m_dev_type == 74123)
	{
		m_trig = (INPLOGIC(m_A) ^ 1) & INPLOGIC(m_B) & INPLOGIC(m_CLRQ);
	}
	else if (m_dev_type == 9602)
	{
		m_trig = (INPLOGIC(m_A) ^ 1) | INPLOGIC(m_B);
	}
	else // 4538
	{
		m_trig = (INPLOGIC(m_B) ^ 1) | INPLOGIC(m_A);
		// The line below is from the datasheet truthtable ... doesn't make sense at all