mirror of
https://github.com/libretro/mame2016-libretro.git
synced 2025-03-02 14:56:02 +00:00
Cleanups and version bump
This commit is contained in:
parent
efaac9818f
commit
ca546caa6e
@ -11,7 +11,7 @@ Questionable?
|
||||
|
||||
* 강행돌파 [same as herknite?!?]
|
||||
|
||||
* Tears - Another Story added (not 100% verified whether it is a final version or not)
|
||||
* Tears - Another Story added (not 100% verified whether it is a final version or not)
|
||||
|
||||
It is recommended to use the firmware 1.6.6 as default BIOS!
|
||||
|
||||
@ -409,7 +409,7 @@ It is recommended to use the firmware 1.6.6 as default BIOS!
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
|
||||
<software name="pinbdrea">
|
||||
<description>Pinball Dreams (Eur)</description>
|
||||
<year>2002</year>
|
||||
@ -421,7 +421,7 @@ It is recommended to use the firmware 1.6.6 as default BIOS!
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
|
||||
<software name="sobemons">
|
||||
<description>Story of Bug eyed Monster (Kor)</description>
|
||||
<year>2003</year>
|
||||
@ -444,8 +444,8 @@ It is recommended to use the firmware 1.6.6 as default BIOS!
|
||||
<rom name="winter is.smc" size="69207040" crc="62c4a3fb" sha1="cf072fae0825164ff8c7393ab513058b78c46061" offset="0" />
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
</software>
|
||||
|
||||
<software name="suplusha">
|
||||
<description>Super Plusha (Eur)</description>
|
||||
<year>2002</year>
|
||||
@ -456,7 +456,7 @@ It is recommended to use the firmware 1.6.6 as default BIOS!
|
||||
<rom name="super plusha.smc" size="17302528" crc="65da87fc" sha1="1e2e984014f184759a35df93160f0fb4d11c7742" offset="0" />
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
</software>
|
||||
|
||||
<software name="talowila">
|
||||
<description>Tales of Windy Land (Kor)</description>
|
||||
@ -468,7 +468,7 @@ It is recommended to use the firmware 1.6.6 as default BIOS!
|
||||
<rom name="tales of windy land.smc" size="17302528" crc="83b9c315" sha1="51679a8197f721fc601ea0cd8c91a3bbabed9585" offset="0" />
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
</software>
|
||||
|
||||
<software name="totogogo">
|
||||
<description>Topy Topy Gogo (Eur)</description>
|
||||
@ -480,8 +480,8 @@ It is recommended to use the firmware 1.6.6 as default BIOS!
|
||||
<rom name="topy topy gogo.smc" size="17302528" crc="9a5faa26" sha1="46e1f08ec260a633e8e4c44b3b46b5135e6c76a6" offset="0" />
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
</software>
|
||||
|
||||
<software name="tearsast">
|
||||
<description>Tears - Another Story (Kor)</description>
|
||||
<year>2003</year>
|
||||
@ -493,5 +493,5 @@ It is recommended to use the firmware 1.6.6 as default BIOS!
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
|
||||
</softwarelist>
|
||||
|
@ -27,5 +27,5 @@
|
||||
</diskarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
|
||||
</softwarelist>
|
||||
|
@ -138,17 +138,17 @@ int main(int argc, char *argv[])
|
||||
(*excpathhead)->pathlen = (*excpathhead)->path.len();
|
||||
excpathhead = &(*excpathhead)->next;
|
||||
}
|
||||
|
||||
|
||||
else if (arg[0] == '-' && arg[1] == 'F')
|
||||
{
|
||||
argnum++;
|
||||
}
|
||||
|
||||
else if (arg[0] == '-' && arg[1] == 'D')
|
||||
{
|
||||
// some pkgconfigs return defines (e.g. pkg-config QtGui --cflags) ==> ignore
|
||||
argnum++;
|
||||
}
|
||||
else if (arg[0] == '-' && arg[1] == 'D')
|
||||
{
|
||||
// some pkgconfigs return defines (e.g. pkg-config QtGui --cflags) ==> ignore
|
||||
argnum++;
|
||||
}
|
||||
|
||||
// ignore -include which is used by sdlmame to include sdlprefix.h before all other includes
|
||||
else if (strcmp(arg,"-include") == 0)
|
||||
|
@ -177,7 +177,7 @@ void a2bus_sn76489_device::write_c0nx(address_space &space, UINT8 offset, UINT8
|
||||
case 3:
|
||||
if (m_has4thsn)
|
||||
{
|
||||
m_sn4->write(space, 0, data);
|
||||
m_sn4->write(space, 0, data);
|
||||
m_latch3 = data;
|
||||
}
|
||||
break;
|
||||
|
@ -498,7 +498,7 @@ INPUT_PORTS_START( abc830 )
|
||||
PORT_START("SW3")
|
||||
PORT_DIPNAME( 0x7f, 0x2d, "Card Address" ) PORT_DIPLOCATION("SW3:1,2,3,4,5,6,7")
|
||||
PORT_DIPSETTING( 0x2d, "45" )
|
||||
|
||||
|
||||
PORT_START("S1") // also S3,S5
|
||||
PORT_DIPNAME( 0x01, 0x01, "Interface Type" )
|
||||
PORT_DIPSETTING( 0x00, "ABC 1600" )
|
||||
@ -549,7 +549,7 @@ INPUT_PORTS_START( abc832 )
|
||||
PORT_START("SW3")
|
||||
PORT_DIPNAME( 0x7f, 0x2c, "Card Address" ) PORT_DIPLOCATION("SW3:1,2,3,4,5,6,7")
|
||||
PORT_DIPSETTING( 0x2c, "44" )
|
||||
|
||||
|
||||
PORT_START("S1") // also S3,S5
|
||||
PORT_DIPNAME( 0x01, 0x01, "Interface Type" )
|
||||
PORT_DIPSETTING( 0x00, "ABC 1600" )
|
||||
@ -629,7 +629,7 @@ INPUT_PORTS_START( abc838 )
|
||||
PORT_START("SW1")
|
||||
PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:1,2,3,4")
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Unused ) )
|
||||
|
||||
|
||||
PORT_START("SW2")
|
||||
PORT_DIPNAME( 0x0f, 0x0e, "Drive Type" ) PORT_DIPLOCATION("SW2:1,2,3,4")
|
||||
PORT_DIPSETTING( 0x0e, "BASF 6105" )
|
||||
@ -688,7 +688,7 @@ INPUT_PORTS_START( abc850 )
|
||||
PORT_START("SW3")
|
||||
PORT_DIPNAME( 0x7f, 0x2c, "Card Address" ) PORT_DIPLOCATION("SW3:1,2,3,4,5,6,7")
|
||||
PORT_DIPSETTING( 0x2c, "44" )
|
||||
|
||||
|
||||
PORT_START("S1") // also S3,S5
|
||||
PORT_DIPNAME( 0x01, 0x01, "Interface Type" )
|
||||
PORT_DIPSETTING( 0x00, "ABC 1600" )
|
||||
@ -1125,11 +1125,11 @@ WRITE8_MEMBER( luxor_55_21046_device::_8a_w )
|
||||
|
||||
if (BIT(data, 2))
|
||||
{
|
||||
m_fdc->set_unscaled_clock(XTAL_16MHz/16);
|
||||
m_fdc->set_unscaled_clock(XTAL_16MHz/16);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fdc->set_unscaled_clock(XTAL_16MHz/8);
|
||||
m_fdc->set_unscaled_clock(XTAL_16MHz/8);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,12 +30,12 @@
|
||||
|
||||
$ mess abc800m -bus abc850 -flop1 ufd631 -hard ro202.chd
|
||||
$ mess abc800m -bus abc850 -bus:abc850:io2 xebec,bios=basf6186 -flop1 ufd631 -hard basf6186.chd
|
||||
|
||||
or with the ABC 852 attached:
|
||||
|
||||
or with the ABC 852 attached:
|
||||
|
||||
$ mess abc800m -bus abc852 -flop1 ufd631 -hard basf6185.chd
|
||||
$ mess abc800m -bus abc852 -bus:abc852:io2 xebec,bios=nec5126 -flop1 ufd631 -hard nec5126.chd
|
||||
|
||||
|
||||
or with the ABC 856 attached:
|
||||
|
||||
$ mess abc800m -bus abc856 -flop1 ufd631 -hard micr1325.chd
|
||||
@ -59,12 +59,12 @@
|
||||
Enter "DOSGEN,F HD0:" to start the formatting utility.
|
||||
Enter "J", and enter "J" to confirm the formatting.
|
||||
|
||||
If you have a 20MB image, format the second partition by entering "DOSGEN,F HD1:", "J", and "J".
|
||||
If you have a 20MB image, format the second partition by entering "DOSGEN,F HD1:", "J", and "J".
|
||||
|
||||
If you have a 60MB image, format the third partition by entering "DOSGEN,F HD2:", "J", and "J",
|
||||
and format the fourth partition by entering "DOSGEN,F HD3:", "J", and "J".
|
||||
If you have a 60MB image, format the third partition by entering "DOSGEN,F HD2:", "J", and "J",
|
||||
and format the fourth partition by entering "DOSGEN,F HD3:", "J", and "J".
|
||||
|
||||
You can now list your freshly created partitions by entering "LIB".
|
||||
You can now list your freshly created partitions by entering "LIB".
|
||||
|
||||
Or skip all of the above and use the preformatted images in the software list:
|
||||
|
||||
|
@ -10,12 +10,12 @@
|
||||
**********************************************************************/
|
||||
|
||||
/*
|
||||
|
||||
TODO:
|
||||
|
||||
- 320KB DSDD 5.25"
|
||||
- 720KB DSDD 3.5"
|
||||
- 1.44MB DSHD 3.5"
|
||||
TODO:
|
||||
|
||||
- 320KB DSDD 5.25"
|
||||
- 720KB DSDD 3.5"
|
||||
- 1.44MB DSHD 3.5"
|
||||
|
||||
*/
|
||||
|
||||
|
@ -67,7 +67,7 @@ void c64_pagefox_cartridge_device::device_start()
|
||||
{
|
||||
// allocate memory
|
||||
m_ram.allocate(0x8000);
|
||||
|
||||
|
||||
// state saving
|
||||
save_item(NAME(m_bank));
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ static ADDRESS_MAP_START( iskr_1030_keyboard_io, AS_IO, 8, iskr_1030_keyboard_de
|
||||
AM_RANGE(0x00, 0xFF) AM_RAM
|
||||
AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w)
|
||||
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w)
|
||||
// AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t0_r)
|
||||
// AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t0_r)
|
||||
AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -358,7 +358,7 @@ WRITE_LINE_MEMBER( iskr_1030_keyboard_device::data_write )
|
||||
READ8_MEMBER( iskr_1030_keyboard_device::t0_r )
|
||||
{
|
||||
return 0;
|
||||
// return clock_signal();
|
||||
// return clock_signal();
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ protected:
|
||||
// device_plus4_expansion_card_interface overrides
|
||||
virtual UINT8 plus4_cd_r(address_space &space, offs_t offset, UINT8 data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h);
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
// ======================> vic10_standard_cartridge_device
|
||||
|
||||
class vic10_standard_cartridge_device : public device_t,
|
||||
public device_vic10_expansion_card_interface
|
||||
public device_vic10_expansion_card_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*
|
||||
* 8x300.c
|
||||
*
|
||||
* Implementation of the Scientific Micro Systems SMS300 / Signetics 8X300 CPU
|
||||
* Implementation of the Scientific Micro Systems SMS300 / Signetics 8X300 CPU
|
||||
* Created on: 18/12/2013
|
||||
*
|
||||
* Written by Barry Rodewald
|
||||
* Written by Barry Rodewald
|
||||
*/
|
||||
|
||||
#include "debugger.h"
|
||||
@ -56,7 +56,7 @@ void n8x300_cpu_device::set_reg(UINT8 reg, UINT8 val)
|
||||
case 0x05: m_R5 = val; break;
|
||||
case 0x06: m_R6 = val; break;
|
||||
case 0x07: m_IVL = val; break;
|
||||
// OVF is read-only
|
||||
// OVF is read-only
|
||||
case 0x09: m_R11 = val; break;
|
||||
case 0x0f: m_IVR = val; break;
|
||||
default: logerror("8X300: Invalid register %02x written to.\n",reg); break;
|
||||
@ -74,10 +74,10 @@ UINT8 n8x300_cpu_device::get_reg(UINT8 reg)
|
||||
case 0x04: return m_R4;
|
||||
case 0x05: return m_R5;
|
||||
case 0x06: return m_R6;
|
||||
// IVL is write-only
|
||||
// IVL is write-only
|
||||
case 0x08: return m_OVF;
|
||||
case 0x09: return m_R11;
|
||||
// IVR is write-only
|
||||
// IVR is write-only
|
||||
default: logerror("8X300: Invalid register %02x read.\n",reg); return 0;
|
||||
}
|
||||
return 0;
|
||||
@ -142,9 +142,9 @@ void n8x300_cpu_device::state_string_export(const device_state_entry &entry, ast
|
||||
{
|
||||
switch (entry.index())
|
||||
{
|
||||
// case STATE_GENFLAGS:
|
||||
// string.printf("%c%c%c%c%c%c",
|
||||
// break;
|
||||
// case STATE_GENFLAGS:
|
||||
// string.printf("%c%c%c%c%c%c",
|
||||
// break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -550,4 +550,3 @@ offs_t n8x300_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT
|
||||
extern CPU_DISASSEMBLE( n8x300 );
|
||||
return CPU_DISASSEMBLE_NAME(n8x300)(this, buffer, pc, oprom, opram, options);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* 8x300.h
|
||||
*
|
||||
* Implementation of the Scientific Micro Systems SMS300 / Signetics 8X300 Microcontroller
|
||||
* Implementation of the Scientific Micro Systems SMS300 / Signetics 8X300 Microcontroller
|
||||
* Created on: 18/12/2013
|
||||
*/
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 8x300dasm.c
|
||||
* Implementation of the Scientific Micro Systems SMS300 / Signetics 8X300 Microcontroller
|
||||
* Implementation of the Scientific Micro Systems SMS300 / Signetics 8X300 Microcontroller
|
||||
*
|
||||
* Created on: 18/12/2013
|
||||
*/
|
||||
|
@ -77,7 +77,7 @@ CPUOBJS += $(CPUOBJ)/8x300/8x300.o
|
||||
DASMOBJS += $(CPUOBJ)/8x300/8x300dasm.o
|
||||
endif
|
||||
|
||||
$(CPUOBJ)/8x300/8x300.o: $(CPUSRC)/8x300/8x300.c \
|
||||
$(CPUOBJ)/8x300/8x300.o: $(CPUSRC)/8x300/8x300.c \
|
||||
$(CPUSRC)/8x300/8x300.h
|
||||
|
||||
#-------------------------------------------------
|
||||
|
@ -41,7 +41,7 @@ const device_type T11 = &device_creator<t11_device>;
|
||||
t11_device::t11_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: cpu_device(mconfig, T11, "T11", tag, owner, clock, "t11", __FILE__)
|
||||
, m_program_config("program", ENDIANNESS_LITTLE, 16, 16, 0)
|
||||
, c_initial_mode(0)
|
||||
, c_initial_mode(0)
|
||||
{
|
||||
m_is_octal = true;
|
||||
}
|
||||
@ -379,4 +379,3 @@ offs_t t11_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *opro
|
||||
extern CPU_DISASSEMBLE( t11 );
|
||||
return CPU_DISASSEMBLE_NAME(t11)(this, buffer, pc, oprom, opram, options);
|
||||
}
|
||||
|
||||
|
@ -682,7 +682,7 @@ int tms57002_device::decode_get_pc()
|
||||
for(;;) {
|
||||
short ipc;
|
||||
UINT32 opcode = program->read_dword(adr << 2);
|
||||
|
||||
|
||||
cs.inc = 0;
|
||||
|
||||
if((opcode & 0xfc0000) == 0xfc0000)
|
||||
@ -743,11 +743,11 @@ void tms57002_device::execute_run()
|
||||
case 1:
|
||||
++ca;
|
||||
goto inst;
|
||||
|
||||
|
||||
case 2:
|
||||
++id;
|
||||
goto inst;
|
||||
|
||||
|
||||
case 3:
|
||||
++ca, ++id;
|
||||
goto inst;
|
||||
|
@ -163,11 +163,11 @@ const device_type Z8611 = &device_creator<z8611_device>;
|
||||
***************************************************************************/
|
||||
|
||||
static ADDRESS_MAP_START( program_2kb, AS_PROGRAM, 8, z8_device )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_ROM
|
||||
AM_RANGE(0x0000, 0x07ff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( program_4kb, AS_PROGRAM, 8, z8_device )
|
||||
AM_RANGE(0x0000, 0x0fff) AM_ROM
|
||||
AM_RANGE(0x0000, 0x0fff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
@ -846,4 +846,3 @@ void z8_device::execute_set_input(int inputnum, int state)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -442,7 +442,7 @@ const char *device_image_interface::get_feature(const char *feature_name)
|
||||
bool device_image_interface::load_software_region(const char *tag, optional_shared_ptr<UINT8> &ptr)
|
||||
{
|
||||
size_t size = get_software_region_length(tag);
|
||||
|
||||
|
||||
if (size)
|
||||
{
|
||||
ptr.allocate(size);
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
{
|
||||
CTS = 0x0001, /* Clear to Send. (INPUT) Other end of connection is ready to accept data */
|
||||
RTS = 0x0002, /* Request to Send. (OUTPUT) This end is ready to send data, and requests if the other */
|
||||
/* end is ready to accept it */
|
||||
/* end is ready to accept it */
|
||||
DSR = 0x0004, /* Data Set ready. (INPUT) Other end of connection has data */
|
||||
DTR = 0x0008, /* Data terminal Ready. (OUTPUT) TX contains new data. */
|
||||
RX = 0x0010, /* Recieve data. (INPUT) */
|
||||
@ -159,7 +159,7 @@ private:
|
||||
|
||||
|
||||
class serial_source_device : public device_t,
|
||||
public device_serial_interface
|
||||
public device_serial_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
|
@ -370,8 +370,8 @@ WRITE8_MEMBER( mc2661_device::write )
|
||||
UINT32 tx_baud = baud_rates[data & 0x0f];
|
||||
if(data & 0x10) // internal receiver clock
|
||||
{
|
||||
// if((m_mr[0] & 0x03) != 0)
|
||||
// rx_baud *= 16;
|
||||
// if((m_mr[0] & 0x03) != 0)
|
||||
// rx_baud *= 16;
|
||||
}
|
||||
else // external receiver clock
|
||||
{
|
||||
@ -390,8 +390,8 @@ WRITE8_MEMBER( mc2661_device::write )
|
||||
}
|
||||
if(data & 0x20) // internal transmitter clock
|
||||
{
|
||||
// if((m_mr[0] & 0x03) != 0)
|
||||
// tx_baud *= 16;
|
||||
// if((m_mr[0] & 0x03) != 0)
|
||||
// tx_baud *= 16;
|
||||
}
|
||||
else // external transmitter clock
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ const device_type NETLIST = &device_creator<netlist_mame_device>;
|
||||
netlist_mame_device::netlist_mame_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, NETLIST, "netlist", tag, owner, clock, "netlist_mame", __FILE__),
|
||||
device_execute_interface(mconfig, *this),
|
||||
//device_state_interface(mconfig, *this),
|
||||
//device_state_interface(mconfig, *this),
|
||||
m_device_start_list(100),
|
||||
m_netlist(NULL),
|
||||
m_setup(NULL),
|
||||
@ -81,21 +81,21 @@ void netlist_mame_device::static_set_constructor(device_t &device, void (*setup_
|
||||
|
||||
void netlist_mame_device::device_config_complete()
|
||||
{
|
||||
LOG_DEV_CALLS(("device_config_complete\n"));
|
||||
LOG_DEV_CALLS(("device_config_complete\n"));
|
||||
}
|
||||
|
||||
void netlist_mame_device::device_start()
|
||||
{
|
||||
LOG_DEV_CALLS(("device_start\n"));
|
||||
LOG_DEV_CALLS(("device_start\n"));
|
||||
|
||||
m_netlist = global_alloc_clear(netlist_mame_t(*this));
|
||||
m_setup = global_alloc_clear(netlist_setup_t(*m_netlist));
|
||||
m_netlist->init_object(*m_netlist, "netlist");
|
||||
m_setup->init();
|
||||
m_netlist->init_object(*m_netlist, "netlist");
|
||||
m_setup->init();
|
||||
|
||||
m_netlist->set_clock_freq(this->clock());
|
||||
m_netlist->set_clock_freq(this->clock());
|
||||
|
||||
// register additional devices
|
||||
// register additional devices
|
||||
|
||||
m_setup->factory().register_device<nld_analog_callback>( "NETDEV_CALLBACK", "nld_analog_callback");
|
||||
|
||||
@ -104,12 +104,12 @@ void netlist_mame_device::device_start()
|
||||
m_setup->start_devices();
|
||||
m_setup->resolve_inputs();
|
||||
|
||||
bool allok = true;
|
||||
for (device_start_list_t::entry_t *ods = m_device_start_list.first(); ods != NULL; ods = m_device_start_list.next(ods))
|
||||
allok &= ods->object()->OnDeviceStart();
|
||||
bool allok = true;
|
||||
for (device_start_list_t::entry_t *ods = m_device_start_list.first(); ods != NULL; ods = m_device_start_list.next(ods))
|
||||
allok &= ods->object()->OnDeviceStart();
|
||||
|
||||
if (!allok)
|
||||
m_netlist->xfatalerror("required elements not found\n");
|
||||
if (!allok)
|
||||
m_netlist->xfatalerror("required elements not found\n");
|
||||
|
||||
save_state();
|
||||
|
||||
@ -119,13 +119,13 @@ void netlist_mame_device::device_start()
|
||||
|
||||
void netlist_mame_device::device_reset()
|
||||
{
|
||||
LOG_DEV_CALLS(("device_reset\n"));
|
||||
LOG_DEV_CALLS(("device_reset\n"));
|
||||
m_netlist->reset();
|
||||
}
|
||||
|
||||
void netlist_mame_device::device_stop()
|
||||
{
|
||||
LOG_DEV_CALLS(("device_stop\n"));
|
||||
LOG_DEV_CALLS(("device_stop\n"));
|
||||
m_setup->print_stats();
|
||||
|
||||
global_free(m_setup);
|
||||
@ -136,38 +136,38 @@ void netlist_mame_device::device_stop()
|
||||
|
||||
ATTR_COLD void netlist_mame_device::device_post_load()
|
||||
{
|
||||
LOG_DEV_CALLS(("device_post_load\n"));
|
||||
m_netlist->queue().clear();
|
||||
NL_VERBOSE_OUT(("current time %f qsize %d\n", m_netlist->time().as_double(), qsize));
|
||||
for (int i = 0; i < qsize; i++ )
|
||||
{
|
||||
netlist_net_t *n = m_netlist->find_net(qtemp[i].m_name);
|
||||
NL_VERBOSE_OUT(("Got %s ==> %p\n", qtemp[i].m_name, n));
|
||||
NL_VERBOSE_OUT(("schedule time %f (%f)\n", n->time().as_double(), qtemp[i].m_time.as_double()));
|
||||
m_netlist->queue().push(netlist_base_t::queue_t::entry_t(qtemp[i].m_time, *n));
|
||||
}
|
||||
LOG_DEV_CALLS(("device_post_load\n"));
|
||||
m_netlist->queue().clear();
|
||||
NL_VERBOSE_OUT(("current time %f qsize %d\n", m_netlist->time().as_double(), qsize));
|
||||
for (int i = 0; i < qsize; i++ )
|
||||
{
|
||||
netlist_net_t *n = m_netlist->find_net(qtemp[i].m_name);
|
||||
NL_VERBOSE_OUT(("Got %s ==> %p\n", qtemp[i].m_name, n));
|
||||
NL_VERBOSE_OUT(("schedule time %f (%f)\n", n->time().as_double(), qtemp[i].m_time.as_double()));
|
||||
m_netlist->queue().push(netlist_base_t::queue_t::entry_t(qtemp[i].m_time, *n));
|
||||
}
|
||||
}
|
||||
|
||||
ATTR_COLD void netlist_mame_device::device_pre_save()
|
||||
{
|
||||
LOG_DEV_CALLS(("device_pre_save\n"));
|
||||
LOG_DEV_CALLS(("device_pre_save\n"));
|
||||
|
||||
qsize = m_netlist->queue().count();
|
||||
NL_VERBOSE_OUT(("current time %f qsize %d\n", m_netlist->time().as_double(), qsize));
|
||||
for (int i = 0; i < qsize; i++ )
|
||||
{
|
||||
qtemp[i].m_time = m_netlist->queue().listptr()[i].time();
|
||||
const char *p = m_netlist->queue().listptr()[i].object().name().cstr();
|
||||
int n = MIN(63, strlen(p));
|
||||
strncpy(qtemp[i].m_name, p, n);
|
||||
qtemp[i].m_name[n] = 0;
|
||||
}
|
||||
qsize = m_netlist->queue().count();
|
||||
NL_VERBOSE_OUT(("current time %f qsize %d\n", m_netlist->time().as_double(), qsize));
|
||||
for (int i = 0; i < qsize; i++ )
|
||||
{
|
||||
qtemp[i].m_time = m_netlist->queue().listptr()[i].time();
|
||||
const char *p = m_netlist->queue().listptr()[i].object().name().cstr();
|
||||
int n = MIN(63, strlen(p));
|
||||
strncpy(qtemp[i].m_name, p, n);
|
||||
qtemp[i].m_name[n] = 0;
|
||||
}
|
||||
#if 0
|
||||
|
||||
netlist_time *nlt = (netlist_time *) ;
|
||||
netlist_base_t::queue_t::entry_t *p = m_netlist->queue().listptr()[i];
|
||||
netlist_time *nlt = (netlist_time *) p->time_ptr();
|
||||
save_pointer(nlt->get_internaltype_ptr(), "queue", 1, i);
|
||||
netlist_time *nlt = (netlist_time *) ;
|
||||
netlist_base_t::queue_t::entry_t *p = m_netlist->queue().listptr()[i];
|
||||
netlist_time *nlt = (netlist_time *) p->time_ptr();
|
||||
save_pointer(nlt->get_internaltype_ptr(), "queue", 1, i);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -179,43 +179,43 @@ void netlist_mame_device::device_timer(emu_timer &timer, device_timer_id id, int
|
||||
|
||||
ATTR_COLD void netlist_mame_device::save_state()
|
||||
{
|
||||
for (pstate_entry_t::list_t::entry_t *p = m_netlist->save_list().first(); p != NULL; p = m_netlist->save_list().next(p))
|
||||
{
|
||||
pstate_entry_t *s = p->object();
|
||||
NL_VERBOSE_OUT(("saving state for %s\n", s->m_name.cstr()));
|
||||
switch (s->m_dt)
|
||||
{
|
||||
case DT_DOUBLE:
|
||||
save_pointer((double *) s->m_ptr, s->m_name, s->m_count);
|
||||
break;
|
||||
case DT_INT64:
|
||||
save_pointer((INT64 *) s->m_ptr, s->m_name, s->m_count);
|
||||
break;
|
||||
case DT_INT8:
|
||||
save_pointer((INT8 *) s->m_ptr, s->m_name, s->m_count);
|
||||
break;
|
||||
case DT_INT:
|
||||
save_pointer((int *) s->m_ptr, s->m_name, s->m_count);
|
||||
break;
|
||||
case DT_BOOLEAN:
|
||||
save_pointer((bool *) s->m_ptr, s->m_name, s->m_count);
|
||||
break;
|
||||
case NOT_SUPPORTED:
|
||||
default:
|
||||
m_netlist->xfatalerror("found unsupported save element %s\n", s->m_name.cstr());
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (pstate_entry_t::list_t::entry_t *p = m_netlist->save_list().first(); p != NULL; p = m_netlist->save_list().next(p))
|
||||
{
|
||||
pstate_entry_t *s = p->object();
|
||||
NL_VERBOSE_OUT(("saving state for %s\n", s->m_name.cstr()));
|
||||
switch (s->m_dt)
|
||||
{
|
||||
case DT_DOUBLE:
|
||||
save_pointer((double *) s->m_ptr, s->m_name, s->m_count);
|
||||
break;
|
||||
case DT_INT64:
|
||||
save_pointer((INT64 *) s->m_ptr, s->m_name, s->m_count);
|
||||
break;
|
||||
case DT_INT8:
|
||||
save_pointer((INT8 *) s->m_ptr, s->m_name, s->m_count);
|
||||
break;
|
||||
case DT_INT:
|
||||
save_pointer((int *) s->m_ptr, s->m_name, s->m_count);
|
||||
break;
|
||||
case DT_BOOLEAN:
|
||||
save_pointer((bool *) s->m_ptr, s->m_name, s->m_count);
|
||||
break;
|
||||
case NOT_SUPPORTED:
|
||||
default:
|
||||
m_netlist->xfatalerror("found unsupported save element %s\n", s->m_name.cstr());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// handle the queue
|
||||
// handle the queue
|
||||
|
||||
save_item(NAME(qsize));
|
||||
for (int i = 0; i < m_netlist->queue().capacity(); i++ )
|
||||
{
|
||||
save_pointer(qtemp[i].m_time.get_internaltype_ptr(), "queue_time", 1, i);
|
||||
save_pointer(qtemp[i].m_name, "queue_name", sizeof(qtemp[i].m_name), i);
|
||||
save_item(NAME(qsize));
|
||||
for (int i = 0; i < m_netlist->queue().capacity(); i++ )
|
||||
{
|
||||
save_pointer(qtemp[i].m_time.get_internaltype_ptr(), "queue_time", 1, i);
|
||||
save_pointer(qtemp[i].m_name, "queue_name", sizeof(qtemp[i].m_name), i);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ATTR_COLD UINT64 netlist_mame_device::execute_clocks_to_cycles(UINT64 clocks) const
|
||||
@ -235,7 +235,7 @@ ATTR_HOT void netlist_mame_device::execute_run()
|
||||
// debugging
|
||||
//m_ppc = m_pc; // copy PC to previous PC
|
||||
if (check_debugger)
|
||||
debugger_instruction_hook(this, 0); //m_pc);
|
||||
debugger_instruction_hook(this, 0); //m_pc);
|
||||
|
||||
m_netlist->process_queue(m_icount);
|
||||
}
|
||||
|
@ -70,18 +70,18 @@
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
#define NETLIST_MEMREGION(_name) \
|
||||
netlist.parse((char *)downcast<netlist_mame_t &>(netlist.netlist()).machine().root_device().memregion(_name)->base());
|
||||
netlist.parse((char *)downcast<netlist_mame_t &>(netlist.netlist()).machine().root_device().memregion(_name)->base());
|
||||
|
||||
#define NETDEV_ANALOG_CALLBACK(_name, _IN, _class, _member, _tag) \
|
||||
{ \
|
||||
NETLIB_NAME(analog_callback) *dev = downcast<NETLIB_NAME(analog_callback) *>(netlist.register_dev(NET_NEW(analog_callback), # _name)); \
|
||||
netlist_analog_output_delegate d = netlist_analog_output_delegate(& _class :: _member, # _class "::" # _member, _tag, (_class *) 0); \
|
||||
dev->register_callback(d); \
|
||||
} \
|
||||
NET_CONNECT(_name, IN, _IN)
|
||||
{ \
|
||||
NETLIB_NAME(analog_callback) *dev = downcast<NETLIB_NAME(analog_callback) *>(netlist.register_dev(NET_NEW(analog_callback), # _name)); \
|
||||
netlist_analog_output_delegate d = netlist_analog_output_delegate(& _class :: _member, # _class "::" # _member, _tag, (_class *) 0); \
|
||||
dev->register_callback(d); \
|
||||
} \
|
||||
NET_CONNECT(_name, IN, _IN)
|
||||
|
||||
#define NETDEV_ANALOG_CALLBACK_MEMBER(_name) \
|
||||
void _name(const double data, const attotime &time)
|
||||
void _name(const double data, const attotime &time)
|
||||
|
||||
class netlist_mame_device;
|
||||
|
||||
@ -89,26 +89,26 @@ class netlist_mame_t : public netlist_base_t
|
||||
{
|
||||
public:
|
||||
|
||||
netlist_mame_t(netlist_mame_device &parent)
|
||||
: netlist_base_t(),
|
||||
m_parent(parent)
|
||||
{}
|
||||
virtual ~netlist_mame_t() { };
|
||||
netlist_mame_t(netlist_mame_device &parent)
|
||||
: netlist_base_t(),
|
||||
m_parent(parent)
|
||||
{}
|
||||
virtual ~netlist_mame_t() { };
|
||||
|
||||
inline running_machine &machine();
|
||||
inline running_machine &machine();
|
||||
|
||||
netlist_mame_device &parent() { return m_parent; }
|
||||
netlist_mame_device &parent() { return m_parent; }
|
||||
|
||||
protected:
|
||||
|
||||
void vfatalerror(const char *format, va_list ap) const
|
||||
{
|
||||
emu_fatalerror error(format, ap);
|
||||
throw error;
|
||||
}
|
||||
void vfatalerror(const char *format, va_list ap) const
|
||||
{
|
||||
emu_fatalerror error(format, ap);
|
||||
throw error;
|
||||
}
|
||||
|
||||
private:
|
||||
netlist_mame_device &m_parent;
|
||||
netlist_mame_device &m_parent;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -121,21 +121,21 @@ private:
|
||||
// ======================> netlist_mame_device
|
||||
|
||||
class netlist_mame_device : public device_t,
|
||||
public device_execute_interface
|
||||
//public device_state_interface
|
||||
//, public device_memory_interface
|
||||
public device_execute_interface
|
||||
//public device_state_interface
|
||||
//, public device_memory_interface
|
||||
{
|
||||
public:
|
||||
|
||||
template<bool _Required, class _NETClass>
|
||||
class output_finder;
|
||||
template<class C>
|
||||
template<class C>
|
||||
class optional_output;
|
||||
template<class C>
|
||||
class required_output;
|
||||
template<class C>
|
||||
template<class C>
|
||||
class optional_param;
|
||||
template<class C>
|
||||
template<class C>
|
||||
class required_param;
|
||||
class on_device_start;
|
||||
|
||||
@ -159,7 +159,7 @@ protected:
|
||||
virtual void device_stop();
|
||||
virtual void device_reset();
|
||||
virtual void device_post_load();
|
||||
virtual void device_pre_save();
|
||||
virtual void device_pre_save();
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const;
|
||||
virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const;
|
||||
@ -173,8 +173,8 @@ protected:
|
||||
// more save state ... needs to go somewhere else
|
||||
|
||||
struct qentry {
|
||||
netlist_time m_time;
|
||||
char m_name[64];
|
||||
netlist_time m_time;
|
||||
char m_name[64];
|
||||
};
|
||||
|
||||
qentry qtemp[1024];
|
||||
@ -193,7 +193,7 @@ private:
|
||||
|
||||
inline running_machine &netlist_mame_t::machine()
|
||||
{
|
||||
return m_parent.machine();
|
||||
return m_parent.machine();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -205,75 +205,75 @@ typedef device_delegate<void (const double, const attotime &)> netlist_analog_ou
|
||||
class NETLIB_NAME(analog_callback) : public netlist_device_t
|
||||
{
|
||||
public:
|
||||
NETLIB_NAME(analog_callback)()
|
||||
: netlist_device_t() { }
|
||||
NETLIB_NAME(analog_callback)()
|
||||
: netlist_device_t() { }
|
||||
|
||||
ATTR_COLD void start()
|
||||
{
|
||||
register_input("IN", m_in);
|
||||
m_callback.bind_relative_to(downcast<netlist_mame_t &>(netlist()).machine().root_device());
|
||||
}
|
||||
ATTR_COLD void start()
|
||||
{
|
||||
register_input("IN", m_in);
|
||||
m_callback.bind_relative_to(downcast<netlist_mame_t &>(netlist()).machine().root_device());
|
||||
}
|
||||
|
||||
ATTR_COLD void register_callback(netlist_analog_output_delegate callback)
|
||||
{
|
||||
m_callback = callback;
|
||||
}
|
||||
ATTR_COLD void register_callback(netlist_analog_output_delegate callback)
|
||||
{
|
||||
m_callback = callback;
|
||||
}
|
||||
|
||||
ATTR_HOT void update()
|
||||
{
|
||||
// FIXME: Remove after device cleanup
|
||||
if (!m_callback.isnull())
|
||||
m_callback(INPANALOG(m_in), downcast<netlist_mame_t &>(netlist()).parent().local_time());
|
||||
}
|
||||
ATTR_HOT void update()
|
||||
{
|
||||
// FIXME: Remove after device cleanup
|
||||
if (!m_callback.isnull())
|
||||
m_callback(INPANALOG(m_in), downcast<netlist_mame_t &>(netlist()).parent().local_time());
|
||||
}
|
||||
|
||||
private:
|
||||
netlist_analog_input_t m_in;
|
||||
netlist_analog_output_delegate m_callback;
|
||||
netlist_analog_input_t m_in;
|
||||
netlist_analog_output_delegate m_callback;
|
||||
};
|
||||
|
||||
class NETLIB_NAME(sound) : public netlist_device_t
|
||||
{
|
||||
public:
|
||||
NETLIB_NAME(sound)()
|
||||
: netlist_device_t() { }
|
||||
NETLIB_NAME(sound)()
|
||||
: netlist_device_t() { }
|
||||
|
||||
static const int BUFSIZE = 2048;
|
||||
static const int BUFSIZE = 2048;
|
||||
|
||||
ATTR_COLD void start()
|
||||
{
|
||||
register_input("IN", m_in);
|
||||
m_cur = 0;
|
||||
m_last_pos = 0;
|
||||
m_last_buffer = netlist_time::zero;
|
||||
m_sample = netlist_time::zero; // FIXME: divide by zero
|
||||
}
|
||||
ATTR_COLD void start()
|
||||
{
|
||||
register_input("IN", m_in);
|
||||
m_cur = 0;
|
||||
m_last_pos = 0;
|
||||
m_last_buffer = netlist_time::zero;
|
||||
m_sample = netlist_time::zero; // FIXME: divide by zero
|
||||
}
|
||||
|
||||
ATTR_HOT void sound_update()
|
||||
{
|
||||
netlist_time current = netlist().time();
|
||||
int pos = (current - m_last_buffer) / m_sample;
|
||||
if (pos >= BUFSIZE)
|
||||
netlist().xfatalerror("sound %s: exceeded BUFSIZE\n", name().cstr());
|
||||
while (m_last_pos < pos )
|
||||
{
|
||||
m_buffer[m_last_pos++] = m_cur;
|
||||
}
|
||||
}
|
||||
ATTR_HOT void sound_update()
|
||||
{
|
||||
netlist_time current = netlist().time();
|
||||
int pos = (current - m_last_buffer) / m_sample;
|
||||
if (pos >= BUFSIZE)
|
||||
netlist().xfatalerror("sound %s: exceeded BUFSIZE\n", name().cstr());
|
||||
while (m_last_pos < pos )
|
||||
{
|
||||
m_buffer[m_last_pos++] = m_cur;
|
||||
}
|
||||
}
|
||||
|
||||
ATTR_HOT void update()
|
||||
{
|
||||
double val = INPANALOG(m_in);
|
||||
sound_update();
|
||||
m_cur = val;
|
||||
}
|
||||
ATTR_HOT void update()
|
||||
{
|
||||
double val = INPANALOG(m_in);
|
||||
sound_update();
|
||||
m_cur = val;
|
||||
}
|
||||
|
||||
private:
|
||||
netlist_analog_input_t m_in;
|
||||
netlist_time m_sample;
|
||||
double m_cur;
|
||||
int m_last_pos;
|
||||
netlist_time m_last_buffer;
|
||||
stream_sample_t m_buffer[BUFSIZE];
|
||||
netlist_analog_input_t m_in;
|
||||
netlist_time m_sample;
|
||||
double m_cur;
|
||||
int m_last_pos;
|
||||
netlist_time m_last_buffer;
|
||||
stream_sample_t m_buffer[BUFSIZE];
|
||||
};
|
||||
|
||||
|
||||
|
@ -4,15 +4,15 @@ const device_type NSCSI_CB = &device_creator<nscsi_callback_device>;
|
||||
|
||||
nscsi_callback_device::nscsi_callback_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: nscsi_device(mconfig, NSCSI_CB, "SCSI callback (new)", tag, owner, clock, "nscsi_cb", __FILE__),
|
||||
m_write_rst(*this),
|
||||
m_write_atn(*this),
|
||||
m_write_ack(*this),
|
||||
m_write_req(*this),
|
||||
m_write_msg(*this),
|
||||
m_write_io(*this),
|
||||
m_write_cd(*this),
|
||||
m_write_sel(*this),
|
||||
m_write_bsy(*this)
|
||||
m_write_rst(*this),
|
||||
m_write_atn(*this),
|
||||
m_write_ack(*this),
|
||||
m_write_req(*this),
|
||||
m_write_msg(*this),
|
||||
m_write_io(*this),
|
||||
m_write_cd(*this),
|
||||
m_write_sel(*this),
|
||||
m_write_bsy(*this)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ nscsi_s1410_device::nscsi_s1410_device(const machine_config &mconfig, const char
|
||||
void nscsi_s1410_device::device_reset()
|
||||
{
|
||||
nscsi_harddisk_device::device_reset();
|
||||
|
||||
|
||||
// initialize drive characteristics
|
||||
params[0] = 0;
|
||||
params[1] = 153;
|
||||
@ -44,7 +44,7 @@ void nscsi_s1410_device::scsi_command()
|
||||
scsi_status_complete(SS_NOT_READY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
scsi_status_complete(SS_GOOD);
|
||||
break;
|
||||
|
||||
@ -56,7 +56,7 @@ void nscsi_s1410_device::scsi_command()
|
||||
|
||||
lba = ((scsi_cmdbuf[1] & 0x1f)<<16) | (scsi_cmdbuf[2]<<8) | scsi_cmdbuf[3];
|
||||
blocks = (bytes_per_sector == 256) ? 32 : 17;
|
||||
|
||||
|
||||
int track_length = blocks*bytes_per_sector;
|
||||
UINT8 *data = global_alloc_array(UINT8,track_length);
|
||||
memset(data, 0xc6, track_length);
|
||||
@ -76,7 +76,7 @@ void nscsi_s1410_device::scsi_command()
|
||||
scsi_status_complete(SS_NOT_READY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
scsi_data_in(2, 3);
|
||||
scsi_status_complete(SS_GOOD);
|
||||
break;
|
||||
@ -103,7 +103,7 @@ void nscsi_s1410_device::scsi_command()
|
||||
}
|
||||
scsi_status_complete(SS_GOOD);
|
||||
break;
|
||||
|
||||
|
||||
case SC_READ_ECC_BURST:
|
||||
case SC_RAM_DIAG:
|
||||
case SC_DRIVE_DIAG:
|
||||
@ -135,7 +135,7 @@ void nscsi_s1410_device::scsi_put_data(int id, int pos, UINT8 data)
|
||||
switch(scsi_cmdbuf[0]) {
|
||||
case SC_FORMAT_ALT_TRACK:
|
||||
break;
|
||||
|
||||
|
||||
case SC_INIT_DRIVE_PARAMS:
|
||||
params[pos] = data;
|
||||
break;
|
||||
|
@ -12,42 +12,42 @@ public:
|
||||
protected:
|
||||
// SCSI status returns
|
||||
enum {
|
||||
SS_GOOD = 0x00,
|
||||
SS_NO_INDEX = 0x01,
|
||||
SS_NO_SEEK_COMPLETE = 0x02,
|
||||
SS_WRITE_FAULT = 0x03,
|
||||
SS_NOT_READY = 0x04,
|
||||
SS_TK00_NOT_FOUND = 0x06,
|
||||
SS_SEEK_IN_PROGRESS = 0x08,
|
||||
SS_ID_FIELD_ERROR = 0x10,
|
||||
SS_DATA_ERROR = 0x11,
|
||||
SS_SAM_NOT_FOUND = 0x12,
|
||||
SS_SECTOR_NOT_FOUND = 0x14,
|
||||
SS_SEEK_ERROR = 0x15,
|
||||
SS_ECC = 0x18,
|
||||
SS_BAD_TRACK = 0x19,
|
||||
SS_FORMAT_ERROR = 0x1a,
|
||||
SS_ALT_TRACK = 0x1c,
|
||||
SS_ALT_TRACK_DEFECT = 0x1d,
|
||||
SS_GOOD = 0x00,
|
||||
SS_NO_INDEX = 0x01,
|
||||
SS_NO_SEEK_COMPLETE = 0x02,
|
||||
SS_WRITE_FAULT = 0x03,
|
||||
SS_NOT_READY = 0x04,
|
||||
SS_TK00_NOT_FOUND = 0x06,
|
||||
SS_SEEK_IN_PROGRESS = 0x08,
|
||||
SS_ID_FIELD_ERROR = 0x10,
|
||||
SS_DATA_ERROR = 0x11,
|
||||
SS_SAM_NOT_FOUND = 0x12,
|
||||
SS_SECTOR_NOT_FOUND = 0x14,
|
||||
SS_SEEK_ERROR = 0x15,
|
||||
SS_ECC = 0x18,
|
||||
SS_BAD_TRACK = 0x19,
|
||||
SS_FORMAT_ERROR = 0x1a,
|
||||
SS_ALT_TRACK = 0x1c,
|
||||
SS_ALT_TRACK_DEFECT = 0x1d,
|
||||
SS_ALT_TRACK_NOT_FOUND = 0x1e,
|
||||
SS_ALT_TRACK_SAME = 0x1f,
|
||||
SS_RAM_ERROR = 0x30,
|
||||
SS_ROM_ERROR = 0x31,
|
||||
SS_ECC_CHECK_FAILURE = 0x32
|
||||
SS_RAM_ERROR = 0x30,
|
||||
SS_ROM_ERROR = 0x31,
|
||||
SS_ECC_CHECK_FAILURE = 0x32
|
||||
};
|
||||
|
||||
// SCSI commands
|
||||
enum {
|
||||
SC_TEST_UNIT_READY = 0x00,
|
||||
SC_REZERO = 0x01,
|
||||
SC_REQUEST_SENSE = 0x03,
|
||||
SC_FORMAT_UNIT = 0x04,
|
||||
SC_CHECK_TRACK_FORMAT = 0x05,
|
||||
SC_FORMAT_TRACK = 0x06,
|
||||
SC_REASSIGN_BLOCKS = 0x07,
|
||||
SC_READ = 0x08,
|
||||
SC_WRITE = 0x0a,
|
||||
SC_SEEK = 0x0b,
|
||||
SC_TEST_UNIT_READY = 0x00,
|
||||
SC_REZERO = 0x01,
|
||||
SC_REQUEST_SENSE = 0x03,
|
||||
SC_FORMAT_UNIT = 0x04,
|
||||
SC_CHECK_TRACK_FORMAT = 0x05,
|
||||
SC_FORMAT_TRACK = 0x06,
|
||||
SC_REASSIGN_BLOCKS = 0x07,
|
||||
SC_READ = 0x08,
|
||||
SC_WRITE = 0x0a,
|
||||
SC_SEEK = 0x0b,
|
||||
SC_INIT_DRIVE_PARAMS = 0x0c,
|
||||
SC_READ_ECC_BURST = 0x0d,
|
||||
SC_FORMAT_ALT_TRACK = 0x0e,
|
||||
|
@ -550,10 +550,10 @@ void t10mmc::ReadData( UINT8 *data, int dataLength )
|
||||
|
||||
case T10MMC_CMD_READ_TOC_PMA_ATIP:
|
||||
/*
|
||||
Track numbers are problematic here: 0 = lead-in, 0xaa = lead-out.
|
||||
That makes sense in terms of how real-world CDs are referred to, but
|
||||
our internal routines for tracks use "0" as track 1. That probably
|
||||
should be fixed...
|
||||
Track numbers are problematic here: 0 = lead-in, 0xaa = lead-out.
|
||||
That makes sense in terms of how real-world CDs are referred to, but
|
||||
our internal routines for tracks use "0" as track 1. That probably
|
||||
should be fixed...
|
||||
*/
|
||||
{
|
||||
bool msf = (command[1] & 0x2) != 0;
|
||||
|
@ -42,9 +42,9 @@ void t10sbc::ExecCommand()
|
||||
|
||||
case T10SBC_CMD_SEEK_6:
|
||||
m_lba = (command[1]&0x1f)<<16 | command[2]<<8 | command[3];
|
||||
|
||||
|
||||
logerror("S1410: SEEK to LBA %x\n", m_lba);
|
||||
|
||||
|
||||
m_phase = SCSI_PHASE_STATUS;
|
||||
m_transfer_length = 0;
|
||||
break;
|
||||
|
@ -6,11 +6,11 @@
|
||||
3 timers, address decoder, wait generator, interrupt controller,
|
||||
all integrated in a single chip.
|
||||
|
||||
TODO:
|
||||
- Interrupt generation: handle pending / in-service mechanisms
|
||||
- Parallel port: handle timing latency
|
||||
- Serial port: not done at all
|
||||
- (and many other things)
|
||||
TODO:
|
||||
- Interrupt generation: handle pending / in-service mechanisms
|
||||
- Parallel port: handle timing latency
|
||||
- Serial port: not done at all
|
||||
- (and many other things)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
const device_type TMP68301 = &device_creator<tmp68301_device>;
|
||||
|
||||
static ADDRESS_MAP_START( tmp68301_regs, AS_0, 16, tmp68301_device )
|
||||
// AM_RANGE(0x000,0x3ff) AM_RAM
|
||||
// AM_RANGE(0x000,0x3ff) AM_RAM
|
||||
AM_RANGE(0x094,0x095) AM_READWRITE(imr_r,imr_w)
|
||||
AM_RANGE(0x098,0x099) AM_READWRITE(iisr_r,iisr_w)
|
||||
|
||||
@ -63,9 +63,9 @@ READ16_MEMBER(tmp68301_device::scr_r)
|
||||
WRITE16_MEMBER(tmp68301_device::scr_w)
|
||||
{
|
||||
/*
|
||||
*--- ---- CKSE
|
||||
--*- ---- RES
|
||||
---- ---* INTM
|
||||
*--- ---- CKSE
|
||||
--*- ---- RES
|
||||
---- ---* INTM
|
||||
*/
|
||||
|
||||
COMBINE_DATA(&m_scr);
|
||||
|
@ -29,7 +29,7 @@ struct tmp68301_interface
|
||||
{
|
||||
devcb_read16 m_in_parallel_cb;
|
||||
devcb_write16 m_out_parallel_cb;
|
||||
// TODO: serial ports
|
||||
// TODO: serial ports
|
||||
};
|
||||
|
||||
class tmp68301_device : public device_t,
|
||||
|
@ -2,13 +2,13 @@
|
||||
// copyright-holders: Angelo Salese
|
||||
/***************************************************************************
|
||||
|
||||
uPD4992 parallel RTC
|
||||
uPD4992 parallel RTC
|
||||
|
||||
TODO:
|
||||
- Add timers
|
||||
- Add leap year count
|
||||
- Add 12 hours mode
|
||||
- Add mode/control register
|
||||
TODO:
|
||||
- Add timers
|
||||
- Add leap year count
|
||||
- Add 12 hours mode
|
||||
- Add mode/control register
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -35,7 +35,7 @@ const device_type UPD4992 = &device_creator<upd4992_device>;
|
||||
|
||||
upd4992_device::upd4992_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, UPD4992, "uPD4992", tag, owner, clock, "upd4992", __FILE__),
|
||||
device_rtc_interface(mconfig, *this)
|
||||
device_rtc_interface(mconfig, *this)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// copyright-holders: Angelo Salese
|
||||
/***************************************************************************
|
||||
|
||||
uPD4992 RTC
|
||||
uPD4992 RTC
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
// ======================> upd4992_device
|
||||
|
||||
class upd4992_device : public device_t,
|
||||
public device_rtc_interface
|
||||
public device_rtc_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
|
@ -1227,7 +1227,7 @@ WRITE_LINE_MEMBER( z80dart_channel::rxc_w )
|
||||
m_rx_clock++;
|
||||
if (m_rx_clock == clocks)
|
||||
m_rx_clock = 0;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1249,7 +1249,7 @@ WRITE_LINE_MEMBER( z80dart_channel::txc_w )
|
||||
m_tx_clock++;
|
||||
if (m_tx_clock == clocks)
|
||||
m_tx_clock = 0;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1339,4 +1339,3 @@ WRITE_LINE_MEMBER(z80dart_channel::write_rx)
|
||||
input_callback(m_input_state & ~RX);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ const int TM_SEARCH_TRANSFER = 0x03;
|
||||
#define EOB_F_CLEAR (m_status |= 0x20)
|
||||
|
||||
#define READY_ACTIVE_HIGH ((WR5>>3) & 0x01)
|
||||
#define AUTO_RESTART ((WR5>>5) & 0x01)
|
||||
#define AUTO_RESTART ((WR5>>5) & 0x01)
|
||||
|
||||
#define INTERRUPT_ENABLE (WR3 & 0x20)
|
||||
#define INT_ON_MATCH (INTERRUPT_CTRL & 0x01)
|
||||
|
@ -53,164 +53,164 @@
|
||||
|
||||
NETLIB_START(nic7448)
|
||||
{
|
||||
register_sub(sub, "sub");
|
||||
register_sub(sub, "sub");
|
||||
|
||||
register_subalias("A0", sub.m_A0);
|
||||
register_subalias("A1", sub.m_A1);
|
||||
register_subalias("A2", sub.m_A2);
|
||||
register_subalias("A3", sub.m_A3);
|
||||
register_input("LTQ", m_LTQ);
|
||||
register_input("BIQ", m_BIQ);
|
||||
register_subalias("RBIQ",sub.m_RBIQ);
|
||||
register_subalias("A0", sub.m_A0);
|
||||
register_subalias("A1", sub.m_A1);
|
||||
register_subalias("A2", sub.m_A2);
|
||||
register_subalias("A3", sub.m_A3);
|
||||
register_input("LTQ", m_LTQ);
|
||||
register_input("BIQ", m_BIQ);
|
||||
register_subalias("RBIQ",sub.m_RBIQ);
|
||||
|
||||
register_subalias("a", sub.m_a);
|
||||
register_subalias("b", sub.m_b);
|
||||
register_subalias("c", sub.m_c);
|
||||
register_subalias("d", sub.m_d);
|
||||
register_subalias("e", sub.m_e);
|
||||
register_subalias("f", sub.m_f);
|
||||
register_subalias("g", sub.m_g);
|
||||
register_subalias("a", sub.m_a);
|
||||
register_subalias("b", sub.m_b);
|
||||
register_subalias("c", sub.m_c);
|
||||
register_subalias("d", sub.m_d);
|
||||
register_subalias("e", sub.m_e);
|
||||
register_subalias("f", sub.m_f);
|
||||
register_subalias("g", sub.m_g);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(nic7448)
|
||||
{
|
||||
if (INPLOGIC(m_BIQ) && !INPLOGIC(m_LTQ))
|
||||
{
|
||||
sub.update_outputs(8);
|
||||
}
|
||||
else if (!INPLOGIC(m_BIQ))
|
||||
{
|
||||
sub.update_outputs(15);
|
||||
}
|
||||
if (INPLOGIC(m_BIQ) && !INPLOGIC(m_LTQ))
|
||||
{
|
||||
sub.update_outputs(8);
|
||||
}
|
||||
else if (!INPLOGIC(m_BIQ))
|
||||
{
|
||||
sub.update_outputs(15);
|
||||
}
|
||||
|
||||
if (!INPLOGIC(m_BIQ) || (INPLOGIC(m_BIQ) && !INPLOGIC(m_LTQ)))
|
||||
{
|
||||
sub.m_A0.inactivate();
|
||||
sub.m_A1.inactivate();
|
||||
sub.m_A2.inactivate();
|
||||
sub.m_A3.inactivate();
|
||||
sub.m_RBIQ.inactivate();
|
||||
} else {
|
||||
sub.m_RBIQ.activate();
|
||||
sub.m_A3.activate();
|
||||
sub.m_A2.activate();
|
||||
sub.m_A1.activate();
|
||||
sub.m_A0.activate();
|
||||
sub.update();
|
||||
}
|
||||
if (!INPLOGIC(m_BIQ) || (INPLOGIC(m_BIQ) && !INPLOGIC(m_LTQ)))
|
||||
{
|
||||
sub.m_A0.inactivate();
|
||||
sub.m_A1.inactivate();
|
||||
sub.m_A2.inactivate();
|
||||
sub.m_A3.inactivate();
|
||||
sub.m_RBIQ.inactivate();
|
||||
} else {
|
||||
sub.m_RBIQ.activate();
|
||||
sub.m_A3.activate();
|
||||
sub.m_A2.activate();
|
||||
sub.m_A1.activate();
|
||||
sub.m_A0.activate();
|
||||
sub.update();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NETLIB_START(nic7448_sub)
|
||||
{
|
||||
m_state = 0;
|
||||
m_state = 0;
|
||||
|
||||
register_input("A0", m_A0);
|
||||
register_input("A1", m_A1);
|
||||
register_input("A2", m_A2);
|
||||
register_input("A3", m_A3);
|
||||
register_input("RBIQ", m_RBIQ);
|
||||
register_input("A0", m_A0);
|
||||
register_input("A1", m_A1);
|
||||
register_input("A2", m_A2);
|
||||
register_input("A3", m_A3);
|
||||
register_input("RBIQ", m_RBIQ);
|
||||
|
||||
register_output("a", m_a);
|
||||
register_output("b", m_b);
|
||||
register_output("c", m_c);
|
||||
register_output("d", m_d);
|
||||
register_output("e", m_e);
|
||||
register_output("f", m_f);
|
||||
register_output("g", m_g);
|
||||
register_output("a", m_a);
|
||||
register_output("b", m_b);
|
||||
register_output("c", m_c);
|
||||
register_output("d", m_d);
|
||||
register_output("e", m_e);
|
||||
register_output("f", m_f);
|
||||
register_output("g", m_g);
|
||||
|
||||
save(NAME(m_state));
|
||||
save(NAME(m_state));
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(nic7448_sub)
|
||||
{
|
||||
UINT8 v;
|
||||
UINT8 v;
|
||||
|
||||
v = (INPLOGIC(m_A0) << 0) | (INPLOGIC(m_A1) << 1) | (INPLOGIC(m_A2) << 2) | (INPLOGIC(m_A3) << 3);
|
||||
if ((!INPLOGIC(m_RBIQ) && (v==0)))
|
||||
v = 15;
|
||||
update_outputs(v);
|
||||
v = (INPLOGIC(m_A0) << 0) | (INPLOGIC(m_A1) << 1) | (INPLOGIC(m_A2) << 2) | (INPLOGIC(m_A3) << 3);
|
||||
if ((!INPLOGIC(m_RBIQ) && (v==0)))
|
||||
v = 15;
|
||||
update_outputs(v);
|
||||
}
|
||||
|
||||
NETLIB_FUNC_VOID(nic7448_sub, update_outputs, (UINT8 v))
|
||||
{
|
||||
assert(v<16);
|
||||
if (v != m_state)
|
||||
{
|
||||
OUTLOGIC(m_a, tab7448[v][0], NLTIME_FROM_NS(100));
|
||||
OUTLOGIC(m_b, tab7448[v][1], NLTIME_FROM_NS(100));
|
||||
OUTLOGIC(m_c, tab7448[v][2], NLTIME_FROM_NS(100));
|
||||
OUTLOGIC(m_d, tab7448[v][3], NLTIME_FROM_NS(100));
|
||||
OUTLOGIC(m_e, tab7448[v][4], NLTIME_FROM_NS(100));
|
||||
OUTLOGIC(m_f, tab7448[v][5], NLTIME_FROM_NS(100));
|
||||
OUTLOGIC(m_g, tab7448[v][6], NLTIME_FROM_NS(100));
|
||||
m_state = v;
|
||||
}
|
||||
assert(v<16);
|
||||
if (v != m_state)
|
||||
{
|
||||
OUTLOGIC(m_a, tab7448[v][0], NLTIME_FROM_NS(100));
|
||||
OUTLOGIC(m_b, tab7448[v][1], NLTIME_FROM_NS(100));
|
||||
OUTLOGIC(m_c, tab7448[v][2], NLTIME_FROM_NS(100));
|
||||
OUTLOGIC(m_d, tab7448[v][3], NLTIME_FROM_NS(100));
|
||||
OUTLOGIC(m_e, tab7448[v][4], NLTIME_FROM_NS(100));
|
||||
OUTLOGIC(m_f, tab7448[v][5], NLTIME_FROM_NS(100));
|
||||
OUTLOGIC(m_g, tab7448[v][6], NLTIME_FROM_NS(100));
|
||||
m_state = v;
|
||||
}
|
||||
}
|
||||
|
||||
const UINT8 NETLIB_NAME(nic7448_sub)::tab7448[16][7] =
|
||||
{
|
||||
{ 1, 1, 1, 1, 1, 1, 0 }, /* 00 - not blanked ! */
|
||||
{ 0, 1, 1, 0, 0, 0, 0 }, /* 01 */
|
||||
{ 1, 1, 0, 1, 1, 0, 1 }, /* 02 */
|
||||
{ 1, 1, 1, 1, 0, 0, 1 }, /* 03 */
|
||||
{ 0, 1, 1, 0, 0, 1, 1 }, /* 04 */
|
||||
{ 1, 0, 1, 1, 0, 1, 1 }, /* 05 */
|
||||
{ 0, 0, 1, 1, 1, 1, 1 }, /* 06 */
|
||||
{ 1, 1, 1, 0, 0, 0, 0 }, /* 07 */
|
||||
{ 1, 1, 1, 1, 1, 1, 1 }, /* 08 */
|
||||
{ 1, 1, 1, 0, 0, 1, 1 }, /* 09 */
|
||||
{ 0, 0, 0, 1, 1, 0, 1 }, /* 10 */
|
||||
{ 0, 0, 1, 1, 0, 0, 1 }, /* 11 */
|
||||
{ 0, 1, 0, 0, 0, 1, 1 }, /* 12 */
|
||||
{ 1, 0, 0, 1, 0, 1, 1 }, /* 13 */
|
||||
{ 0, 0, 0, 1, 1, 1, 1 }, /* 14 */
|
||||
{ 0, 0, 0, 0, 0, 0, 0 }, /* 15 */
|
||||
{ 1, 1, 1, 1, 1, 1, 0 }, /* 00 - not blanked ! */
|
||||
{ 0, 1, 1, 0, 0, 0, 0 }, /* 01 */
|
||||
{ 1, 1, 0, 1, 1, 0, 1 }, /* 02 */
|
||||
{ 1, 1, 1, 1, 0, 0, 1 }, /* 03 */
|
||||
{ 0, 1, 1, 0, 0, 1, 1 }, /* 04 */
|
||||
{ 1, 0, 1, 1, 0, 1, 1 }, /* 05 */
|
||||
{ 0, 0, 1, 1, 1, 1, 1 }, /* 06 */
|
||||
{ 1, 1, 1, 0, 0, 0, 0 }, /* 07 */
|
||||
{ 1, 1, 1, 1, 1, 1, 1 }, /* 08 */
|
||||
{ 1, 1, 1, 0, 0, 1, 1 }, /* 09 */
|
||||
{ 0, 0, 0, 1, 1, 0, 1 }, /* 10 */
|
||||
{ 0, 0, 1, 1, 0, 0, 1 }, /* 11 */
|
||||
{ 0, 1, 0, 0, 0, 1, 1 }, /* 12 */
|
||||
{ 1, 0, 0, 1, 0, 1, 1 }, /* 13 */
|
||||
{ 0, 0, 0, 1, 1, 1, 1 }, /* 14 */
|
||||
{ 0, 0, 0, 0, 0, 0, 0 }, /* 15 */
|
||||
};
|
||||
|
||||
NETLIB_START(nic7450)
|
||||
{
|
||||
register_input("I1", m_I0);
|
||||
register_input("I2", m_I1);
|
||||
register_input("I3", m_I2);
|
||||
register_input("I4", m_I3);
|
||||
register_output("Q", m_Q);
|
||||
register_input("I1", m_I0);
|
||||
register_input("I2", m_I1);
|
||||
register_input("I3", m_I2);
|
||||
register_input("I4", m_I3);
|
||||
register_output("Q", m_Q);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(nic7450)
|
||||
{
|
||||
m_I0.activate();
|
||||
m_I1.activate();
|
||||
m_I2.activate();
|
||||
m_I3.activate();
|
||||
UINT8 t1 = INPLOGIC(m_I0) & INPLOGIC(m_I1);
|
||||
UINT8 t2 = INPLOGIC(m_I2) & INPLOGIC(m_I3);
|
||||
m_I0.activate();
|
||||
m_I1.activate();
|
||||
m_I2.activate();
|
||||
m_I3.activate();
|
||||
UINT8 t1 = INPLOGIC(m_I0) & INPLOGIC(m_I1);
|
||||
UINT8 t2 = INPLOGIC(m_I2) & INPLOGIC(m_I3);
|
||||
#if 0
|
||||
UINT8 t = (t1 | t2) ^ 1;
|
||||
OUTLOGIC(m_Q, t, t ? NLTIME_FROM_NS(22) : NLTIME_FROM_NS(15));
|
||||
UINT8 t = (t1 | t2) ^ 1;
|
||||
OUTLOGIC(m_Q, t, t ? NLTIME_FROM_NS(22) : NLTIME_FROM_NS(15));
|
||||
#else
|
||||
const netlist_time times[2] = { NLTIME_FROM_NS(22), NLTIME_FROM_NS(15) };
|
||||
const netlist_time times[2] = { NLTIME_FROM_NS(22), NLTIME_FROM_NS(15) };
|
||||
|
||||
UINT8 res = 0;
|
||||
if (t1 ^ 1)
|
||||
{
|
||||
if (t2 ^ 1)
|
||||
{
|
||||
res = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_I0.inactivate();
|
||||
m_I1.inactivate();
|
||||
}
|
||||
} else {
|
||||
if (t2 ^ 1)
|
||||
{
|
||||
m_I2.inactivate();
|
||||
m_I3.inactivate();
|
||||
}
|
||||
}
|
||||
OUTLOGIC(m_Q, res, times[1 - res]);// ? 22000 : 15000);
|
||||
UINT8 res = 0;
|
||||
if (t1 ^ 1)
|
||||
{
|
||||
if (t2 ^ 1)
|
||||
{
|
||||
res = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_I0.inactivate();
|
||||
m_I1.inactivate();
|
||||
}
|
||||
} else {
|
||||
if (t2 ^ 1)
|
||||
{
|
||||
m_I2.inactivate();
|
||||
m_I3.inactivate();
|
||||
}
|
||||
}
|
||||
OUTLOGIC(m_Q, res, times[1 - res]);// ? 22000 : 15000);
|
||||
|
||||
#endif
|
||||
}
|
||||
@ -221,122 +221,122 @@ NETLIB_UPDATE(nic7450)
|
||||
|
||||
NETLIB_START(nic74107Asub)
|
||||
{
|
||||
register_input("CLK", m_clk, netlist_input_t::STATE_INP_HL);
|
||||
register_output("Q", m_Q);
|
||||
register_output("QQ", m_QQ);
|
||||
register_input("CLK", m_clk, netlist_input_t::STATE_INP_HL);
|
||||
register_output("Q", m_Q);
|
||||
register_output("QQ", m_QQ);
|
||||
|
||||
m_Q.initial(0);
|
||||
m_QQ.initial(1);
|
||||
m_Q.initial(0);
|
||||
m_QQ.initial(1);
|
||||
|
||||
save(NAME(m_Q1));
|
||||
save(NAME(m_Q2));
|
||||
save(NAME(m_F));
|
||||
save(NAME(m_Q1));
|
||||
save(NAME(m_Q2));
|
||||
save(NAME(m_F));
|
||||
}
|
||||
|
||||
NETLIB_START(nic74107A)
|
||||
{
|
||||
register_sub(sub, "sub");
|
||||
register_sub(sub, "sub");
|
||||
|
||||
register_subalias("CLK", sub.m_clk);
|
||||
register_input("J", m_J);
|
||||
register_input("K", m_K);
|
||||
register_input("CLRQ", m_clrQ);
|
||||
register_subalias("Q", sub.m_Q);
|
||||
register_subalias("QQ", sub.m_QQ);
|
||||
register_subalias("CLK", sub.m_clk);
|
||||
register_input("J", m_J);
|
||||
register_input("K", m_K);
|
||||
register_input("CLRQ", m_clrQ);
|
||||
register_subalias("Q", sub.m_Q);
|
||||
register_subalias("QQ", sub.m_QQ);
|
||||
|
||||
sub.m_Q.initial(0);
|
||||
sub.m_QQ.initial(1);
|
||||
sub.m_Q.initial(0);
|
||||
sub.m_QQ.initial(1);
|
||||
}
|
||||
|
||||
ATTR_HOT inline void NETLIB_NAME(nic74107Asub)::newstate(const netlist_sig_t state)
|
||||
{
|
||||
const netlist_time delay[2] = { NLTIME_FROM_NS(40), NLTIME_FROM_NS(25) };
|
||||
const netlist_time delay[2] = { NLTIME_FROM_NS(40), NLTIME_FROM_NS(25) };
|
||||
#if 1
|
||||
OUTLOGIC(m_Q, state, delay[state ^ 1]);
|
||||
OUTLOGIC(m_QQ, state ^ 1, delay[state]);
|
||||
OUTLOGIC(m_Q, state, delay[state ^ 1]);
|
||||
OUTLOGIC(m_QQ, state ^ 1, delay[state]);
|
||||
#else
|
||||
if (state != Q.new_Q())
|
||||
{
|
||||
Q.setToNoCheck(state, delay[1-state]);
|
||||
QQ.setToNoCheck(1-state, delay[state]);
|
||||
}
|
||||
if (state != Q.new_Q())
|
||||
{
|
||||
Q.setToNoCheck(state, delay[1-state]);
|
||||
QQ.setToNoCheck(1-state, delay[state]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(nic74107Asub)
|
||||
{
|
||||
{
|
||||
const netlist_sig_t t = m_Q.net().new_Q();
|
||||
newstate((!t & m_Q1) | (t & m_Q2) | m_F);
|
||||
if (!m_Q1)
|
||||
m_clk.inactivate();
|
||||
}
|
||||
{
|
||||
const netlist_sig_t t = m_Q.net().new_Q();
|
||||
newstate((!t & m_Q1) | (t & m_Q2) | m_F);
|
||||
if (!m_Q1)
|
||||
m_clk.inactivate();
|
||||
}
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(nic74107A)
|
||||
{
|
||||
if (INPLOGIC(m_J) & INPLOGIC(m_K))
|
||||
{
|
||||
sub.m_Q1 = 1;
|
||||
sub.m_Q2 = 0;
|
||||
sub.m_F = 0;
|
||||
}
|
||||
else if (!INPLOGIC(m_J) & INPLOGIC(m_K))
|
||||
{
|
||||
sub.m_Q1 = 0;
|
||||
sub.m_Q2 = 0;
|
||||
sub.m_F = 0;
|
||||
}
|
||||
else if (INPLOGIC(m_J) & !INPLOGIC(m_K))
|
||||
{
|
||||
sub.m_Q1 = 0;
|
||||
sub.m_Q2 = 0;
|
||||
sub.m_F = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
sub.m_Q1 = 0;
|
||||
sub.m_Q2 = 1;
|
||||
sub.m_F = 0;
|
||||
sub.m_clk.inactivate();
|
||||
}
|
||||
if (!INPLOGIC(m_clrQ))
|
||||
{
|
||||
sub.m_clk.inactivate();
|
||||
sub.newstate(0);
|
||||
}
|
||||
else if (!sub.m_Q2)
|
||||
sub.m_clk.activate_hl();
|
||||
//if (!sub.m_Q2 & INPLOGIC(m_clrQ))
|
||||
// sub.m_clk.activate_hl();
|
||||
if (INPLOGIC(m_J) & INPLOGIC(m_K))
|
||||
{
|
||||
sub.m_Q1 = 1;
|
||||
sub.m_Q2 = 0;
|
||||
sub.m_F = 0;
|
||||
}
|
||||
else if (!INPLOGIC(m_J) & INPLOGIC(m_K))
|
||||
{
|
||||
sub.m_Q1 = 0;
|
||||
sub.m_Q2 = 0;
|
||||
sub.m_F = 0;
|
||||
}
|
||||
else if (INPLOGIC(m_J) & !INPLOGIC(m_K))
|
||||
{
|
||||
sub.m_Q1 = 0;
|
||||
sub.m_Q2 = 0;
|
||||
sub.m_F = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
sub.m_Q1 = 0;
|
||||
sub.m_Q2 = 1;
|
||||
sub.m_F = 0;
|
||||
sub.m_clk.inactivate();
|
||||
}
|
||||
if (!INPLOGIC(m_clrQ))
|
||||
{
|
||||
sub.m_clk.inactivate();
|
||||
sub.newstate(0);
|
||||
}
|
||||
else if (!sub.m_Q2)
|
||||
sub.m_clk.activate_hl();
|
||||
//if (!sub.m_Q2 & INPLOGIC(m_clrQ))
|
||||
// sub.m_clk.activate_hl();
|
||||
}
|
||||
|
||||
NETLIB_START(nic74153)
|
||||
{
|
||||
register_input("A1", m_I[0]);
|
||||
register_input("A2", m_I[1]);
|
||||
register_input("A3", m_I[2]);
|
||||
register_input("A4", m_I[3]);
|
||||
register_input("A", m_A);
|
||||
register_input("B", m_B);
|
||||
register_input("GA", m_GA);
|
||||
register_input("A1", m_I[0]);
|
||||
register_input("A2", m_I[1]);
|
||||
register_input("A3", m_I[2]);
|
||||
register_input("A4", m_I[3]);
|
||||
register_input("A", m_A);
|
||||
register_input("B", m_B);
|
||||
register_input("GA", m_GA);
|
||||
|
||||
register_output("AY", m_AY);
|
||||
register_output("AY", m_AY);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(nic74153)
|
||||
{
|
||||
const netlist_time delay[2] = { NLTIME_FROM_NS(23), NLTIME_FROM_NS(18) };
|
||||
if (!INPLOGIC(m_GA))
|
||||
{
|
||||
UINT8 chan = (INPLOGIC(m_A) | (INPLOGIC(m_B)<<1));
|
||||
UINT8 t = INPLOGIC(m_I[chan]);
|
||||
OUTLOGIC(m_AY, t, delay[t] ); /* data to y only, FIXME */
|
||||
}
|
||||
else
|
||||
{
|
||||
OUTLOGIC(m_AY, 0, delay[0]);
|
||||
}
|
||||
const netlist_time delay[2] = { NLTIME_FROM_NS(23), NLTIME_FROM_NS(18) };
|
||||
if (!INPLOGIC(m_GA))
|
||||
{
|
||||
UINT8 chan = (INPLOGIC(m_A) | (INPLOGIC(m_B)<<1));
|
||||
UINT8 t = INPLOGIC(m_I[chan]);
|
||||
OUTLOGIC(m_AY, t, delay[t] ); /* data to y only, FIXME */
|
||||
}
|
||||
else
|
||||
{
|
||||
OUTLOGIC(m_AY, 0, delay[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -346,93 +346,91 @@ NETLIB_UPDATE(nic74153)
|
||||
|
||||
netlist_factory::netlist_factory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
netlist_factory::~netlist_factory()
|
||||
{
|
||||
for (list_t::entry_t *e = m_list.first(); e != NULL; e = m_list.next(e))
|
||||
{
|
||||
net_device_t_base_factory *p = e->object();
|
||||
delete p;
|
||||
}
|
||||
m_list.reset();
|
||||
for (list_t::entry_t *e = m_list.first(); e != NULL; e = m_list.next(e))
|
||||
{
|
||||
net_device_t_base_factory *p = e->object();
|
||||
delete p;
|
||||
}
|
||||
m_list.reset();
|
||||
}
|
||||
|
||||
void netlist_factory::initialize()
|
||||
{
|
||||
ENTRY(R, NETDEV_R)
|
||||
ENTRY(POT, NETDEV_POT)
|
||||
ENTRY(C, NETDEV_C)
|
||||
ENTRY(D, NETDEV_D)
|
||||
ENTRY(VCVS, NETDEV_VCVS)
|
||||
ENTRY(VCCS, NETDEV_VCCS)
|
||||
ENTRY(QPNP_switch, NETDEV_QPNP)
|
||||
ENTRY(QNPN_switch, NETDEV_QNPN)
|
||||
ENTRY(ttl_const, NETDEV_TTL_CONST)
|
||||
ENTRY(analog_const, NETDEV_ANALOG_CONST)
|
||||
ENTRY(logic_input, NETDEV_LOGIC_INPUT)
|
||||
ENTRY(analog_input, NETDEV_ANALOG_INPUT)
|
||||
ENTRY(log, NETDEV_LOG)
|
||||
ENTRY(logD, NETDEV_LOGD)
|
||||
ENTRY(clock, NETDEV_CLOCK)
|
||||
ENTRY(mainclock, NETDEV_MAINCLOCK)
|
||||
ENTRY(solver, NETDEV_SOLVER)
|
||||
ENTRY(nicMultiSwitch, NETDEV_SWITCH2)
|
||||
ENTRY(nicRSFF, NETDEV_RSFF)
|
||||
ENTRY(nicMixer8, NETDEV_MIXER)
|
||||
ENTRY(7400, TTL_7400_NAND)
|
||||
ENTRY(7402, TTL_7402_NOR)
|
||||
ENTRY(nic7404, TTL_7404_INVERT)
|
||||
ENTRY(7410, TTL_7410_NAND)
|
||||
ENTRY(7420, TTL_7420_NAND)
|
||||
ENTRY(7425, TTL_7425_NOR)
|
||||
ENTRY(7427, TTL_7427_NOR)
|
||||
ENTRY(7430, TTL_7430_NAND)
|
||||
ENTRY(nic7450, TTL_7450_ANDORINVERT)
|
||||
ENTRY(7486, TTL_7486_XOR)
|
||||
ENTRY(nic7448, TTL_7448)
|
||||
ENTRY(7474, TTL_7474)
|
||||
ENTRY(7483, TTL_7483)
|
||||
ENTRY(7490, TTL_7490)
|
||||
ENTRY(7493, TTL_7493)
|
||||
ENTRY(nic74107, TTL_74107)
|
||||
ENTRY(nic74107A, TTL_74107A)
|
||||
ENTRY(nic74153, TTL_74153)
|
||||
ENTRY(9316, TTL_9316)
|
||||
ENTRY(NE555, NETDEV_NE555)
|
||||
ENTRY(nicNE555N_MSTABLE, NE555N_MSTABLE)
|
||||
ENTRY(R, NETDEV_R)
|
||||
ENTRY(POT, NETDEV_POT)
|
||||
ENTRY(C, NETDEV_C)
|
||||
ENTRY(D, NETDEV_D)
|
||||
ENTRY(VCVS, NETDEV_VCVS)
|
||||
ENTRY(VCCS, NETDEV_VCCS)
|
||||
ENTRY(QPNP_switch, NETDEV_QPNP)
|
||||
ENTRY(QNPN_switch, NETDEV_QNPN)
|
||||
ENTRY(ttl_const, NETDEV_TTL_CONST)
|
||||
ENTRY(analog_const, NETDEV_ANALOG_CONST)
|
||||
ENTRY(logic_input, NETDEV_LOGIC_INPUT)
|
||||
ENTRY(analog_input, NETDEV_ANALOG_INPUT)
|
||||
ENTRY(log, NETDEV_LOG)
|
||||
ENTRY(logD, NETDEV_LOGD)
|
||||
ENTRY(clock, NETDEV_CLOCK)
|
||||
ENTRY(mainclock, NETDEV_MAINCLOCK)
|
||||
ENTRY(solver, NETDEV_SOLVER)
|
||||
ENTRY(nicMultiSwitch, NETDEV_SWITCH2)
|
||||
ENTRY(nicRSFF, NETDEV_RSFF)
|
||||
ENTRY(nicMixer8, NETDEV_MIXER)
|
||||
ENTRY(7400, TTL_7400_NAND)
|
||||
ENTRY(7402, TTL_7402_NOR)
|
||||
ENTRY(nic7404, TTL_7404_INVERT)
|
||||
ENTRY(7410, TTL_7410_NAND)
|
||||
ENTRY(7420, TTL_7420_NAND)
|
||||
ENTRY(7425, TTL_7425_NOR)
|
||||
ENTRY(7427, TTL_7427_NOR)
|
||||
ENTRY(7430, TTL_7430_NAND)
|
||||
ENTRY(nic7450, TTL_7450_ANDORINVERT)
|
||||
ENTRY(7486, TTL_7486_XOR)
|
||||
ENTRY(nic7448, TTL_7448)
|
||||
ENTRY(7474, TTL_7474)
|
||||
ENTRY(7483, TTL_7483)
|
||||
ENTRY(7490, TTL_7490)
|
||||
ENTRY(7493, TTL_7493)
|
||||
ENTRY(nic74107, TTL_74107)
|
||||
ENTRY(nic74107A, TTL_74107A)
|
||||
ENTRY(nic74153, TTL_74153)
|
||||
ENTRY(9316, TTL_9316)
|
||||
ENTRY(NE555, NETDEV_NE555)
|
||||
ENTRY(nicNE555N_MSTABLE, NE555N_MSTABLE)
|
||||
}
|
||||
|
||||
netlist_device_t *netlist_factory::new_device_by_classname(const pstring &classname, netlist_setup_t &setup) const
|
||||
{
|
||||
for (list_t::entry_t *e = m_list.first(); e != NULL; e = m_list.next(e))
|
||||
{
|
||||
net_device_t_base_factory *p = e->object();
|
||||
if (strcmp(p->classname(), classname) == 0)
|
||||
{
|
||||
netlist_device_t *ret = p->Create();
|
||||
return ret;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
setup.netlist().xfatalerror("Class %s not found!\n", classname.cstr());
|
||||
return NULL; // appease code analysis
|
||||
for (list_t::entry_t *e = m_list.first(); e != NULL; e = m_list.next(e))
|
||||
{
|
||||
net_device_t_base_factory *p = e->object();
|
||||
if (strcmp(p->classname(), classname) == 0)
|
||||
{
|
||||
netlist_device_t *ret = p->Create();
|
||||
return ret;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
setup.netlist().xfatalerror("Class %s not found!\n", classname.cstr());
|
||||
return NULL; // appease code analysis
|
||||
}
|
||||
|
||||
netlist_device_t *netlist_factory::new_device_by_name(const pstring &name, netlist_setup_t &setup) const
|
||||
{
|
||||
for (list_t::entry_t *e = m_list.first(); e != NULL; e = m_list.next(e))
|
||||
{
|
||||
net_device_t_base_factory *p = e->object();
|
||||
if (strcmp(p->name(), name) == 0)
|
||||
{
|
||||
netlist_device_t *ret = p->Create();
|
||||
return ret;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
setup.netlist().xfatalerror("Class %s not found!\n", name.cstr());
|
||||
return NULL; // appease code analysis
|
||||
for (list_t::entry_t *e = m_list.first(); e != NULL; e = m_list.next(e))
|
||||
{
|
||||
net_device_t_base_factory *p = e->object();
|
||||
if (strcmp(p->name(), name) == 0)
|
||||
{
|
||||
netlist_device_t *ret = p->Create();
|
||||
return ret;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
setup.netlist().xfatalerror("Class %s not found!\n", name.cstr());
|
||||
return NULL; // appease code analysis
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ NETLIB_DEVICE(nic7450,
|
||||
*/
|
||||
|
||||
NETLIB_SUBDEVICE(nic74107Asub,
|
||||
netlist_ttl_input_t m_clk;
|
||||
netlist_ttl_input_t m_clk;
|
||||
|
||||
netlist_ttl_output_t m_Q;
|
||||
netlist_ttl_output_t m_QQ;
|
||||
|
@ -43,34 +43,34 @@ NETLIB_SIGNAL(7400, 2, 0, 0);
|
||||
|
||||
NETLIB_DEVICE(7400pin,
|
||||
|
||||
NETLIB_NAME(7400) m_1;
|
||||
NETLIB_NAME(7400) m_2;
|
||||
NETLIB_NAME(7400) m_3;
|
||||
NETLIB_NAME(7400) m_4;
|
||||
NETLIB_NAME(7400) m_1;
|
||||
NETLIB_NAME(7400) m_2;
|
||||
NETLIB_NAME(7400) m_3;
|
||||
NETLIB_NAME(7400) m_4;
|
||||
);
|
||||
|
||||
inline NETLIB_START(7400pin)
|
||||
{
|
||||
register_sub(m_1, "1");
|
||||
register_sub(m_2, "2");
|
||||
register_sub(m_3, "3");
|
||||
register_sub(m_4, "4");
|
||||
register_sub(m_1, "1");
|
||||
register_sub(m_2, "2");
|
||||
register_sub(m_3, "3");
|
||||
register_sub(m_4, "4");
|
||||
|
||||
register_subalias("1", m_1.m_i[0]);
|
||||
register_subalias("2", m_1.m_i[1]);
|
||||
register_subalias("3", m_1.m_Q);
|
||||
register_subalias("1", m_1.m_i[0]);
|
||||
register_subalias("2", m_1.m_i[1]);
|
||||
register_subalias("3", m_1.m_Q);
|
||||
|
||||
register_subalias("4", m_2.m_i[0]);
|
||||
register_subalias("5", m_2.m_i[1]);
|
||||
register_subalias("6", m_2.m_Q);
|
||||
register_subalias("4", m_2.m_i[0]);
|
||||
register_subalias("5", m_2.m_i[1]);
|
||||
register_subalias("6", m_2.m_Q);
|
||||
|
||||
register_subalias("9", m_3.m_i[0]);
|
||||
register_subalias("10", m_3.m_i[1]);
|
||||
register_subalias("8", m_3.m_Q);
|
||||
register_subalias("9", m_3.m_i[0]);
|
||||
register_subalias("10", m_3.m_i[1]);
|
||||
register_subalias("8", m_3.m_Q);
|
||||
|
||||
register_subalias("12", m_4.m_i[0]);
|
||||
register_subalias("13", m_4.m_i[1]);
|
||||
register_subalias("11", m_4.m_Q);
|
||||
register_subalias("12", m_4.m_i[0]);
|
||||
register_subalias("13", m_4.m_i[1]);
|
||||
register_subalias("11", m_4.m_Q);
|
||||
}
|
||||
|
||||
#endif /* NLD_7400_H_ */
|
||||
|
@ -35,9 +35,9 @@
|
||||
#include "nld_signal.h"
|
||||
|
||||
#define TTL_7402_NOR(_name, _I1, _I2) \
|
||||
NET_REGISTER_DEV(7402, _name) \
|
||||
NET_CONNECT(_name, A, _I1) \
|
||||
NET_CONNECT(_name, B, _I2)
|
||||
NET_REGISTER_DEV(7402, _name) \
|
||||
NET_CONNECT(_name, A, _I1) \
|
||||
NET_CONNECT(_name, B, _I2)
|
||||
|
||||
NETLIB_SIGNAL(7402, 2, 1, 0);
|
||||
|
||||
|
@ -7,14 +7,14 @@
|
||||
|
||||
NETLIB_START(nic7404)
|
||||
{
|
||||
register_input("A", m_I);
|
||||
register_output("Q", m_Q);
|
||||
m_Q.initial(1);
|
||||
register_input("A", m_I);
|
||||
register_output("Q", m_Q);
|
||||
m_Q.initial(1);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(nic7404)
|
||||
{
|
||||
static const netlist_time delay[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22) };
|
||||
UINT8 t = (INPLOGIC(m_I)) ^ 1;
|
||||
OUTLOGIC(m_Q, t, delay[t]);
|
||||
static const netlist_time delay[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22) };
|
||||
UINT8 t = (INPLOGIC(m_I)) ^ 1;
|
||||
OUTLOGIC(m_Q, t, delay[t]);
|
||||
}
|
||||
|
@ -33,12 +33,12 @@
|
||||
#include "nld_signal.h"
|
||||
|
||||
NETLIB_DEVICE(nic7404,
|
||||
netlist_ttl_input_t m_I;
|
||||
netlist_ttl_output_t m_Q;
|
||||
netlist_ttl_input_t m_I;
|
||||
netlist_ttl_output_t m_Q;
|
||||
);
|
||||
|
||||
#define TTL_7404_INVERT(_name, _A) \
|
||||
NET_REGISTER_DEV(nic7404, _name) \
|
||||
NET_CONNECT(_name, A, _A)
|
||||
NET_REGISTER_DEV(nic7404, _name) \
|
||||
NET_CONNECT(_name, A, _A)
|
||||
|
||||
#endif /* NLD_7404_H_ */
|
||||
|
@ -35,10 +35,10 @@
|
||||
#include "nld_signal.h"
|
||||
|
||||
#define TTL_7410_NAND(_name, _I1, _I2, _I3) \
|
||||
NET_REGISTER_DEV(7410, _name) \
|
||||
NET_CONNECT(_name, A, _I1) \
|
||||
NET_CONNECT(_name, B, _I2) \
|
||||
NET_CONNECT(_name, C, _I3)
|
||||
NET_REGISTER_DEV(7410, _name) \
|
||||
NET_CONNECT(_name, A, _I1) \
|
||||
NET_CONNECT(_name, B, _I2) \
|
||||
NET_CONNECT(_name, C, _I3)
|
||||
|
||||
NETLIB_SIGNAL(7410, 3, 0, 0);
|
||||
|
||||
|
@ -36,11 +36,11 @@
|
||||
#include "nld_signal.h"
|
||||
|
||||
#define TTL_7420_NAND(_name, _I1, _I2, _I3, _I4) \
|
||||
NET_REGISTER_DEV(7420, _name) \
|
||||
NET_CONNECT(_name, A, _I1) \
|
||||
NET_CONNECT(_name, B, _I2) \
|
||||
NET_CONNECT(_name, C, _I3) \
|
||||
NET_CONNECT(_name, D, _I4)
|
||||
NET_REGISTER_DEV(7420, _name) \
|
||||
NET_CONNECT(_name, A, _I1) \
|
||||
NET_CONNECT(_name, B, _I2) \
|
||||
NET_CONNECT(_name, C, _I3) \
|
||||
NET_CONNECT(_name, D, _I4)
|
||||
|
||||
|
||||
NETLIB_SIGNAL(7420, 4, 0, 0);
|
||||
|
@ -39,11 +39,11 @@
|
||||
#include "nld_signal.h"
|
||||
|
||||
#define TTL_7425_NOR(_name, _I1, _I2, _I3, _I4) \
|
||||
NET_REGISTER_DEV(7425, _name) \
|
||||
NET_CONNECT(_name, A, _I1) \
|
||||
NET_CONNECT(_name, B, _I2) \
|
||||
NET_CONNECT(_name, C, _I3) \
|
||||
NET_CONNECT(_name, D, _I4)
|
||||
NET_REGISTER_DEV(7425, _name) \
|
||||
NET_CONNECT(_name, A, _I1) \
|
||||
NET_CONNECT(_name, B, _I2) \
|
||||
NET_CONNECT(_name, C, _I3) \
|
||||
NET_CONNECT(_name, D, _I4)
|
||||
|
||||
|
||||
NETLIB_SIGNAL(7425, 4, 1, 0);
|
||||
|
@ -35,10 +35,10 @@
|
||||
#include "nld_signal.h"
|
||||
|
||||
#define TTL_7427_NOR(_name, _I1, _I2, _I3) \
|
||||
NET_REGISTER_DEV(7427, _name) \
|
||||
NET_CONNECT(_name, A, _I1) \
|
||||
NET_CONNECT(_name, B, _I2) \
|
||||
NET_CONNECT(_name, C, _I3)
|
||||
NET_REGISTER_DEV(7427, _name) \
|
||||
NET_CONNECT(_name, A, _I1) \
|
||||
NET_CONNECT(_name, B, _I2) \
|
||||
NET_CONNECT(_name, C, _I3)
|
||||
|
||||
NETLIB_SIGNAL(7427, 3, 1, 0);
|
||||
|
||||
|
@ -40,15 +40,15 @@
|
||||
#include "nld_signal.h"
|
||||
|
||||
#define TTL_7430_NAND(_name, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8) \
|
||||
NET_REGISTER_DEV(7430, _name) \
|
||||
NET_CONNECT(_name, A, _I1) \
|
||||
NET_CONNECT(_name, B, _I2) \
|
||||
NET_CONNECT(_name, C, _I3) \
|
||||
NET_CONNECT(_name, D, _I4) \
|
||||
NET_CONNECT(_name, E, _I5) \
|
||||
NET_CONNECT(_name, F, _I6) \
|
||||
NET_CONNECT(_name, G, _I7) \
|
||||
NET_CONNECT(_name, H, _I8)
|
||||
NET_REGISTER_DEV(7430, _name) \
|
||||
NET_CONNECT(_name, A, _I1) \
|
||||
NET_CONNECT(_name, B, _I2) \
|
||||
NET_CONNECT(_name, C, _I3) \
|
||||
NET_CONNECT(_name, D, _I4) \
|
||||
NET_CONNECT(_name, E, _I5) \
|
||||
NET_CONNECT(_name, F, _I6) \
|
||||
NET_CONNECT(_name, G, _I7) \
|
||||
NET_CONNECT(_name, H, _I8)
|
||||
|
||||
|
||||
NETLIB_SIGNAL(7430, 8, 0, 0);
|
||||
|
@ -7,63 +7,63 @@
|
||||
|
||||
ATTR_HOT inline void NETLIB_NAME(7474sub)::newstate(const UINT8 state)
|
||||
{
|
||||
static const netlist_time delay[2] = { NLTIME_FROM_NS(25), NLTIME_FROM_NS(40) };
|
||||
OUTLOGIC(m_Q, state, delay[state]);
|
||||
OUTLOGIC(m_QQ, !state, delay[!state]);
|
||||
static const netlist_time delay[2] = { NLTIME_FROM_NS(25), NLTIME_FROM_NS(40) };
|
||||
OUTLOGIC(m_Q, state, delay[state]);
|
||||
OUTLOGIC(m_QQ, !state, delay[!state]);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(7474sub)
|
||||
{
|
||||
//if (!INP_LAST(m_clk) & INP(m_clk))
|
||||
{
|
||||
newstate(m_nextD);
|
||||
m_clk.inactivate();
|
||||
}
|
||||
//if (!INP_LAST(m_clk) & INP(m_clk))
|
||||
{
|
||||
newstate(m_nextD);
|
||||
m_clk.inactivate();
|
||||
}
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(7474)
|
||||
{
|
||||
if (!INPLOGIC(m_preQ))
|
||||
{
|
||||
sub.newstate(1);
|
||||
sub.m_clk.inactivate();
|
||||
m_D.inactivate();
|
||||
}
|
||||
else if (!INPLOGIC(m_clrQ))
|
||||
{
|
||||
sub.newstate(0);
|
||||
sub.m_clk.inactivate();
|
||||
m_D.inactivate();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_D.activate();
|
||||
sub.m_nextD = INPLOGIC(m_D);
|
||||
sub.m_clk.activate_lh();
|
||||
}
|
||||
if (!INPLOGIC(m_preQ))
|
||||
{
|
||||
sub.newstate(1);
|
||||
sub.m_clk.inactivate();
|
||||
m_D.inactivate();
|
||||
}
|
||||
else if (!INPLOGIC(m_clrQ))
|
||||
{
|
||||
sub.newstate(0);
|
||||
sub.m_clk.inactivate();
|
||||
m_D.inactivate();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_D.activate();
|
||||
sub.m_nextD = INPLOGIC(m_D);
|
||||
sub.m_clk.activate_lh();
|
||||
}
|
||||
}
|
||||
|
||||
NETLIB_START(7474)
|
||||
{
|
||||
register_sub(sub, "sub");
|
||||
register_sub(sub, "sub");
|
||||
|
||||
register_subalias("CLK", sub.m_clk);
|
||||
register_input("D", m_D);
|
||||
register_input("CLRQ", m_clrQ);
|
||||
register_input("PREQ", m_preQ);
|
||||
register_subalias("CLK", sub.m_clk);
|
||||
register_input("D", m_D);
|
||||
register_input("CLRQ", m_clrQ);
|
||||
register_input("PREQ", m_preQ);
|
||||
|
||||
register_subalias("Q", sub.m_Q);
|
||||
register_subalias("QQ", sub.m_QQ);
|
||||
register_subalias("Q", sub.m_Q);
|
||||
register_subalias("QQ", sub.m_QQ);
|
||||
|
||||
}
|
||||
|
||||
NETLIB_START(7474sub)
|
||||
{
|
||||
register_input("CLK", m_clk, netlist_input_t::STATE_INP_LH);
|
||||
register_input("CLK", m_clk, netlist_input_t::STATE_INP_LH);
|
||||
|
||||
register_output("Q", m_Q);
|
||||
register_output("QQ", m_QQ);
|
||||
register_output("Q", m_Q);
|
||||
register_output("QQ", m_QQ);
|
||||
|
||||
m_Q.initial(1);
|
||||
m_QQ.initial(0);
|
||||
m_Q.initial(1);
|
||||
m_QQ.initial(0);
|
||||
}
|
||||
|
@ -45,28 +45,28 @@
|
||||
#include "nld_signal.h"
|
||||
|
||||
#define TTL_7474(_name, _CLK, _D, _CLRQ, _PREQ) \
|
||||
NET_REGISTER_DEV(7474, _name) \
|
||||
NET_CONNECT(_name, CLK, _CLK) \
|
||||
NET_CONNECT(_name, D, _D) \
|
||||
NET_CONNECT(_name, CLRQ, _CLRQ) \
|
||||
NET_CONNECT(_name, PREQ, _PREQ)
|
||||
NET_REGISTER_DEV(7474, _name) \
|
||||
NET_CONNECT(_name, CLK, _CLK) \
|
||||
NET_CONNECT(_name, D, _D) \
|
||||
NET_CONNECT(_name, CLRQ, _CLRQ) \
|
||||
NET_CONNECT(_name, PREQ, _PREQ)
|
||||
|
||||
NETLIB_SUBDEVICE(7474sub,
|
||||
netlist_ttl_input_t m_clk;
|
||||
netlist_ttl_input_t m_clk;
|
||||
|
||||
UINT8 m_nextD;
|
||||
netlist_ttl_output_t m_Q;
|
||||
netlist_ttl_output_t m_QQ;
|
||||
UINT8 m_nextD;
|
||||
netlist_ttl_output_t m_Q;
|
||||
netlist_ttl_output_t m_QQ;
|
||||
|
||||
ATTR_HOT inline void newstate(const UINT8 state);
|
||||
ATTR_HOT inline void newstate(const UINT8 state);
|
||||
);
|
||||
|
||||
NETLIB_DEVICE(7474,
|
||||
NETLIB_NAME(7474sub) sub;
|
||||
NETLIB_NAME(7474sub) sub;
|
||||
|
||||
netlist_ttl_input_t m_D;
|
||||
netlist_ttl_input_t m_clrQ;
|
||||
netlist_ttl_input_t m_preQ;
|
||||
netlist_ttl_input_t m_D;
|
||||
netlist_ttl_input_t m_clrQ;
|
||||
netlist_ttl_input_t m_preQ;
|
||||
);
|
||||
|
||||
|
||||
|
@ -7,42 +7,41 @@
|
||||
|
||||
NETLIB_START(7483)
|
||||
{
|
||||
m_lastr = 0;
|
||||
m_lastr = 0;
|
||||
|
||||
register_input("A1", m_A1);
|
||||
register_input("A2", m_A2);
|
||||
register_input("A3", m_A3);
|
||||
register_input("A4", m_A4);
|
||||
register_input("B1", m_B1);
|
||||
register_input("B2", m_B2);
|
||||
register_input("B3", m_B3);
|
||||
register_input("B4", m_B4);
|
||||
register_input("C0", m_C0);
|
||||
register_input("A1", m_A1);
|
||||
register_input("A2", m_A2);
|
||||
register_input("A3", m_A3);
|
||||
register_input("A4", m_A4);
|
||||
register_input("B1", m_B1);
|
||||
register_input("B2", m_B2);
|
||||
register_input("B3", m_B3);
|
||||
register_input("B4", m_B4);
|
||||
register_input("C0", m_C0);
|
||||
|
||||
register_output("SA", m_SA);
|
||||
register_output("SB", m_SB);
|
||||
register_output("SC", m_SC);
|
||||
register_output("SD", m_SD);
|
||||
register_output("C4", m_C4);
|
||||
register_output("SA", m_SA);
|
||||
register_output("SB", m_SB);
|
||||
register_output("SC", m_SC);
|
||||
register_output("SD", m_SD);
|
||||
register_output("C4", m_C4);
|
||||
|
||||
save(NAME(m_lastr));
|
||||
save(NAME(m_lastr));
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(7483)
|
||||
{
|
||||
UINT8 a = (INPLOGIC(m_A1) << 0) | (INPLOGIC(m_A2) << 1) | (INPLOGIC(m_A3) << 2) | (INPLOGIC(m_A4) << 3);
|
||||
UINT8 b = (INPLOGIC(m_B1) << 0) | (INPLOGIC(m_B2) << 1) | (INPLOGIC(m_B3) << 2) | (INPLOGIC(m_B4) << 3);
|
||||
UINT8 a = (INPLOGIC(m_A1) << 0) | (INPLOGIC(m_A2) << 1) | (INPLOGIC(m_A3) << 2) | (INPLOGIC(m_A4) << 3);
|
||||
UINT8 b = (INPLOGIC(m_B1) << 0) | (INPLOGIC(m_B2) << 1) | (INPLOGIC(m_B3) << 2) | (INPLOGIC(m_B4) << 3);
|
||||
|
||||
UINT8 r = a + b + INPLOGIC(m_C0);
|
||||
UINT8 r = a + b + INPLOGIC(m_C0);
|
||||
|
||||
if (r != m_lastr)
|
||||
{
|
||||
m_lastr = r;
|
||||
OUTLOGIC(m_SA, (r >> 0) & 1, NLTIME_FROM_NS(23));
|
||||
OUTLOGIC(m_SB, (r >> 1) & 1, NLTIME_FROM_NS(23));
|
||||
OUTLOGIC(m_SC, (r >> 2) & 1, NLTIME_FROM_NS(23));
|
||||
OUTLOGIC(m_SD, (r >> 3) & 1, NLTIME_FROM_NS(23));
|
||||
OUTLOGIC(m_C4, (r >> 4) & 1, NLTIME_FROM_NS(23));
|
||||
}
|
||||
if (r != m_lastr)
|
||||
{
|
||||
m_lastr = r;
|
||||
OUTLOGIC(m_SA, (r >> 0) & 1, NLTIME_FROM_NS(23));
|
||||
OUTLOGIC(m_SB, (r >> 1) & 1, NLTIME_FROM_NS(23));
|
||||
OUTLOGIC(m_SC, (r >> 2) & 1, NLTIME_FROM_NS(23));
|
||||
OUTLOGIC(m_SD, (r >> 3) & 1, NLTIME_FROM_NS(23));
|
||||
OUTLOGIC(m_C4, (r >> 4) & 1, NLTIME_FROM_NS(23));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,16 +7,16 @@
|
||||
*
|
||||
* +--------------+
|
||||
* A4 |1 ++ 16| B4
|
||||
* Ʃ3 |2 15| Ʃ3
|
||||
* ??3 |2 15| ??3
|
||||
* A3 |3 14| C4
|
||||
* B3 |4 7483 13| C0
|
||||
* VCC |5 12| GND
|
||||
* Ʃ3 |6 11| B1
|
||||
* ??3 |6 11| B1
|
||||
* B2 |7 10| A1
|
||||
* A2 |8 9| Ʃ3
|
||||
* A2 |8 9| ??3
|
||||
* +--------------+
|
||||
*
|
||||
* Ʃ = (A + B + C) & 0x0f
|
||||
* ?? = (A + B + C) & 0x0f
|
||||
*
|
||||
* C4 = (A + B + C) > 15 ? 1 : 0
|
||||
*
|
||||
@ -30,35 +30,35 @@
|
||||
#include "../nl_base.h"
|
||||
|
||||
#define TTL_7483(_name, _A1, _A2, _A3, _A4, _B1, _B2, _B3, _B4, _CI) \
|
||||
NET_REGISTER_DEV(7483, _name) \
|
||||
NET_CONNECT(_name, A1, _A1) \
|
||||
NET_CONNECT(_name, A2, _A2) \
|
||||
NET_CONNECT(_name, A3, _A3) \
|
||||
NET_CONNECT(_name, A4, _A4) \
|
||||
NET_CONNECT(_name, B1, _B1) \
|
||||
NET_CONNECT(_name, B2, _B2) \
|
||||
NET_CONNECT(_name, B3, _B3) \
|
||||
NET_CONNECT(_name, B4, _B4) \
|
||||
NET_CONNECT(_name, C0, _CI)
|
||||
NET_REGISTER_DEV(7483, _name) \
|
||||
NET_CONNECT(_name, A1, _A1) \
|
||||
NET_CONNECT(_name, A2, _A2) \
|
||||
NET_CONNECT(_name, A3, _A3) \
|
||||
NET_CONNECT(_name, A4, _A4) \
|
||||
NET_CONNECT(_name, B1, _B1) \
|
||||
NET_CONNECT(_name, B2, _B2) \
|
||||
NET_CONNECT(_name, B3, _B3) \
|
||||
NET_CONNECT(_name, B4, _B4) \
|
||||
NET_CONNECT(_name, C0, _CI)
|
||||
|
||||
NETLIB_DEVICE(7483,
|
||||
netlist_ttl_input_t m_C0;
|
||||
netlist_ttl_input_t m_A1;
|
||||
netlist_ttl_input_t m_A2;
|
||||
netlist_ttl_input_t m_A3;
|
||||
netlist_ttl_input_t m_A4;
|
||||
netlist_ttl_input_t m_B1;
|
||||
netlist_ttl_input_t m_B2;
|
||||
netlist_ttl_input_t m_B3;
|
||||
netlist_ttl_input_t m_B4;
|
||||
netlist_ttl_input_t m_C0;
|
||||
netlist_ttl_input_t m_A1;
|
||||
netlist_ttl_input_t m_A2;
|
||||
netlist_ttl_input_t m_A3;
|
||||
netlist_ttl_input_t m_A4;
|
||||
netlist_ttl_input_t m_B1;
|
||||
netlist_ttl_input_t m_B2;
|
||||
netlist_ttl_input_t m_B3;
|
||||
netlist_ttl_input_t m_B4;
|
||||
|
||||
UINT8 m_lastr;
|
||||
UINT8 m_lastr;
|
||||
|
||||
netlist_ttl_output_t m_SA;
|
||||
netlist_ttl_output_t m_SB;
|
||||
netlist_ttl_output_t m_SC;
|
||||
netlist_ttl_output_t m_SD;
|
||||
netlist_ttl_output_t m_C4;
|
||||
netlist_ttl_output_t m_SA;
|
||||
netlist_ttl_output_t m_SB;
|
||||
netlist_ttl_output_t m_SC;
|
||||
netlist_ttl_output_t m_SD;
|
||||
netlist_ttl_output_t m_C4;
|
||||
|
||||
);
|
||||
|
||||
|
@ -7,15 +7,14 @@
|
||||
|
||||
NETLIB_START(7486)
|
||||
{
|
||||
register_input("A", m_A);
|
||||
register_input("B", m_B);
|
||||
register_output("Q", m_Q);
|
||||
register_input("A", m_A);
|
||||
register_input("B", m_B);
|
||||
register_output("Q", m_Q);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(7486)
|
||||
{
|
||||
static const netlist_time delay[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22) };
|
||||
UINT8 t = INPLOGIC(m_A) ^ INPLOGIC(m_B);
|
||||
OUTLOGIC(m_Q, t, delay[t]);
|
||||
static const netlist_time delay[2] = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22) };
|
||||
UINT8 t = INPLOGIC(m_A) ^ INPLOGIC(m_B);
|
||||
OUTLOGIC(m_Q, t, delay[t]);
|
||||
}
|
||||
|
||||
|
@ -35,13 +35,13 @@
|
||||
#include "nld_signal.h"
|
||||
|
||||
#define TTL_7486_XOR(_name, _A, _B) \
|
||||
NET_REGISTER_DEV(7486, _name) \
|
||||
NET_CONNECT(_name, A, _A) \
|
||||
NET_CONNECT(_name, B, _B)
|
||||
NET_REGISTER_DEV(7486, _name) \
|
||||
NET_CONNECT(_name, A, _A) \
|
||||
NET_CONNECT(_name, B, _B)
|
||||
|
||||
NETLIB_DEVICE(7486,
|
||||
netlist_ttl_input_t m_A;
|
||||
netlist_ttl_input_t m_B;
|
||||
netlist_ttl_output_t m_Q;
|
||||
netlist_ttl_input_t m_A;
|
||||
netlist_ttl_input_t m_B;
|
||||
netlist_ttl_output_t m_Q;
|
||||
);
|
||||
#endif /* NLD_7486_H_ */
|
||||
|
@ -7,47 +7,47 @@
|
||||
|
||||
NETLIB_START(7490)
|
||||
{
|
||||
m_cnt = 0;
|
||||
m_cnt = 0;
|
||||
|
||||
register_input("CLK", m_clk);
|
||||
register_input("R1", m_R1);
|
||||
register_input("R2", m_R2);
|
||||
register_input("R91", m_R91);
|
||||
register_input("R92", m_R92);
|
||||
register_input("CLK", m_clk);
|
||||
register_input("R1", m_R1);
|
||||
register_input("R2", m_R2);
|
||||
register_input("R91", m_R91);
|
||||
register_input("R92", m_R92);
|
||||
|
||||
register_output("QA", m_Q[0]);
|
||||
register_output("QB", m_Q[1]);
|
||||
register_output("QC", m_Q[2]);
|
||||
register_output("QD", m_Q[3]);
|
||||
register_output("QA", m_Q[0]);
|
||||
register_output("QB", m_Q[1]);
|
||||
register_output("QC", m_Q[2]);
|
||||
register_output("QD", m_Q[3]);
|
||||
|
||||
save(NAME(m_cnt));
|
||||
save(NAME(m_cnt));
|
||||
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(7490)
|
||||
{
|
||||
if (INPLOGIC(m_R91) & INPLOGIC(m_R92))
|
||||
{
|
||||
m_cnt = 9;
|
||||
update_outputs();
|
||||
}
|
||||
else if (INPLOGIC(m_R1) & INPLOGIC(m_R2))
|
||||
{
|
||||
m_cnt = 0;
|
||||
update_outputs();
|
||||
}
|
||||
else if (INP_HL(m_clk))
|
||||
{
|
||||
m_cnt++;
|
||||
if (m_cnt >= 10)
|
||||
m_cnt = 0;
|
||||
update_outputs();
|
||||
}
|
||||
if (INPLOGIC(m_R91) & INPLOGIC(m_R92))
|
||||
{
|
||||
m_cnt = 9;
|
||||
update_outputs();
|
||||
}
|
||||
else if (INPLOGIC(m_R1) & INPLOGIC(m_R2))
|
||||
{
|
||||
m_cnt = 0;
|
||||
update_outputs();
|
||||
}
|
||||
else if (INP_HL(m_clk))
|
||||
{
|
||||
m_cnt++;
|
||||
if (m_cnt >= 10)
|
||||
m_cnt = 0;
|
||||
update_outputs();
|
||||
}
|
||||
}
|
||||
|
||||
NETLIB_FUNC_VOID(7490, update_outputs, (void))
|
||||
{
|
||||
const netlist_time delay[4] = { NLTIME_FROM_NS(18), NLTIME_FROM_NS(36), NLTIME_FROM_NS(54), NLTIME_FROM_NS(72) };
|
||||
for (int i=0; i<4; i++)
|
||||
OUTLOGIC(m_Q[i], (m_cnt >> i) & 1, delay[i]);
|
||||
const netlist_time delay[4] = { NLTIME_FROM_NS(18), NLTIME_FROM_NS(36), NLTIME_FROM_NS(54), NLTIME_FROM_NS(72) };
|
||||
for (int i=0; i<4; i++)
|
||||
OUTLOGIC(m_Q[i], (m_cnt >> i) & 1, delay[i]);
|
||||
}
|
||||
|
@ -58,26 +58,26 @@
|
||||
#include "../nl_base.h"
|
||||
|
||||
#define TTL_7490(_name, _CLK, _R1, _R2, _R91, _R92) \
|
||||
NET_REGISTER_DEV(7490, _name) \
|
||||
NET_CONNECT(_name, CLK, _CLK) \
|
||||
NET_CONNECT(_name, R1, _R1) \
|
||||
NET_CONNECT(_name, R2, _R2) \
|
||||
NET_CONNECT(_name, R91, _R91) \
|
||||
NET_CONNECT(_name, R92, _R92)
|
||||
NET_REGISTER_DEV(7490, _name) \
|
||||
NET_CONNECT(_name, CLK, _CLK) \
|
||||
NET_CONNECT(_name, R1, _R1) \
|
||||
NET_CONNECT(_name, R2, _R2) \
|
||||
NET_CONNECT(_name, R91, _R91) \
|
||||
NET_CONNECT(_name, R92, _R92)
|
||||
|
||||
|
||||
NETLIB_DEVICE(7490,
|
||||
ATTR_HOT void update_outputs();
|
||||
ATTR_HOT void update_outputs();
|
||||
|
||||
netlist_ttl_input_t m_R1;
|
||||
netlist_ttl_input_t m_R2;
|
||||
netlist_ttl_input_t m_R91;
|
||||
netlist_ttl_input_t m_R92;
|
||||
netlist_ttl_input_t m_clk;
|
||||
netlist_ttl_input_t m_R1;
|
||||
netlist_ttl_input_t m_R2;
|
||||
netlist_ttl_input_t m_R91;
|
||||
netlist_ttl_input_t m_R92;
|
||||
netlist_ttl_input_t m_clk;
|
||||
|
||||
UINT8 m_cnt;
|
||||
UINT8 m_cnt;
|
||||
|
||||
netlist_ttl_output_t m_Q[4];
|
||||
netlist_ttl_output_t m_Q[4];
|
||||
);
|
||||
|
||||
#endif /* NLD_7490_H_ */
|
||||
|
@ -7,59 +7,59 @@
|
||||
|
||||
NETLIB_START(7493)
|
||||
{
|
||||
register_sub(A, "A");
|
||||
register_sub(B, "B");
|
||||
register_sub(C, "C");
|
||||
register_sub(D, "D");
|
||||
register_sub(A, "A");
|
||||
register_sub(B, "B");
|
||||
register_sub(C, "C");
|
||||
register_sub(D, "D");
|
||||
|
||||
register_subalias("CLKA", A.m_I);
|
||||
register_subalias("CLKB", B.m_I);
|
||||
register_input("R1", m_R1);
|
||||
register_input("R2", m_R2);
|
||||
register_subalias("CLKA", A.m_I);
|
||||
register_subalias("CLKB", B.m_I);
|
||||
register_input("R1", m_R1);
|
||||
register_input("R2", m_R2);
|
||||
|
||||
register_subalias("QA", A.m_Q);
|
||||
register_subalias("QB", B.m_Q);
|
||||
register_subalias("QC", C.m_Q);
|
||||
register_subalias("QD", D.m_Q);
|
||||
register_subalias("QA", A.m_Q);
|
||||
register_subalias("QB", B.m_Q);
|
||||
register_subalias("QC", C.m_Q);
|
||||
register_subalias("QD", D.m_Q);
|
||||
|
||||
register_link_internal(C, C.m_I, B.m_Q, netlist_input_t::STATE_INP_HL);
|
||||
register_link_internal(D, D.m_I, C.m_Q, netlist_input_t::STATE_INP_HL);
|
||||
register_link_internal(C, C.m_I, B.m_Q, netlist_input_t::STATE_INP_HL);
|
||||
register_link_internal(D, D.m_I, C.m_Q, netlist_input_t::STATE_INP_HL);
|
||||
}
|
||||
|
||||
NETLIB_START(7493ff)
|
||||
{
|
||||
m_reset = 0;
|
||||
m_reset = 0;
|
||||
|
||||
register_input("CLK", m_I, netlist_input_t::STATE_INP_HL);
|
||||
register_output("Q", m_Q);
|
||||
register_input("CLK", m_I, netlist_input_t::STATE_INP_HL);
|
||||
register_output("Q", m_Q);
|
||||
|
||||
save(NAME(m_reset));
|
||||
save(NAME(m_reset));
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(7493ff)
|
||||
{
|
||||
if (m_reset == 0)
|
||||
OUTLOGIC(m_Q, !m_Q.net().new_Q(), NLTIME_FROM_NS(18));
|
||||
if (m_reset == 0)
|
||||
OUTLOGIC(m_Q, !m_Q.net().new_Q(), NLTIME_FROM_NS(18));
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(7493)
|
||||
{
|
||||
netlist_sig_t r = INPLOGIC(m_R1) & INPLOGIC(m_R2);
|
||||
netlist_sig_t r = INPLOGIC(m_R1) & INPLOGIC(m_R2);
|
||||
|
||||
if (r)
|
||||
{
|
||||
A.m_reset = B.m_reset = C.m_reset = D.m_reset = 1;
|
||||
A.m_I.inactivate();
|
||||
B.m_I.inactivate();
|
||||
OUTLOGIC(A.m_Q, 0, NLTIME_FROM_NS(40));
|
||||
OUTLOGIC(B.m_Q, 0, NLTIME_FROM_NS(40));
|
||||
OUTLOGIC(C.m_Q, 0, NLTIME_FROM_NS(40));
|
||||
OUTLOGIC(D.m_Q, 0, NLTIME_FROM_NS(40));
|
||||
}
|
||||
else
|
||||
{
|
||||
A.m_reset = B.m_reset = C.m_reset = D.m_reset = 0;
|
||||
A.m_I.activate_hl();
|
||||
B.m_I.activate_hl();
|
||||
}
|
||||
if (r)
|
||||
{
|
||||
A.m_reset = B.m_reset = C.m_reset = D.m_reset = 1;
|
||||
A.m_I.inactivate();
|
||||
B.m_I.inactivate();
|
||||
OUTLOGIC(A.m_Q, 0, NLTIME_FROM_NS(40));
|
||||
OUTLOGIC(B.m_Q, 0, NLTIME_FROM_NS(40));
|
||||
OUTLOGIC(C.m_Q, 0, NLTIME_FROM_NS(40));
|
||||
OUTLOGIC(D.m_Q, 0, NLTIME_FROM_NS(40));
|
||||
}
|
||||
else
|
||||
{
|
||||
A.m_reset = B.m_reset = C.m_reset = D.m_reset = 0;
|
||||
A.m_I.activate_hl();
|
||||
B.m_I.activate_hl();
|
||||
}
|
||||
}
|
||||
|
@ -60,27 +60,27 @@
|
||||
#include "../nl_base.h"
|
||||
|
||||
#define TTL_7493(_name, _CLKA, _CLKB, _R1, _R2) \
|
||||
NET_REGISTER_DEV(7493, _name) \
|
||||
NET_CONNECT(_name, CLKA, _CLKA) \
|
||||
NET_CONNECT(_name, CLKB, _CLKB) \
|
||||
NET_CONNECT(_name, R1, _R1) \
|
||||
NET_CONNECT(_name, R2, _R2)
|
||||
NET_REGISTER_DEV(7493, _name) \
|
||||
NET_CONNECT(_name, CLKA, _CLKA) \
|
||||
NET_CONNECT(_name, CLKB, _CLKB) \
|
||||
NET_CONNECT(_name, R1, _R1) \
|
||||
NET_CONNECT(_name, R2, _R2)
|
||||
|
||||
NETLIB_SUBDEVICE(7493ff,
|
||||
netlist_ttl_input_t m_I;
|
||||
netlist_ttl_output_t m_Q;
|
||||
netlist_ttl_input_t m_I;
|
||||
netlist_ttl_output_t m_Q;
|
||||
|
||||
UINT8 m_reset;
|
||||
UINT8 m_reset;
|
||||
);
|
||||
|
||||
NETLIB_DEVICE(7493,
|
||||
netlist_ttl_input_t m_R1;
|
||||
netlist_ttl_input_t m_R2;
|
||||
netlist_ttl_input_t m_R1;
|
||||
netlist_ttl_input_t m_R2;
|
||||
|
||||
NETLIB_NAME(7493ff) A;
|
||||
NETLIB_NAME(7493ff) B;
|
||||
NETLIB_NAME(7493ff) C;
|
||||
NETLIB_NAME(7493ff) D;
|
||||
NETLIB_NAME(7493ff) A;
|
||||
NETLIB_NAME(7493ff) B;
|
||||
NETLIB_NAME(7493ff) C;
|
||||
NETLIB_NAME(7493ff) D;
|
||||
);
|
||||
|
||||
#endif /* NLD_7493_H_ */
|
||||
|
@ -7,148 +7,147 @@
|
||||
|
||||
NETLIB_START(9316)
|
||||
{
|
||||
register_sub(sub, "sub");
|
||||
register_sub(sub, "sub");
|
||||
|
||||
register_subalias("CLK", sub.m_clk);
|
||||
register_subalias("CLK", sub.m_clk);
|
||||
|
||||
register_input("ENP", m_ENP);
|
||||
register_input("ENT", m_ENT);
|
||||
register_input("CLRQ", m_CLRQ);
|
||||
register_input("LOADQ", m_LOADQ);
|
||||
register_input("ENP", m_ENP);
|
||||
register_input("ENT", m_ENT);
|
||||
register_input("CLRQ", m_CLRQ);
|
||||
register_input("LOADQ", m_LOADQ);
|
||||
|
||||
register_subalias("A", sub.m_A);
|
||||
register_subalias("B", sub.m_B);
|
||||
register_subalias("C", sub.m_C);
|
||||
register_subalias("D", sub.m_D);
|
||||
register_subalias("A", sub.m_A);
|
||||
register_subalias("B", sub.m_B);
|
||||
register_subalias("C", sub.m_C);
|
||||
register_subalias("D", sub.m_D);
|
||||
|
||||
register_subalias("QA", sub.m_QA);
|
||||
register_subalias("QB", sub.m_QB);
|
||||
register_subalias("QC", sub.m_QC);
|
||||
register_subalias("QD", sub.m_QD);
|
||||
register_subalias("RC", sub.m_RC);
|
||||
register_subalias("QA", sub.m_QA);
|
||||
register_subalias("QB", sub.m_QB);
|
||||
register_subalias("QC", sub.m_QC);
|
||||
register_subalias("QD", sub.m_QD);
|
||||
register_subalias("RC", sub.m_RC);
|
||||
|
||||
}
|
||||
|
||||
NETLIB_START(9316_sub)
|
||||
{
|
||||
m_cnt = 0;
|
||||
m_loadq = 1;
|
||||
m_ent = 1;
|
||||
m_cnt = 0;
|
||||
m_loadq = 1;
|
||||
m_ent = 1;
|
||||
|
||||
register_input("CLK", m_clk, netlist_input_t::STATE_INP_LH);
|
||||
register_input("CLK", m_clk, netlist_input_t::STATE_INP_LH);
|
||||
|
||||
register_input("A", m_A, netlist_input_t::STATE_INP_PASSIVE);
|
||||
register_input("B", m_B, netlist_input_t::STATE_INP_PASSIVE);
|
||||
register_input("C", m_C, netlist_input_t::STATE_INP_PASSIVE);
|
||||
register_input("D", m_D, netlist_input_t::STATE_INP_PASSIVE);
|
||||
register_input("A", m_A, netlist_input_t::STATE_INP_PASSIVE);
|
||||
register_input("B", m_B, netlist_input_t::STATE_INP_PASSIVE);
|
||||
register_input("C", m_C, netlist_input_t::STATE_INP_PASSIVE);
|
||||
register_input("D", m_D, netlist_input_t::STATE_INP_PASSIVE);
|
||||
|
||||
register_output("QA", m_QA);
|
||||
register_output("QB", m_QB);
|
||||
register_output("QC", m_QC);
|
||||
register_output("QD", m_QD);
|
||||
register_output("RC", m_RC);
|
||||
register_output("QA", m_QA);
|
||||
register_output("QB", m_QB);
|
||||
register_output("QC", m_QC);
|
||||
register_output("QD", m_QD);
|
||||
register_output("RC", m_RC);
|
||||
|
||||
save(NAME(m_cnt));
|
||||
save(NAME(m_loadq));
|
||||
save(NAME(m_ent));
|
||||
save(NAME(m_cnt));
|
||||
save(NAME(m_loadq));
|
||||
save(NAME(m_ent));
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(9316_sub)
|
||||
{
|
||||
UINT8 cnt = m_cnt;
|
||||
if (m_loadq)
|
||||
{
|
||||
cnt = ( cnt + 1) & 0x0f;
|
||||
update_outputs(cnt);
|
||||
if (cnt == 0x0f)
|
||||
OUTLOGIC(m_RC, m_ent, NLTIME_FROM_NS(20));
|
||||
else if (cnt == 0)
|
||||
OUTLOGIC(m_RC, 0, NLTIME_FROM_NS(20));
|
||||
}
|
||||
else
|
||||
{
|
||||
cnt = (INPLOGIC_PASSIVE(m_D) << 3) | (INPLOGIC_PASSIVE(m_C) << 2) | (INPLOGIC_PASSIVE(m_B) << 1) | (INPLOGIC_PASSIVE(m_A) << 0);
|
||||
update_outputs_all(cnt);
|
||||
OUTLOGIC(m_RC, m_ent & (cnt == 0x0f), NLTIME_FROM_NS(20));
|
||||
}
|
||||
m_cnt = cnt;
|
||||
UINT8 cnt = m_cnt;
|
||||
if (m_loadq)
|
||||
{
|
||||
cnt = ( cnt + 1) & 0x0f;
|
||||
update_outputs(cnt);
|
||||
if (cnt == 0x0f)
|
||||
OUTLOGIC(m_RC, m_ent, NLTIME_FROM_NS(20));
|
||||
else if (cnt == 0)
|
||||
OUTLOGIC(m_RC, 0, NLTIME_FROM_NS(20));
|
||||
}
|
||||
else
|
||||
{
|
||||
cnt = (INPLOGIC_PASSIVE(m_D) << 3) | (INPLOGIC_PASSIVE(m_C) << 2) | (INPLOGIC_PASSIVE(m_B) << 1) | (INPLOGIC_PASSIVE(m_A) << 0);
|
||||
update_outputs_all(cnt);
|
||||
OUTLOGIC(m_RC, m_ent & (cnt == 0x0f), NLTIME_FROM_NS(20));
|
||||
}
|
||||
m_cnt = cnt;
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(9316)
|
||||
{
|
||||
sub.m_loadq = INPLOGIC(m_LOADQ);
|
||||
sub.m_ent = INPLOGIC(m_ENT);
|
||||
const netlist_sig_t clrq = INPLOGIC(m_CLRQ);
|
||||
sub.m_loadq = INPLOGIC(m_LOADQ);
|
||||
sub.m_ent = INPLOGIC(m_ENT);
|
||||
const netlist_sig_t clrq = INPLOGIC(m_CLRQ);
|
||||
|
||||
if ((!sub.m_loadq || (sub.m_ent & INPLOGIC(m_ENP))) & clrq)
|
||||
{
|
||||
sub.m_clk.activate_lh();
|
||||
}
|
||||
else
|
||||
{
|
||||
sub.m_clk.inactivate();
|
||||
if (!clrq & (sub.m_cnt>0))
|
||||
{
|
||||
sub.m_cnt = 0;
|
||||
sub.update_outputs(sub.m_cnt);
|
||||
OUTLOGIC(sub.m_RC, 0, NLTIME_FROM_NS(20));
|
||||
return;
|
||||
}
|
||||
}
|
||||
OUTLOGIC(sub.m_RC, sub.m_ent & (sub.m_cnt == 0x0f), NLTIME_FROM_NS(20));
|
||||
if ((!sub.m_loadq || (sub.m_ent & INPLOGIC(m_ENP))) & clrq)
|
||||
{
|
||||
sub.m_clk.activate_lh();
|
||||
}
|
||||
else
|
||||
{
|
||||
sub.m_clk.inactivate();
|
||||
if (!clrq & (sub.m_cnt>0))
|
||||
{
|
||||
sub.m_cnt = 0;
|
||||
sub.update_outputs(sub.m_cnt);
|
||||
OUTLOGIC(sub.m_RC, 0, NLTIME_FROM_NS(20));
|
||||
return;
|
||||
}
|
||||
}
|
||||
OUTLOGIC(sub.m_RC, sub.m_ent & (sub.m_cnt == 0x0f), NLTIME_FROM_NS(20));
|
||||
}
|
||||
|
||||
inline NETLIB_FUNC_VOID(9316_sub, update_outputs_all, (const UINT8 cnt))
|
||||
{
|
||||
const netlist_time out_delay = NLTIME_FROM_NS(20);
|
||||
OUTLOGIC(m_QA, (cnt >> 0) & 1, out_delay);
|
||||
OUTLOGIC(m_QB, (cnt >> 1) & 1, out_delay);
|
||||
OUTLOGIC(m_QC, (cnt >> 2) & 1, out_delay);
|
||||
OUTLOGIC(m_QD, (cnt >> 3) & 1, out_delay);
|
||||
const netlist_time out_delay = NLTIME_FROM_NS(20);
|
||||
OUTLOGIC(m_QA, (cnt >> 0) & 1, out_delay);
|
||||
OUTLOGIC(m_QB, (cnt >> 1) & 1, out_delay);
|
||||
OUTLOGIC(m_QC, (cnt >> 2) & 1, out_delay);
|
||||
OUTLOGIC(m_QD, (cnt >> 3) & 1, out_delay);
|
||||
}
|
||||
|
||||
inline NETLIB_FUNC_VOID(9316_sub, update_outputs, (const UINT8 cnt))
|
||||
{
|
||||
const netlist_time out_delay = NLTIME_FROM_NS(20);
|
||||
const netlist_time out_delay = NLTIME_FROM_NS(20);
|
||||
#if 0
|
||||
// for (int i=0; i<4; i++)
|
||||
// OUTLOGIC(m_Q[i], (cnt >> i) & 1, delay[i]);
|
||||
OUTLOGIC(m_QA, (cnt >> 0) & 1, out_delay);
|
||||
OUTLOGIC(m_QB, (cnt >> 1) & 1, out_delay);
|
||||
OUTLOGIC(m_QC, (cnt >> 2) & 1, out_delay);
|
||||
OUTLOGIC(m_QD, (cnt >> 3) & 1, out_delay);
|
||||
OUTLOGIC(m_QA, (cnt >> 0) & 1, out_delay);
|
||||
OUTLOGIC(m_QB, (cnt >> 1) & 1, out_delay);
|
||||
OUTLOGIC(m_QC, (cnt >> 2) & 1, out_delay);
|
||||
OUTLOGIC(m_QD, (cnt >> 3) & 1, out_delay);
|
||||
#else
|
||||
if ((cnt & 1) == 1)
|
||||
OUTLOGIC(m_QA, 1, out_delay);
|
||||
else
|
||||
{
|
||||
OUTLOGIC(m_QA, 0, out_delay);
|
||||
switch (cnt)
|
||||
{
|
||||
case 0x00:
|
||||
OUTLOGIC(m_QB, 0, out_delay);
|
||||
OUTLOGIC(m_QC, 0, out_delay);
|
||||
OUTLOGIC(m_QD, 0, out_delay);
|
||||
break;
|
||||
case 0x02:
|
||||
case 0x06:
|
||||
case 0x0A:
|
||||
case 0x0E:
|
||||
OUTLOGIC(m_QB, 1, out_delay);
|
||||
break;
|
||||
case 0x04:
|
||||
case 0x0C:
|
||||
OUTLOGIC(m_QB, 0, out_delay);
|
||||
OUTLOGIC(m_QC, 1, out_delay);
|
||||
break;
|
||||
case 0x08:
|
||||
OUTLOGIC(m_QB, 0, out_delay);
|
||||
OUTLOGIC(m_QC, 0, out_delay);
|
||||
OUTLOGIC(m_QD, 1, out_delay);
|
||||
break;
|
||||
}
|
||||
if ((cnt & 1) == 1)
|
||||
OUTLOGIC(m_QA, 1, out_delay);
|
||||
else
|
||||
{
|
||||
OUTLOGIC(m_QA, 0, out_delay);
|
||||
switch (cnt)
|
||||
{
|
||||
case 0x00:
|
||||
OUTLOGIC(m_QB, 0, out_delay);
|
||||
OUTLOGIC(m_QC, 0, out_delay);
|
||||
OUTLOGIC(m_QD, 0, out_delay);
|
||||
break;
|
||||
case 0x02:
|
||||
case 0x06:
|
||||
case 0x0A:
|
||||
case 0x0E:
|
||||
OUTLOGIC(m_QB, 1, out_delay);
|
||||
break;
|
||||
case 0x04:
|
||||
case 0x0C:
|
||||
OUTLOGIC(m_QB, 0, out_delay);
|
||||
OUTLOGIC(m_QC, 1, out_delay);
|
||||
break;
|
||||
case 0x08:
|
||||
OUTLOGIC(m_QB, 0, out_delay);
|
||||
OUTLOGIC(m_QC, 0, out_delay);
|
||||
OUTLOGIC(m_QD, 1, out_delay);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -52,45 +52,45 @@
|
||||
#include "../nl_base.h"
|
||||
|
||||
#define TTL_9316(_name, _CLK, _ENP, _ENT, _CLRQ, _LOADQ, _A, _B, _C, _D) \
|
||||
NET_REGISTER_DEV(9316, _name) \
|
||||
NET_CONNECT(_name, CLK, _CLK) \
|
||||
NET_CONNECT(_name, ENP, _ENP) \
|
||||
NET_CONNECT(_name, ENT, _ENT) \
|
||||
NET_CONNECT(_name, CLRQ, _CLRQ) \
|
||||
NET_CONNECT(_name, LOADQ,_LOADQ) \
|
||||
NET_CONNECT(_name, A, _A) \
|
||||
NET_CONNECT(_name, B, _B) \
|
||||
NET_CONNECT(_name, C, _C) \
|
||||
NET_CONNECT(_name, D, _D)
|
||||
NET_REGISTER_DEV(9316, _name) \
|
||||
NET_CONNECT(_name, CLK, _CLK) \
|
||||
NET_CONNECT(_name, ENP, _ENP) \
|
||||
NET_CONNECT(_name, ENT, _ENT) \
|
||||
NET_CONNECT(_name, CLRQ, _CLRQ) \
|
||||
NET_CONNECT(_name, LOADQ,_LOADQ) \
|
||||
NET_CONNECT(_name, A, _A) \
|
||||
NET_CONNECT(_name, B, _B) \
|
||||
NET_CONNECT(_name, C, _C) \
|
||||
NET_CONNECT(_name, D, _D)
|
||||
|
||||
NETLIB_SUBDEVICE(9316_sub,
|
||||
ATTR_HOT void update_outputs_all(const UINT8 cnt);
|
||||
ATTR_HOT void update_outputs(const UINT8 cnt);
|
||||
ATTR_HOT void update_outputs_all(const UINT8 cnt);
|
||||
ATTR_HOT void update_outputs(const UINT8 cnt);
|
||||
|
||||
netlist_ttl_input_t m_clk;
|
||||
netlist_ttl_input_t m_clk;
|
||||
|
||||
netlist_ttl_input_t m_A;
|
||||
netlist_ttl_input_t m_B;
|
||||
netlist_ttl_input_t m_C;
|
||||
netlist_ttl_input_t m_D;
|
||||
netlist_ttl_input_t m_A;
|
||||
netlist_ttl_input_t m_B;
|
||||
netlist_ttl_input_t m_C;
|
||||
netlist_ttl_input_t m_D;
|
||||
|
||||
UINT8 m_cnt;
|
||||
netlist_sig_t m_loadq;
|
||||
netlist_sig_t m_ent;
|
||||
UINT8 m_cnt;
|
||||
netlist_sig_t m_loadq;
|
||||
netlist_sig_t m_ent;
|
||||
|
||||
netlist_ttl_output_t m_QA;
|
||||
netlist_ttl_output_t m_QB;
|
||||
netlist_ttl_output_t m_QC;
|
||||
netlist_ttl_output_t m_QD;
|
||||
netlist_ttl_output_t m_RC;
|
||||
netlist_ttl_output_t m_QA;
|
||||
netlist_ttl_output_t m_QB;
|
||||
netlist_ttl_output_t m_QC;
|
||||
netlist_ttl_output_t m_QD;
|
||||
netlist_ttl_output_t m_RC;
|
||||
);
|
||||
|
||||
NETLIB_DEVICE(9316,
|
||||
NETLIB_NAME(9316_sub) sub;
|
||||
netlist_ttl_input_t m_ENP;
|
||||
netlist_ttl_input_t m_ENT;
|
||||
netlist_ttl_input_t m_CLRQ;
|
||||
netlist_ttl_input_t m_LOADQ;
|
||||
NETLIB_NAME(9316_sub) sub;
|
||||
netlist_ttl_input_t m_ENP;
|
||||
netlist_ttl_input_t m_ENT;
|
||||
netlist_ttl_input_t m_CLRQ;
|
||||
netlist_ttl_input_t m_LOADQ;
|
||||
);
|
||||
|
||||
#endif /* NLD_9316_H_ */
|
||||
|
@ -7,141 +7,141 @@
|
||||
|
||||
NETLIB_START(nicMultiSwitch)
|
||||
{
|
||||
static const char *sIN[8] = { "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8" };
|
||||
int i;
|
||||
static const char *sIN[8] = { "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8" };
|
||||
int i;
|
||||
|
||||
m_position = 0;
|
||||
m_low.initial(0);
|
||||
m_position = 0;
|
||||
m_low.initial(0);
|
||||
|
||||
for (i=0; i<8; i++)
|
||||
{
|
||||
register_input(sIN[i], m_I[i]);
|
||||
m_low.net().register_con(m_I[i]);
|
||||
//m_I[i].set_net(m_low.m_net);
|
||||
}
|
||||
register_param("POS", m_POS, 0);
|
||||
register_output("Q", m_Q);
|
||||
for (i=0; i<8; i++)
|
||||
{
|
||||
register_input(sIN[i], m_I[i]);
|
||||
m_low.net().register_con(m_I[i]);
|
||||
//m_I[i].set_net(m_low.m_net);
|
||||
}
|
||||
register_param("POS", m_POS, 0);
|
||||
register_output("Q", m_Q);
|
||||
|
||||
save(NAME(m_position));
|
||||
save(NAME(m_position));
|
||||
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(nicMultiSwitch)
|
||||
{
|
||||
assert(m_position<8);
|
||||
OUTANALOG(m_Q, INPANALOG(m_I[m_position]), NLTIME_FROM_NS(1));
|
||||
assert(m_position<8);
|
||||
OUTANALOG(m_Q, INPANALOG(m_I[m_position]), NLTIME_FROM_NS(1));
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(nicMultiSwitch)
|
||||
{
|
||||
m_position = m_POS.Value();
|
||||
//update();
|
||||
m_position = m_POS.Value();
|
||||
//update();
|
||||
}
|
||||
|
||||
NETLIB_START(nicMixer8)
|
||||
{
|
||||
static const char *sI[8] = { "I1", "I2", "I3", "I4", "I5", "I6", "I7", "I8" };
|
||||
static const char *sR[8] = { "R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8" };
|
||||
int i;
|
||||
static const char *sI[8] = { "I1", "I2", "I3", "I4", "I5", "I6", "I7", "I8" };
|
||||
static const char *sR[8] = { "R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8" };
|
||||
int i;
|
||||
|
||||
m_low.initial(0);
|
||||
m_low.initial(0);
|
||||
|
||||
for (i=0; i<8; i++)
|
||||
{
|
||||
register_input(sI[i], m_I[i]);
|
||||
m_low.net().register_con(m_I[i]);
|
||||
//m_I[i].set_output(m_low);
|
||||
register_param(sR[i], m_R[i], 1e12);
|
||||
}
|
||||
register_output("Q", m_Q);
|
||||
for (i=0; i<8; i++)
|
||||
{
|
||||
register_input(sI[i], m_I[i]);
|
||||
m_low.net().register_con(m_I[i]);
|
||||
//m_I[i].set_output(m_low);
|
||||
register_param(sR[i], m_R[i], 1e12);
|
||||
}
|
||||
register_output("Q", m_Q);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(nicMixer8)
|
||||
{
|
||||
int i;
|
||||
double r = 0;
|
||||
int i;
|
||||
double r = 0;
|
||||
|
||||
for (i=0; i<8; i++)
|
||||
{
|
||||
r += m_w[i] * INPANALOG(m_I[i]);
|
||||
}
|
||||
OUTANALOG(m_Q, r, NLTIME_IMMEDIATE);
|
||||
for (i=0; i<8; i++)
|
||||
{
|
||||
r += m_w[i] * INPANALOG(m_I[i]);
|
||||
}
|
||||
OUTANALOG(m_Q, r, NLTIME_IMMEDIATE);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(nicMixer8)
|
||||
{
|
||||
double t = 0;
|
||||
int i;
|
||||
double t = 0;
|
||||
int i;
|
||||
|
||||
for (i=0; i<8; i++)
|
||||
t += 1.0 / m_R[i].Value();
|
||||
t = 1.0 / t;
|
||||
for (i=0; i<8; i++)
|
||||
t += 1.0 / m_R[i].Value();
|
||||
t = 1.0 / t;
|
||||
|
||||
for (i=0; i<8; i++)
|
||||
m_w[i] = t / m_R[i].Value();
|
||||
for (i=0; i<8; i++)
|
||||
m_w[i] = t / m_R[i].Value();
|
||||
}
|
||||
|
||||
|
||||
|
||||
NETLIB_START(nicRSFF)
|
||||
{
|
||||
register_input("S", m_S);
|
||||
register_input("R", m_R);
|
||||
register_output("Q", m_Q);
|
||||
register_output("QQ", m_QQ);
|
||||
m_Q.initial(0);
|
||||
m_QQ.initial(1);
|
||||
register_input("S", m_S);
|
||||
register_input("R", m_R);
|
||||
register_output("Q", m_Q);
|
||||
register_output("QQ", m_QQ);
|
||||
m_Q.initial(0);
|
||||
m_QQ.initial(1);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(nicRSFF)
|
||||
{
|
||||
if (INPLOGIC(m_S))
|
||||
{
|
||||
OUTLOGIC(m_Q, 1, NLTIME_FROM_NS(10));
|
||||
OUTLOGIC(m_QQ, 0, NLTIME_FROM_NS(10));
|
||||
}
|
||||
else if (INPLOGIC(m_R))
|
||||
{
|
||||
OUTLOGIC(m_Q, 0, NLTIME_FROM_NS(10));
|
||||
OUTLOGIC(m_QQ, 1, NLTIME_FROM_NS(10));
|
||||
}
|
||||
if (INPLOGIC(m_S))
|
||||
{
|
||||
OUTLOGIC(m_Q, 1, NLTIME_FROM_NS(10));
|
||||
OUTLOGIC(m_QQ, 0, NLTIME_FROM_NS(10));
|
||||
}
|
||||
else if (INPLOGIC(m_R))
|
||||
{
|
||||
OUTLOGIC(m_Q, 0, NLTIME_FROM_NS(10));
|
||||
OUTLOGIC(m_QQ, 1, NLTIME_FROM_NS(10));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NETLIB_START(nicNE555N_MSTABLE)
|
||||
{
|
||||
register_input("TRIG", m_trigger);
|
||||
register_input("CV", m_CV);
|
||||
register_input("TRIG", m_trigger);
|
||||
register_input("CV", m_CV);
|
||||
|
||||
register_output("Q", m_Q);
|
||||
register_param("R", m_R, 0.0);
|
||||
register_param("C", m_C, 0.0);
|
||||
register_param("VS", m_VS, 5.0);
|
||||
register_param("VL", m_VL, 0.0 *5.0);
|
||||
register_output("Q", m_Q);
|
||||
register_param("R", m_R, 0.0);
|
||||
register_param("C", m_C, 0.0);
|
||||
register_param("VS", m_VS, 5.0);
|
||||
register_param("VL", m_VL, 0.0 *5.0);
|
||||
|
||||
m_THRESHOLD_OUT.init_object(*this, name() + "THRESHOLD");
|
||||
register_link_internal(m_THRESHOLD, m_THRESHOLD_OUT, netlist_input_t::STATE_INP_ACTIVE);
|
||||
m_THRESHOLD_OUT.init_object(*this, name() + "THRESHOLD");
|
||||
register_link_internal(m_THRESHOLD, m_THRESHOLD_OUT, netlist_input_t::STATE_INP_ACTIVE);
|
||||
|
||||
m_Q.initial(5.0 * 0.4);
|
||||
m_last = false;
|
||||
m_Q.initial(5.0 * 0.4);
|
||||
m_last = false;
|
||||
|
||||
save(NAME(m_last));
|
||||
save(NAME(m_last));
|
||||
|
||||
}
|
||||
|
||||
inline double NETLIB_NAME(nicNE555N_MSTABLE)::nicNE555N_cv()
|
||||
{
|
||||
return (m_CV.is_highz() ? 0.67 * m_VS.Value() : INPANALOG(m_CV));
|
||||
return (m_CV.is_highz() ? 0.67 * m_VS.Value() : INPANALOG(m_CV));
|
||||
}
|
||||
|
||||
inline double NETLIB_NAME(nicNE555N_MSTABLE)::nicNE555N_clamp(const double v, const double a, const double b)
|
||||
{
|
||||
double ret = v;
|
||||
if (ret > m_VS.Value() - a)
|
||||
ret = m_VS.Value() - a;
|
||||
if (ret < b)
|
||||
ret = b;
|
||||
return ret;
|
||||
double ret = v;
|
||||
if (ret > m_VS.Value() - a)
|
||||
ret = m_VS.Value() - a;
|
||||
if (ret < b)
|
||||
ret = b;
|
||||
return ret;
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(nicNE555N_MSTABLE)
|
||||
@ -150,46 +150,46 @@ NETLIB_UPDATE_PARAM(nicNE555N_MSTABLE)
|
||||
|
||||
NETLIB_UPDATE(nicNE555N_MSTABLE)
|
||||
{
|
||||
update_param(); // FIXME : m_CV should be on a sub device ...
|
||||
update_param(); // FIXME : m_CV should be on a sub device ...
|
||||
|
||||
double vt = nicNE555N_clamp(nicNE555N_cv(), 0.7, 1.4);
|
||||
bool bthresh = (INPANALOG(m_THRESHOLD) > vt);
|
||||
bool btrig = (INPANALOG(m_trigger) > nicNE555N_clamp(nicNE555N_cv() * 0.5, 0.7, 1.4));
|
||||
bool out = m_last;
|
||||
double vt = nicNE555N_clamp(nicNE555N_cv(), 0.7, 1.4);
|
||||
bool bthresh = (INPANALOG(m_THRESHOLD) > vt);
|
||||
bool btrig = (INPANALOG(m_trigger) > nicNE555N_clamp(nicNE555N_cv() * 0.5, 0.7, 1.4));
|
||||
bool out = m_last;
|
||||
|
||||
if (!btrig)
|
||||
{
|
||||
out = true;
|
||||
}
|
||||
else if (bthresh)
|
||||
{
|
||||
out = false;
|
||||
}
|
||||
if (!btrig)
|
||||
{
|
||||
out = true;
|
||||
}
|
||||
else if (bthresh)
|
||||
{
|
||||
out = false;
|
||||
}
|
||||
|
||||
if (!m_last && out)
|
||||
{
|
||||
double vl = m_VL.Value();
|
||||
double time;
|
||||
if (!m_last && out)
|
||||
{
|
||||
double vl = m_VL.Value();
|
||||
double time;
|
||||
|
||||
// FIXME : m_CV should be on a sub device ...
|
||||
// FIXME : m_CV should be on a sub device ...
|
||||
|
||||
// TI datasheet states minimum pulse of 10 us
|
||||
if (vt<vl)
|
||||
time = 10;
|
||||
else
|
||||
{
|
||||
time = - log((m_VS.Value()-vt)/(m_VS.Value()-vl)) * m_R.Value() * m_C.Value() * 1.0e6; // in us
|
||||
if (time < 10.0)
|
||||
time = 10.0;
|
||||
}
|
||||
// TI datasheet states minimum pulse of 10 us
|
||||
if (vt<vl)
|
||||
time = 10;
|
||||
else
|
||||
{
|
||||
time = - log((m_VS.Value()-vt)/(m_VS.Value()-vl)) * m_R.Value() * m_C.Value() * 1.0e6; // in us
|
||||
if (time < 10.0)
|
||||
time = 10.0;
|
||||
}
|
||||
|
||||
OUTANALOG(m_Q, m_VS.Value() * 0.7, NLTIME_FROM_NS(100));
|
||||
OUTANALOG(m_THRESHOLD_OUT, m_VS.Value(), NLTIME_FROM_US(time ));
|
||||
}
|
||||
else if (m_last && !out)
|
||||
{
|
||||
OUTANALOG(m_Q, 0.25, NLTIME_FROM_NS(100));
|
||||
OUTANALOG(m_THRESHOLD_OUT, 0.0, NLTIME_FROM_NS(1));
|
||||
}
|
||||
m_last = out;
|
||||
OUTANALOG(m_Q, m_VS.Value() * 0.7, NLTIME_FROM_NS(100));
|
||||
OUTANALOG(m_THRESHOLD_OUT, m_VS.Value(), NLTIME_FROM_US(time ));
|
||||
}
|
||||
else if (m_last && !out)
|
||||
{
|
||||
OUTANALOG(m_Q, 0.25, NLTIME_FROM_NS(100));
|
||||
OUTANALOG(m_THRESHOLD_OUT, 0.0, NLTIME_FROM_NS(1));
|
||||
}
|
||||
m_last = out;
|
||||
}
|
||||
|
@ -20,83 +20,83 @@
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
#define NETDEV_RSFF(_name, _S, _R) \
|
||||
NET_REGISTER_DEV(nicRSFF, _name) \
|
||||
NET_CONNECT(_name, S, _S) \
|
||||
NET_CONNECT(_name, R, _R)
|
||||
NET_REGISTER_DEV(nicRSFF, _name) \
|
||||
NET_CONNECT(_name, S, _S) \
|
||||
NET_CONNECT(_name, R, _R)
|
||||
|
||||
|
||||
#define NE555N_MSTABLE(_name, _TRIG, _CV) \
|
||||
NET_REGISTER_DEV(nicNE555N_MSTABLE, _name) \
|
||||
NET_CONNECT(_name, TRIG, _TRIG) \
|
||||
NET_CONNECT(_name, CV, _CV)
|
||||
NET_REGISTER_DEV(nicNE555N_MSTABLE, _name) \
|
||||
NET_CONNECT(_name, TRIG, _TRIG) \
|
||||
NET_CONNECT(_name, CV, _CV)
|
||||
|
||||
#define NETDEV_MIXER3(_name, _I1, _I2, _I3) \
|
||||
NET_REGISTER_DEV(nicMixer8, _name) \
|
||||
NET_CONNECT(_name, I1, _I1) \
|
||||
NET_CONNECT(_name, I2, _I2) \
|
||||
NET_CONNECT(_name, I3, _I3)
|
||||
NET_REGISTER_DEV(nicMixer8, _name) \
|
||||
NET_CONNECT(_name, I1, _I1) \
|
||||
NET_CONNECT(_name, I2, _I2) \
|
||||
NET_CONNECT(_name, I3, _I3)
|
||||
|
||||
#define NETDEV_SWITCH2(_name, _i1, _i2) \
|
||||
NET_REGISTER_DEV(nicMultiSwitch, _name) \
|
||||
NET_CONNECT(_name, i1, _i1) \
|
||||
NET_CONNECT(_name, i2, _i2)
|
||||
NET_REGISTER_DEV(nicMultiSwitch, _name) \
|
||||
NET_CONNECT(_name, i1, _i1) \
|
||||
NET_CONNECT(_name, i2, _i2)
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Devices ...
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
NETLIB_DEVICE(nicRSFF,
|
||||
netlist_ttl_input_t m_S;
|
||||
netlist_ttl_input_t m_R;
|
||||
netlist_ttl_input_t m_S;
|
||||
netlist_ttl_input_t m_R;
|
||||
|
||||
netlist_ttl_output_t m_Q;
|
||||
netlist_ttl_output_t m_QQ;
|
||||
netlist_ttl_output_t m_Q;
|
||||
netlist_ttl_output_t m_QQ;
|
||||
);
|
||||
|
||||
NETLIB_DEVICE_WITH_PARAMS(nicMixer8,
|
||||
netlist_analog_input_t m_I[8];
|
||||
netlist_analog_input_t m_I[8];
|
||||
|
||||
netlist_analog_output_t m_Q;
|
||||
netlist_analog_output_t m_low;
|
||||
netlist_analog_output_t m_Q;
|
||||
netlist_analog_output_t m_low;
|
||||
|
||||
netlist_param_double_t m_R[8];
|
||||
netlist_param_double_t m_R[8];
|
||||
|
||||
double m_w[8];
|
||||
double m_w[8];
|
||||
);
|
||||
|
||||
NETLIB_DEVICE_WITH_PARAMS(nicNE555N_MSTABLE,
|
||||
|
||||
//ATTR_HOT void timer_cb(INT32 timer_id);
|
||||
//ATTR_HOT void timer_cb(INT32 timer_id);
|
||||
|
||||
netlist_analog_input_t m_trigger;
|
||||
netlist_analog_input_t m_CV;
|
||||
netlist_analog_input_t m_THRESHOLD; /* internal */
|
||||
netlist_analog_input_t m_trigger;
|
||||
netlist_analog_input_t m_CV;
|
||||
netlist_analog_input_t m_THRESHOLD; /* internal */
|
||||
|
||||
bool m_last;
|
||||
bool m_last;
|
||||
|
||||
netlist_analog_output_t m_Q;
|
||||
netlist_analog_output_t m_THRESHOLD_OUT; /* internal */
|
||||
netlist_analog_output_t m_Q;
|
||||
netlist_analog_output_t m_THRESHOLD_OUT; /* internal */
|
||||
|
||||
//netlist_base_timer_t *m_timer;
|
||||
netlist_param_double_t m_R;
|
||||
netlist_param_double_t m_C;
|
||||
netlist_param_double_t m_VS;
|
||||
netlist_param_double_t m_VL;
|
||||
//netlist_base_timer_t *m_timer;
|
||||
netlist_param_double_t m_R;
|
||||
netlist_param_double_t m_C;
|
||||
netlist_param_double_t m_VS;
|
||||
netlist_param_double_t m_VL;
|
||||
|
||||
double nicNE555N_cv();
|
||||
double nicNE555N_clamp(const double v, const double a, const double b);
|
||||
double nicNE555N_cv();
|
||||
double nicNE555N_clamp(const double v, const double a, const double b);
|
||||
|
||||
);
|
||||
|
||||
NETLIB_DEVICE_WITH_PARAMS(nicMultiSwitch,
|
||||
netlist_analog_input_t m_I[8];
|
||||
netlist_analog_input_t m_I[8];
|
||||
|
||||
netlist_analog_output_t m_Q;
|
||||
netlist_analog_output_t m_low;
|
||||
netlist_analog_output_t m_Q;
|
||||
netlist_analog_output_t m_low;
|
||||
|
||||
netlist_param_int_t m_POS;
|
||||
netlist_param_int_t m_POS;
|
||||
|
||||
int m_position;
|
||||
int m_position;
|
||||
);
|
||||
|
||||
|
||||
|
@ -10,31 +10,31 @@
|
||||
|
||||
NETLIB_START(log)
|
||||
{
|
||||
register_input("I", m_I);
|
||||
register_input("I", m_I);
|
||||
|
||||
pstring filename = "netlist_" + name() + ".log";
|
||||
m_file = fopen(filename, "w");
|
||||
pstring filename = "netlist_" + name() + ".log";
|
||||
m_file = fopen(filename, "w");
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(log)
|
||||
{
|
||||
fprintf(m_file, "%e %e\n", netlist().time().as_double(), INPANALOG(m_I));
|
||||
fprintf(m_file, "%e %e\n", netlist().time().as_double(), INPANALOG(m_I));
|
||||
}
|
||||
|
||||
NETLIB_NAME(log)::~NETLIB_NAME(log)()
|
||||
{
|
||||
fclose(m_file);
|
||||
fclose(m_file);
|
||||
}
|
||||
|
||||
NETLIB_START(logD)
|
||||
{
|
||||
NETLIB_NAME(log)::start();
|
||||
register_input("I2", m_I2);
|
||||
NETLIB_NAME(log)::start();
|
||||
register_input("I2", m_I2);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(logD)
|
||||
{
|
||||
fprintf(m_file, "%e %e\n", netlist().time().as_double(), INPANALOG(m_I) - INPANALOG(m_I2));
|
||||
fprintf(m_file, "%e %e\n", netlist().time().as_double(), INPANALOG(m_I) - INPANALOG(m_I2));
|
||||
}
|
||||
|
||||
// FIXME: Implement wav later, this must be clock triggered device where the input to be written
|
||||
@ -42,19 +42,19 @@ NETLIB_UPDATE(logD)
|
||||
#if 0
|
||||
NETLIB_START(wav)
|
||||
{
|
||||
register_input("I", m_I);
|
||||
register_input("I", m_I);
|
||||
|
||||
pstring filename = "netlist_" + name() + ".wav";
|
||||
m_file = wav_open(filename, sample_rate(), active_inputs()/2)
|
||||
pstring filename = "netlist_" + name() + ".wav";
|
||||
m_file = wav_open(filename, sample_rate(), active_inputs()/2)
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(wav)
|
||||
{
|
||||
fprintf(m_file, "%e %e\n", netlist().time().as_double(), INPANALOG(m_I));
|
||||
fprintf(m_file, "%e %e\n", netlist().time().as_double(), INPANALOG(m_I));
|
||||
}
|
||||
|
||||
NETLIB_NAME(log)::~NETLIB_NAME(wav)()
|
||||
{
|
||||
fclose(m_file);
|
||||
fclose(m_file);
|
||||
}
|
||||
#endif
|
||||
|
@ -21,32 +21,32 @@
|
||||
#include "../nl_base.h"
|
||||
|
||||
#define NETDEV_LOG(_name, _I) \
|
||||
NET_REGISTER_DEV(log, _name) \
|
||||
NET_CONNECT(_name, I, _I)
|
||||
NET_REGISTER_DEV(log, _name) \
|
||||
NET_CONNECT(_name, I, _I)
|
||||
|
||||
NETLIB_DEVICE(log,
|
||||
~NETLIB_NAME(log)();
|
||||
netlist_analog_input_t m_I;
|
||||
~NETLIB_NAME(log)();
|
||||
netlist_analog_input_t m_I;
|
||||
protected:
|
||||
FILE *m_file;
|
||||
FILE *m_file;
|
||||
);
|
||||
|
||||
#define NETDEV_LOGD(_name, _I, _I2) \
|
||||
NET_REGISTER_DEV(logD, _name) \
|
||||
NET_CONNECT(_name, I, _I) \
|
||||
NET_CONNECT(_name, I2, _I2)
|
||||
NET_REGISTER_DEV(logD, _name) \
|
||||
NET_CONNECT(_name, I, _I) \
|
||||
NET_CONNECT(_name, I2, _I2)
|
||||
|
||||
NETLIB_DEVICE_DERIVED(logD, log,
|
||||
netlist_analog_input_t m_I2;
|
||||
netlist_analog_input_t m_I2;
|
||||
);
|
||||
|
||||
#if 0
|
||||
NETLIB_DEVICE(wav,
|
||||
~NETLIB_NAME(wav)();
|
||||
netlist_analog_input_t m_I;
|
||||
~NETLIB_NAME(wav)();
|
||||
netlist_analog_input_t m_I;
|
||||
private:
|
||||
// FIXME: rewrite sound/wavwrite.h to be an object ...
|
||||
void *m_file;
|
||||
// FIXME: rewrite sound/wavwrite.h to be an object ...
|
||||
void *m_file;
|
||||
);
|
||||
#endif
|
||||
|
||||
|
@ -11,74 +11,73 @@
|
||||
|
||||
inline double NETLIB_NAME(NE555)::clamp(const double v, const double a, const double b)
|
||||
{
|
||||
double ret = v;
|
||||
double vcc = TERMANALOG(m_R1.m_P);
|
||||
double ret = v;
|
||||
double vcc = TERMANALOG(m_R1.m_P);
|
||||
|
||||
if (ret > vcc - a)
|
||||
ret = vcc - a;
|
||||
if (ret < b)
|
||||
ret = b;
|
||||
return ret;
|
||||
if (ret > vcc - a)
|
||||
ret = vcc - a;
|
||||
if (ret < b)
|
||||
ret = b;
|
||||
return ret;
|
||||
}
|
||||
|
||||
NETLIB_START(NE555)
|
||||
{
|
||||
register_sub(m_R1, "R1");
|
||||
register_sub(m_R2, "R2");
|
||||
register_sub(m_R3, "R3");
|
||||
register_sub(m_RDIS, "RDIS");
|
||||
|
||||
register_sub(m_R1, "R1");
|
||||
register_sub(m_R2, "R2");
|
||||
register_sub(m_R3, "R3");
|
||||
register_sub(m_RDIS, "RDIS");
|
||||
register_subalias("GND", m_R3.m_N); // Pin 1
|
||||
register_input("TRIG", m_TRIG); // Pin 2
|
||||
register_output("OUT", m_OUT); // Pin 3
|
||||
register_input("RESET", m_RESET); // Pin 4
|
||||
register_subalias("CONT", m_R1.m_N); // Pin 5
|
||||
register_input("THRESH", m_THRES); // Pin 6
|
||||
register_subalias("DISCH", m_RDIS.m_P); // Pin 7
|
||||
register_subalias("VCC", m_R1.m_P); // Pin 8
|
||||
|
||||
register_subalias("GND", m_R3.m_N); // Pin 1
|
||||
register_input("TRIG", m_TRIG); // Pin 2
|
||||
register_output("OUT", m_OUT); // Pin 3
|
||||
register_input("RESET", m_RESET); // Pin 4
|
||||
register_subalias("CONT", m_R1.m_N); // Pin 5
|
||||
register_input("THRESH", m_THRES); // Pin 6
|
||||
register_subalias("DISCH", m_RDIS.m_P); // Pin 7
|
||||
register_subalias("VCC", m_R1.m_P); // Pin 8
|
||||
m_R1.set_R(5000);
|
||||
m_R2.set_R(5000);
|
||||
m_R3.set_R(5000);
|
||||
m_RDIS.set_R(R_OFF);
|
||||
|
||||
m_R1.set_R(5000);
|
||||
m_R2.set_R(5000);
|
||||
m_R3.set_R(5000);
|
||||
m_RDIS.set_R(R_OFF);
|
||||
setup().connect(m_R1.m_N, m_R2.m_P);
|
||||
setup().connect(m_R2.m_N, m_R3.m_P);
|
||||
setup().connect(m_RDIS.m_N, m_R3.m_N);
|
||||
|
||||
setup().connect(m_R1.m_N, m_R2.m_P);
|
||||
setup().connect(m_R2.m_N, m_R3.m_P);
|
||||
setup().connect(m_RDIS.m_N, m_R3.m_N);
|
||||
m_last_out = false;
|
||||
|
||||
m_last_out = false;
|
||||
|
||||
save(NAME(m_last_out));
|
||||
save(NAME(m_last_out));
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(NE555)
|
||||
{
|
||||
// FIXME: assumes GND is connected to 0V.
|
||||
// FIXME: assumes GND is connected to 0V.
|
||||
|
||||
double vt = clamp(TERMANALOG(m_R2.m_P), 0.7, 1.4);
|
||||
bool bthresh = (INPANALOG(m_THRES) > vt);
|
||||
bool btrig = (INPANALOG(m_TRIG) > clamp(TERMANALOG(m_R2.m_N), 0.7, 1.4));
|
||||
bool out = m_last_out;
|
||||
double vt = clamp(TERMANALOG(m_R2.m_P), 0.7, 1.4);
|
||||
bool bthresh = (INPANALOG(m_THRES) > vt);
|
||||
bool btrig = (INPANALOG(m_TRIG) > clamp(TERMANALOG(m_R2.m_N), 0.7, 1.4));
|
||||
bool out = m_last_out;
|
||||
|
||||
if (!btrig)
|
||||
{
|
||||
out = true;
|
||||
}
|
||||
else if (bthresh)
|
||||
{
|
||||
out = false;
|
||||
}
|
||||
if (!btrig)
|
||||
{
|
||||
out = true;
|
||||
}
|
||||
else if (bthresh)
|
||||
{
|
||||
out = false;
|
||||
}
|
||||
|
||||
if (!m_last_out && out)
|
||||
{
|
||||
OUTANALOG(m_OUT, TERMANALOG(m_R1.m_P), NLTIME_FROM_NS(100));
|
||||
m_RDIS.set_R(R_OFF);
|
||||
}
|
||||
else if (m_last_out && !out)
|
||||
{
|
||||
OUTANALOG(m_OUT, TERMANALOG(m_R3.m_N), NLTIME_FROM_NS(100));
|
||||
m_RDIS.set_R(R_ON);
|
||||
}
|
||||
m_last_out = out;
|
||||
if (!m_last_out && out)
|
||||
{
|
||||
OUTANALOG(m_OUT, TERMANALOG(m_R1.m_P), NLTIME_FROM_NS(100));
|
||||
m_RDIS.set_R(R_OFF);
|
||||
}
|
||||
else if (m_last_out && !out)
|
||||
{
|
||||
OUTANALOG(m_OUT, TERMANALOG(m_R3.m_N), NLTIME_FROM_NS(100));
|
||||
m_RDIS.set_R(R_ON);
|
||||
}
|
||||
m_last_out = out;
|
||||
}
|
||||
|
@ -23,22 +23,21 @@
|
||||
#include "nld_twoterm.h"
|
||||
|
||||
#define NETDEV_NE555(_name) \
|
||||
NET_REGISTER_DEV(NE555, _name) \
|
||||
|
||||
NET_REGISTER_DEV(NE555, _name)
|
||||
NETLIB_DEVICE(NE555,
|
||||
NETLIB_NAME(R) m_R1;
|
||||
NETLIB_NAME(R) m_R2;
|
||||
NETLIB_NAME(R) m_R3;
|
||||
NETLIB_NAME(R) m_RDIS;
|
||||
NETLIB_NAME(R) m_R1;
|
||||
NETLIB_NAME(R) m_R2;
|
||||
NETLIB_NAME(R) m_R3;
|
||||
NETLIB_NAME(R) m_RDIS;
|
||||
|
||||
netlist_logic_input_t m_RESET;
|
||||
netlist_analog_input_t m_THRES;
|
||||
netlist_analog_input_t m_TRIG;
|
||||
netlist_analog_output_t m_OUT;
|
||||
netlist_logic_input_t m_RESET;
|
||||
netlist_analog_input_t m_THRES;
|
||||
netlist_analog_input_t m_TRIG;
|
||||
netlist_analog_output_t m_OUT;
|
||||
|
||||
bool m_last_out;
|
||||
bool m_last_out;
|
||||
|
||||
double clamp(const double v, const double a, const double b);
|
||||
double clamp(const double v, const double a, const double b);
|
||||
|
||||
);
|
||||
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
{
|
||||
register_input(sIN[i], m_i[i]);
|
||||
}
|
||||
save(NAME(m_active));
|
||||
save(NAME(m_active));
|
||||
}
|
||||
|
||||
#if (USE_DEACTIVE_DEVICE)
|
||||
@ -167,7 +167,7 @@ public:
|
||||
{
|
||||
register_input(sIN[i], m_i[i], netlist_input_t::STATE_INP_ACTIVE);
|
||||
}
|
||||
save(NAME(m_active));
|
||||
save(NAME(m_active));
|
||||
}
|
||||
|
||||
#if (USE_DEACTIVE_DEVICE)
|
||||
|
@ -15,155 +15,155 @@
|
||||
|
||||
ATTR_COLD void netlist_matrix_solver_t::setup(netlist_net_t::list_t &nets, NETLIB_NAME(solver) &aowner)
|
||||
{
|
||||
m_owner = &aowner;
|
||||
for (netlist_net_t::list_t::entry_t *pn = nets.first(); pn != NULL; pn = nets.next(pn))
|
||||
{
|
||||
NL_VERBOSE_OUT(("setting up net\n"));
|
||||
m_owner = &aowner;
|
||||
for (netlist_net_t::list_t::entry_t *pn = nets.first(); pn != NULL; pn = nets.next(pn))
|
||||
{
|
||||
NL_VERBOSE_OUT(("setting up net\n"));
|
||||
|
||||
m_nets.add(pn->object());
|
||||
pn->object()->m_solver = this;
|
||||
m_nets.add(pn->object());
|
||||
pn->object()->m_solver = this;
|
||||
|
||||
for (netlist_core_terminal_t *p = pn->object()->m_head; p != NULL; p = p->m_update_list_next)
|
||||
{
|
||||
switch (p->type())
|
||||
{
|
||||
case netlist_terminal_t::TERMINAL:
|
||||
switch (p->netdev().family())
|
||||
{
|
||||
case netlist_device_t::CAPACITOR:
|
||||
if (!m_steps.contains(&p->netdev()))
|
||||
m_steps.add(&p->netdev());
|
||||
break;
|
||||
case netlist_device_t::DIODE:
|
||||
//case netlist_device_t::VCVS:
|
||||
//case netlist_device_t::BJT_SWITCH:
|
||||
if (!m_dynamic.contains(&p->netdev()))
|
||||
m_dynamic.add(&p->netdev());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
pn->object()->m_terms.add(static_cast<netlist_terminal_t *>(p));
|
||||
NL_VERBOSE_OUT(("Added terminal\n"));
|
||||
break;
|
||||
case netlist_terminal_t::INPUT:
|
||||
if (!m_inps.contains(&p->netdev()))
|
||||
m_inps.add(&p->netdev());
|
||||
NL_VERBOSE_OUT(("Added input\n"));
|
||||
break;
|
||||
default:
|
||||
owner().netlist().xfatalerror("unhandled element found\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (netlist_core_terminal_t *p = pn->object()->m_head; p != NULL; p = p->m_update_list_next)
|
||||
{
|
||||
switch (p->type())
|
||||
{
|
||||
case netlist_terminal_t::TERMINAL:
|
||||
switch (p->netdev().family())
|
||||
{
|
||||
case netlist_device_t::CAPACITOR:
|
||||
if (!m_steps.contains(&p->netdev()))
|
||||
m_steps.add(&p->netdev());
|
||||
break;
|
||||
case netlist_device_t::DIODE:
|
||||
//case netlist_device_t::VCVS:
|
||||
//case netlist_device_t::BJT_SWITCH:
|
||||
if (!m_dynamic.contains(&p->netdev()))
|
||||
m_dynamic.add(&p->netdev());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
pn->object()->m_terms.add(static_cast<netlist_terminal_t *>(p));
|
||||
NL_VERBOSE_OUT(("Added terminal\n"));
|
||||
break;
|
||||
case netlist_terminal_t::INPUT:
|
||||
if (!m_inps.contains(&p->netdev()))
|
||||
m_inps.add(&p->netdev());
|
||||
NL_VERBOSE_OUT(("Added input\n"));
|
||||
break;
|
||||
default:
|
||||
owner().netlist().xfatalerror("unhandled element found\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ATTR_HOT inline void netlist_matrix_solver_t::step(const netlist_time delta)
|
||||
{
|
||||
const double dd = delta.as_double();
|
||||
for (dev_list_t::entry_t *p = m_steps.first(); p != NULL; p = m_steps.next(p))
|
||||
p->object()->step_time(dd);
|
||||
const double dd = delta.as_double();
|
||||
for (dev_list_t::entry_t *p = m_steps.first(); p != NULL; p = m_steps.next(p))
|
||||
p->object()->step_time(dd);
|
||||
}
|
||||
|
||||
ATTR_HOT inline void netlist_matrix_solver_t::update_inputs()
|
||||
{
|
||||
for (dev_list_t::entry_t *p = m_inps.first(); p != NULL; p = m_inps.next(p))
|
||||
p->object()->update_dev();
|
||||
for (dev_list_t::entry_t *p = m_inps.first(); p != NULL; p = m_inps.next(p))
|
||||
p->object()->update_dev();
|
||||
}
|
||||
|
||||
|
||||
ATTR_HOT inline bool netlist_matrix_solver_t::solve()
|
||||
{
|
||||
bool resched = false;
|
||||
bool resched = false;
|
||||
|
||||
/* update all non-linear devices */
|
||||
for (dev_list_t::entry_t *p = m_dynamic.first(); p != NULL; p = m_dynamic.next(p))
|
||||
switch (p->object()->family())
|
||||
{
|
||||
case netlist_device_t::DIODE:
|
||||
static_cast<NETLIB_NAME(D) *>(p->object())->update_terminals();
|
||||
break;
|
||||
default:
|
||||
p->object()->update_terminals();
|
||||
break;
|
||||
}
|
||||
/* update all non-linear devices */
|
||||
for (dev_list_t::entry_t *p = m_dynamic.first(); p != NULL; p = m_dynamic.next(p))
|
||||
switch (p->object()->family())
|
||||
{
|
||||
case netlist_device_t::DIODE:
|
||||
static_cast<NETLIB_NAME(D) *>(p->object())->update_terminals();
|
||||
break;
|
||||
default:
|
||||
p->object()->update_terminals();
|
||||
break;
|
||||
}
|
||||
|
||||
for (netlist_net_t::list_t::entry_t *pn = m_nets.first(); pn != NULL; pn = m_nets.next(pn))
|
||||
{
|
||||
netlist_net_t *net = pn->object();
|
||||
for (netlist_net_t::list_t::entry_t *pn = m_nets.first(); pn != NULL; pn = m_nets.next(pn))
|
||||
{
|
||||
netlist_net_t *net = pn->object();
|
||||
|
||||
double gtot = 0;
|
||||
double gabs = 0;
|
||||
double iIdr = 0;
|
||||
const netlist_net_t::terminal_list_t &terms = net->m_terms;
|
||||
double gtot = 0;
|
||||
double gabs = 0;
|
||||
double iIdr = 0;
|
||||
const netlist_net_t::terminal_list_t &terms = net->m_terms;
|
||||
#if 1
|
||||
switch (terms.count())
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
const netlist_terminal_t *pt = terms.first()->object();
|
||||
gtot = pt->m_gt;
|
||||
gabs = fabs(pt->m_go);
|
||||
iIdr = pt->m_Idr + pt->m_go * pt->m_otherterm->net().Q_Analog();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
const netlist_terminal_t *pt1 = terms[0];
|
||||
const netlist_terminal_t *pt2 = terms[1];
|
||||
gtot = pt1->m_gt + pt2->m_gt;
|
||||
gabs = fabs(pt1->m_go) + fabs(pt2->m_go);
|
||||
iIdr = pt1->m_Idr + pt1->m_go * pt1->m_otherterm->net().Q_Analog()
|
||||
+ pt2->m_Idr + pt2->m_go * pt2->m_otherterm->net().Q_Analog();
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
const netlist_terminal_t *pt1 = terms[0];
|
||||
const netlist_terminal_t *pt2 = terms[1];
|
||||
const netlist_terminal_t *pt3 = terms[2];
|
||||
gtot = pt1->m_gt + pt2->m_gt + pt3->m_gt;
|
||||
gabs = fabs(pt1->m_go) + fabs(pt2->m_go) + fabs(pt3->m_go);
|
||||
iIdr = pt1->m_Idr + pt1->m_go * pt1->m_otherterm->net().Q_Analog()
|
||||
+ pt2->m_Idr + pt2->m_go * pt2->m_otherterm->net().Q_Analog()
|
||||
+ pt3->m_Idr + pt3->m_go * pt3->m_otherterm->net().Q_Analog();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
for (netlist_net_t::terminal_list_t::entry_t *e = terms.first(); e != NULL; e = terms.next(e))
|
||||
{
|
||||
netlist_terminal_t *pt = e->object();
|
||||
gtot += pt->m_gt;
|
||||
gabs += fabs(pt->m_go);
|
||||
iIdr += pt->m_Idr + pt->m_go * pt->m_otherterm->net().Q_Analog();
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (terms.count())
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
const netlist_terminal_t *pt = terms.first()->object();
|
||||
gtot = pt->m_gt;
|
||||
gabs = fabs(pt->m_go);
|
||||
iIdr = pt->m_Idr + pt->m_go * pt->m_otherterm->net().Q_Analog();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
const netlist_terminal_t *pt1 = terms[0];
|
||||
const netlist_terminal_t *pt2 = terms[1];
|
||||
gtot = pt1->m_gt + pt2->m_gt;
|
||||
gabs = fabs(pt1->m_go) + fabs(pt2->m_go);
|
||||
iIdr = pt1->m_Idr + pt1->m_go * pt1->m_otherterm->net().Q_Analog()
|
||||
+ pt2->m_Idr + pt2->m_go * pt2->m_otherterm->net().Q_Analog();
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
const netlist_terminal_t *pt1 = terms[0];
|
||||
const netlist_terminal_t *pt2 = terms[1];
|
||||
const netlist_terminal_t *pt3 = terms[2];
|
||||
gtot = pt1->m_gt + pt2->m_gt + pt3->m_gt;
|
||||
gabs = fabs(pt1->m_go) + fabs(pt2->m_go) + fabs(pt3->m_go);
|
||||
iIdr = pt1->m_Idr + pt1->m_go * pt1->m_otherterm->net().Q_Analog()
|
||||
+ pt2->m_Idr + pt2->m_go * pt2->m_otherterm->net().Q_Analog()
|
||||
+ pt3->m_Idr + pt3->m_go * pt3->m_otherterm->net().Q_Analog();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
for (netlist_net_t::terminal_list_t::entry_t *e = terms.first(); e != NULL; e = terms.next(e))
|
||||
{
|
||||
netlist_terminal_t *pt = e->object();
|
||||
gtot += pt->m_gt;
|
||||
gabs += fabs(pt->m_go);
|
||||
iIdr += pt->m_Idr + pt->m_go * pt->m_otherterm->net().Q_Analog();
|
||||
}
|
||||
break;
|
||||
}
|
||||
#else
|
||||
for (netlist_net_t::terminal_list_t::entry_t *e = terms.first(); e != NULL; e = terms.next(e))
|
||||
{
|
||||
netlist_terminal_t *pt = e->object();
|
||||
gtot += pt->m_gt;
|
||||
gabs += fabs(pt->m_go);
|
||||
iIdr += pt->m_Idr + pt->m_go * pt->m_otherterm->net().Q_Analog();
|
||||
}
|
||||
for (netlist_net_t::terminal_list_t::entry_t *e = terms.first(); e != NULL; e = terms.next(e))
|
||||
{
|
||||
netlist_terminal_t *pt = e->object();
|
||||
gtot += pt->m_gt;
|
||||
gabs += fabs(pt->m_go);
|
||||
iIdr += pt->m_Idr + pt->m_go * pt->m_otherterm->net().Q_Analog();
|
||||
}
|
||||
#endif
|
||||
double new_val;
|
||||
gabs *= m_convergence_factor;
|
||||
if (gabs > gtot)
|
||||
new_val = (net->m_cur.Analog * gabs + iIdr) / (gtot + gabs);
|
||||
else
|
||||
new_val = iIdr / gtot;
|
||||
double new_val;
|
||||
gabs *= m_convergence_factor;
|
||||
if (gabs > gtot)
|
||||
new_val = (net->m_cur.Analog * gabs + iIdr) / (gtot + gabs);
|
||||
else
|
||||
new_val = iIdr / gtot;
|
||||
|
||||
if (fabs(new_val - net->m_cur.Analog) > m_accuracy)
|
||||
resched = true;
|
||||
net->m_cur.Analog = net->m_new.Analog = new_val;
|
||||
if (fabs(new_val - net->m_cur.Analog) > m_accuracy)
|
||||
resched = true;
|
||||
net->m_cur.Analog = net->m_new.Analog = new_val;
|
||||
|
||||
NL_VERBOSE_OUT(("Info: %d\n", pn->object()->m_num_cons));
|
||||
//NL_VERBOSE_OUT(("New: %lld %f %f\n", netlist().time().as_raw(), netlist().time().as_double(), new_val));
|
||||
}
|
||||
return resched;
|
||||
NL_VERBOSE_OUT(("Info: %d\n", pn->object()->m_num_cons));
|
||||
//NL_VERBOSE_OUT(("New: %lld %f %f\n", netlist().time().as_raw(), netlist().time().as_double(), new_val));
|
||||
}
|
||||
return resched;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -174,160 +174,159 @@ typedef netlist_net_t::list_t *net_groups_t;
|
||||
|
||||
static bool already_processed(net_groups_t groups, int &cur_group, netlist_net_t *net)
|
||||
{
|
||||
if (net->isRailNet())
|
||||
return true;
|
||||
for (int i = 0; i <= cur_group; i++)
|
||||
{
|
||||
if (groups[i].contains(net))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if (net->isRailNet())
|
||||
return true;
|
||||
for (int i = 0; i <= cur_group; i++)
|
||||
{
|
||||
if (groups[i].contains(net))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void process_net(net_groups_t groups, int &cur_group, netlist_net_t *net)
|
||||
{
|
||||
/* add the net */
|
||||
if (net->m_head == NULL)
|
||||
return;
|
||||
groups[cur_group].add(net);
|
||||
for (netlist_core_terminal_t *p = net->m_head; p != NULL; p = p->m_update_list_next)
|
||||
{
|
||||
if (p->isType(netlist_terminal_t::TERMINAL))
|
||||
{
|
||||
netlist_terminal_t *pt = static_cast<netlist_terminal_t *>(p);
|
||||
netlist_net_t *nnet = &pt->m_otherterm->net();
|
||||
if (!already_processed(groups, cur_group, nnet))
|
||||
process_net(groups, cur_group, nnet);
|
||||
}
|
||||
}
|
||||
/* add the net */
|
||||
if (net->m_head == NULL)
|
||||
return;
|
||||
groups[cur_group].add(net);
|
||||
for (netlist_core_terminal_t *p = net->m_head; p != NULL; p = p->m_update_list_next)
|
||||
{
|
||||
if (p->isType(netlist_terminal_t::TERMINAL))
|
||||
{
|
||||
netlist_terminal_t *pt = static_cast<netlist_terminal_t *>(p);
|
||||
netlist_net_t *nnet = &pt->m_otherterm->net();
|
||||
if (!already_processed(groups, cur_group, nnet))
|
||||
process_net(groups, cur_group, nnet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NETLIB_START(solver)
|
||||
{
|
||||
register_output("Q_sync", m_Q_sync);
|
||||
register_output("Q_step", m_Q_step);
|
||||
//register_input("FB", m_feedback);
|
||||
register_output("Q_sync", m_Q_sync);
|
||||
register_output("Q_step", m_Q_step);
|
||||
//register_input("FB", m_feedback);
|
||||
|
||||
register_param("SYNC_DELAY", m_sync_delay, NLTIME_FROM_NS(10).as_double());
|
||||
m_nt_sync_delay = m_sync_delay.Value();
|
||||
register_param("SYNC_DELAY", m_sync_delay, NLTIME_FROM_NS(10).as_double());
|
||||
m_nt_sync_delay = m_sync_delay.Value();
|
||||
|
||||
register_param("FREQ", m_freq, 48000.0);
|
||||
m_inc = netlist_time::from_hz(m_freq.Value());
|
||||
register_param("FREQ", m_freq, 48000.0);
|
||||
m_inc = netlist_time::from_hz(m_freq.Value());
|
||||
|
||||
register_param("ACCURACY", m_accuracy, 1e-3);
|
||||
register_param("CONVERG", m_convergence, 0.3);
|
||||
register_param("ACCURACY", m_accuracy, 1e-3);
|
||||
register_param("CONVERG", m_convergence, 0.3);
|
||||
|
||||
// internal staff
|
||||
// internal staff
|
||||
|
||||
register_input("FB_sync", m_fb_sync, netlist_input_t::STATE_INP_ACTIVE);
|
||||
register_input("FB_step", m_fb_step, netlist_input_t::STATE_INP_ACTIVE);
|
||||
register_input("FB_sync", m_fb_sync, netlist_input_t::STATE_INP_ACTIVE);
|
||||
register_input("FB_step", m_fb_step, netlist_input_t::STATE_INP_ACTIVE);
|
||||
|
||||
setup().connect(m_fb_sync, m_Q_sync);
|
||||
setup().connect(m_fb_step, m_Q_step);
|
||||
setup().connect(m_fb_sync, m_Q_sync);
|
||||
setup().connect(m_fb_step, m_Q_step);
|
||||
|
||||
m_last_step = netlist_time::zero;
|
||||
m_last_step = netlist_time::zero;
|
||||
|
||||
save(NAME(m_last_step));
|
||||
save(NAME(m_last_step));
|
||||
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(solver)
|
||||
{
|
||||
m_inc = netlist_time::from_hz(m_freq.Value());
|
||||
m_inc = netlist_time::from_hz(m_freq.Value());
|
||||
}
|
||||
|
||||
NETLIB_NAME(solver)::~NETLIB_NAME(solver)()
|
||||
{
|
||||
netlist_matrix_solver_t::list_t::entry_t *e = m_mat_solvers.first();
|
||||
while (e != NULL)
|
||||
{
|
||||
netlist_matrix_solver_t::list_t::entry_t *en = m_mat_solvers.next(e);
|
||||
delete e->object();
|
||||
e = en;
|
||||
}
|
||||
netlist_matrix_solver_t::list_t::entry_t *e = m_mat_solvers.first();
|
||||
while (e != NULL)
|
||||
{
|
||||
netlist_matrix_solver_t::list_t::entry_t *en = m_mat_solvers.next(e);
|
||||
delete e->object();
|
||||
e = en;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NETLIB_FUNC_VOID(solver, post_start, ())
|
||||
{
|
||||
netlist_net_t::list_t groups[100];
|
||||
int cur_group = -1;
|
||||
netlist_net_t::list_t groups[100];
|
||||
int cur_group = -1;
|
||||
|
||||
SOLVER_VERBOSE_OUT(("Scanning net groups ...\n"));
|
||||
// determine net groups
|
||||
for (netlist_net_t::list_t::entry_t *pn = netlist().m_nets.first(); pn != NULL; pn = netlist().m_nets.next(pn))
|
||||
{
|
||||
if (!already_processed(groups, cur_group, pn->object()))
|
||||
{
|
||||
cur_group++;
|
||||
process_net(groups, cur_group, pn->object());
|
||||
}
|
||||
}
|
||||
SOLVER_VERBOSE_OUT(("Scanning net groups ...\n"));
|
||||
// determine net groups
|
||||
for (netlist_net_t::list_t::entry_t *pn = netlist().m_nets.first(); pn != NULL; pn = netlist().m_nets.next(pn))
|
||||
{
|
||||
if (!already_processed(groups, cur_group, pn->object()))
|
||||
{
|
||||
cur_group++;
|
||||
process_net(groups, cur_group, pn->object());
|
||||
}
|
||||
}
|
||||
|
||||
// setup the solvers
|
||||
SOLVER_VERBOSE_OUT(("Found %d net groups in %d nets\n", cur_group + 1, m_nets.count()));
|
||||
for (int i = 0; i <= cur_group; i++)
|
||||
{
|
||||
netlist_matrix_solver_t *ms = new netlist_matrix_solver_t();
|
||||
ms->m_accuracy = m_accuracy.Value();
|
||||
ms->m_convergence_factor = m_convergence.Value();
|
||||
ms->setup(groups[i], *this);
|
||||
m_mat_solvers.add(ms);
|
||||
SOLVER_VERBOSE_OUT(("%d ==> %d nets %s\n", i, groups[i].count(), groups[i].first()->object()->m_head->name().cstr()));
|
||||
SOLVER_VERBOSE_OUT((" has %s elements\n", ms->is_dynamic() ? "dynamic" : "no dynamic"));
|
||||
}
|
||||
// setup the solvers
|
||||
SOLVER_VERBOSE_OUT(("Found %d net groups in %d nets\n", cur_group + 1, m_nets.count()));
|
||||
for (int i = 0; i <= cur_group; i++)
|
||||
{
|
||||
netlist_matrix_solver_t *ms = new netlist_matrix_solver_t();
|
||||
ms->m_accuracy = m_accuracy.Value();
|
||||
ms->m_convergence_factor = m_convergence.Value();
|
||||
ms->setup(groups[i], *this);
|
||||
m_mat_solvers.add(ms);
|
||||
SOLVER_VERBOSE_OUT(("%d ==> %d nets %s\n", i, groups[i].count(), groups[i].first()->object()->m_head->name().cstr()));
|
||||
SOLVER_VERBOSE_OUT((" has %s elements\n", ms->is_dynamic() ? "dynamic" : "no dynamic"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(solver)
|
||||
{
|
||||
//m_Q.setToNoCheck(!m_Q.new_Q(), m_inc );
|
||||
//OUTLOGIC(m_Q, !m_Q.net().new_Q(), m_inc );
|
||||
//m_Q.setToNoCheck(!m_Q.new_Q(), m_inc );
|
||||
//OUTLOGIC(m_Q, !m_Q.net().new_Q(), m_inc );
|
||||
|
||||
bool resched = false;
|
||||
int resched_cnt = 0;
|
||||
netlist_time now = netlist().time();
|
||||
netlist_time delta = now - m_last_step;
|
||||
bool resched = false;
|
||||
int resched_cnt = 0;
|
||||
netlist_time now = netlist().time();
|
||||
netlist_time delta = now - m_last_step;
|
||||
|
||||
if (delta >= m_inc)
|
||||
{
|
||||
NL_VERBOSE_OUT(("Step!\n"));
|
||||
/* update all terminals for new time step */
|
||||
m_last_step = now;
|
||||
for (netlist_matrix_solver_t::list_t::entry_t *e = m_mat_solvers.first(); e != NULL; e = m_mat_solvers.next(e))
|
||||
{
|
||||
e->object()->step(delta);
|
||||
}
|
||||
}
|
||||
bool global_resched = false;
|
||||
for (netlist_matrix_solver_t::list_t::entry_t *e = m_mat_solvers.first(); e != NULL; e = m_mat_solvers.next(e))
|
||||
{
|
||||
resched_cnt = (e->object()->is_dynamic() ? 0 : 1);
|
||||
do {
|
||||
resched = e->object()->solve();
|
||||
resched_cnt++;
|
||||
} while ((resched && (resched_cnt < 5)) || (resched_cnt <= 1));
|
||||
global_resched = global_resched || resched;
|
||||
}
|
||||
//if (global_resched)
|
||||
// printf("rescheduled\n");
|
||||
if (global_resched)
|
||||
{
|
||||
schedule();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* update all inputs connected */
|
||||
for (netlist_matrix_solver_t::list_t::entry_t *e = m_mat_solvers.first(); e != NULL; e = m_mat_solvers.next(e))
|
||||
{
|
||||
e->object()->update_inputs();
|
||||
}
|
||||
if (delta >= m_inc)
|
||||
{
|
||||
NL_VERBOSE_OUT(("Step!\n"));
|
||||
/* update all terminals for new time step */
|
||||
m_last_step = now;
|
||||
for (netlist_matrix_solver_t::list_t::entry_t *e = m_mat_solvers.first(); e != NULL; e = m_mat_solvers.next(e))
|
||||
{
|
||||
e->object()->step(delta);
|
||||
}
|
||||
}
|
||||
bool global_resched = false;
|
||||
for (netlist_matrix_solver_t::list_t::entry_t *e = m_mat_solvers.first(); e != NULL; e = m_mat_solvers.next(e))
|
||||
{
|
||||
resched_cnt = (e->object()->is_dynamic() ? 0 : 1);
|
||||
do {
|
||||
resched = e->object()->solve();
|
||||
resched_cnt++;
|
||||
} while ((resched && (resched_cnt < 5)) || (resched_cnt <= 1));
|
||||
global_resched = global_resched || resched;
|
||||
}
|
||||
//if (global_resched)
|
||||
// printf("rescheduled\n");
|
||||
if (global_resched)
|
||||
{
|
||||
schedule();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* update all inputs connected */
|
||||
for (netlist_matrix_solver_t::list_t::entry_t *e = m_mat_solvers.first(); e != NULL; e = m_mat_solvers.next(e))
|
||||
{
|
||||
e->object()->update_inputs();
|
||||
}
|
||||
|
||||
/* step circuit */
|
||||
if (!m_Q_step.net().is_queued())
|
||||
m_Q_step.net().push_to_queue(m_inc);
|
||||
}
|
||||
/* step circuit */
|
||||
if (!m_Q_step.net().is_queued())
|
||||
m_Q_step.net().push_to_queue(m_inc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
#define NETDEV_SOLVER(_name) \
|
||||
NET_REGISTER_DEV(solver, _name)
|
||||
NET_REGISTER_DEV(solver, _name)
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// solver
|
||||
@ -25,70 +25,70 @@ class NETLIB_NAME(solver);
|
||||
class netlist_matrix_solver_t
|
||||
{
|
||||
public:
|
||||
typedef netlist_list_t<netlist_matrix_solver_t *> list_t;
|
||||
typedef netlist_core_device_t::list_t dev_list_t;
|
||||
typedef netlist_list_t<netlist_matrix_solver_t *> list_t;
|
||||
typedef netlist_core_device_t::list_t dev_list_t;
|
||||
|
||||
ATTR_COLD void setup(netlist_net_t::list_t &nets, NETLIB_NAME(solver) &owner);
|
||||
ATTR_COLD void setup(netlist_net_t::list_t &nets, NETLIB_NAME(solver) &owner);
|
||||
|
||||
// return true if a reschedule is needed ...
|
||||
ATTR_HOT bool solve();
|
||||
ATTR_HOT void step(const netlist_time delta);
|
||||
ATTR_HOT void update_inputs();
|
||||
// return true if a reschedule is needed ...
|
||||
ATTR_HOT bool solve();
|
||||
ATTR_HOT void step(const netlist_time delta);
|
||||
ATTR_HOT void update_inputs();
|
||||
|
||||
ATTR_HOT inline bool is_dynamic() { return m_dynamic.count() > 0; }
|
||||
ATTR_HOT inline bool is_dynamic() { return m_dynamic.count() > 0; }
|
||||
|
||||
inline const NETLIB_NAME(solver) &owner() const;
|
||||
inline const NETLIB_NAME(solver) &owner() const;
|
||||
|
||||
double m_accuracy;
|
||||
double m_convergence_factor;
|
||||
double m_accuracy;
|
||||
double m_convergence_factor;
|
||||
|
||||
private:
|
||||
netlist_net_t::list_t m_nets;
|
||||
dev_list_t m_dynamic;
|
||||
dev_list_t m_inps;
|
||||
dev_list_t m_steps;
|
||||
netlist_net_t::list_t m_nets;
|
||||
dev_list_t m_dynamic;
|
||||
dev_list_t m_inps;
|
||||
dev_list_t m_steps;
|
||||
|
||||
NETLIB_NAME(solver) *m_owner;
|
||||
NETLIB_NAME(solver) *m_owner;
|
||||
};
|
||||
|
||||
NETLIB_DEVICE_WITH_PARAMS(solver,
|
||||
typedef netlist_core_device_t::list_t dev_list_t;
|
||||
typedef netlist_core_device_t::list_t dev_list_t;
|
||||
|
||||
netlist_ttl_input_t m_fb_sync;
|
||||
netlist_ttl_output_t m_Q_sync;
|
||||
netlist_ttl_input_t m_fb_sync;
|
||||
netlist_ttl_output_t m_Q_sync;
|
||||
|
||||
netlist_ttl_input_t m_fb_step;
|
||||
netlist_ttl_output_t m_Q_step;
|
||||
netlist_ttl_input_t m_fb_step;
|
||||
netlist_ttl_output_t m_Q_step;
|
||||
|
||||
netlist_param_double_t m_freq;
|
||||
netlist_param_double_t m_sync_delay;
|
||||
netlist_param_double_t m_accuracy;
|
||||
netlist_param_double_t m_convergence;
|
||||
netlist_param_double_t m_freq;
|
||||
netlist_param_double_t m_sync_delay;
|
||||
netlist_param_double_t m_accuracy;
|
||||
netlist_param_double_t m_convergence;
|
||||
|
||||
netlist_time m_inc;
|
||||
netlist_time m_last_step;
|
||||
netlist_time m_nt_sync_delay;
|
||||
netlist_time m_inc;
|
||||
netlist_time m_last_step;
|
||||
netlist_time m_nt_sync_delay;
|
||||
|
||||
netlist_matrix_solver_t::list_t m_mat_solvers;
|
||||
netlist_matrix_solver_t::list_t m_mat_solvers;
|
||||
public:
|
||||
|
||||
~NETLIB_NAME(solver)();
|
||||
~NETLIB_NAME(solver)();
|
||||
|
||||
ATTR_HOT inline void schedule();
|
||||
ATTR_HOT inline void schedule();
|
||||
|
||||
ATTR_COLD void post_start();
|
||||
ATTR_COLD void post_start();
|
||||
);
|
||||
|
||||
inline void NETLIB_NAME(solver)::schedule()
|
||||
{
|
||||
// FIXME: time should be parameter;
|
||||
if (!m_Q_sync.net().is_queued())
|
||||
m_Q_sync.net().push_to_queue(m_nt_sync_delay);
|
||||
// FIXME: time should be parameter;
|
||||
if (!m_Q_sync.net().is_queued())
|
||||
m_Q_sync.net().push_to_queue(m_nt_sync_delay);
|
||||
}
|
||||
|
||||
inline const NETLIB_NAME(solver) &netlist_matrix_solver_t::owner() const
|
||||
{
|
||||
return *m_owner;
|
||||
return *m_owner;
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
NETLIB_START(ttl_const)
|
||||
{
|
||||
register_output("Q", m_Q);
|
||||
register_param("CONST", m_const, 0);
|
||||
register_output("Q", m_Q);
|
||||
register_param("CONST", m_const, 0);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(ttl_const)
|
||||
@ -22,13 +22,13 @@ NETLIB_UPDATE(ttl_const)
|
||||
|
||||
NETLIB_UPDATE_PARAM(ttl_const)
|
||||
{
|
||||
OUTLOGIC(m_Q, m_const.Value(), NLTIME_IMMEDIATE);
|
||||
OUTLOGIC(m_Q, m_const.Value(), NLTIME_IMMEDIATE);
|
||||
}
|
||||
|
||||
NETLIB_START(analog_const)
|
||||
{
|
||||
register_output("Q", m_Q);
|
||||
register_param("CONST", m_const, 0.0);
|
||||
register_output("Q", m_Q);
|
||||
register_param("CONST", m_const, 0.0);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(analog_const)
|
||||
@ -37,7 +37,7 @@ NETLIB_UPDATE(analog_const)
|
||||
|
||||
NETLIB_UPDATE_PARAM(analog_const)
|
||||
{
|
||||
m_Q.initial(m_const.Value());
|
||||
m_Q.initial(m_const.Value());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -46,24 +46,24 @@ NETLIB_UPDATE_PARAM(analog_const)
|
||||
|
||||
NETLIB_START(clock)
|
||||
{
|
||||
register_output("Q", m_Q);
|
||||
//register_input("FB", m_feedback);
|
||||
register_output("Q", m_Q);
|
||||
//register_input("FB", m_feedback);
|
||||
|
||||
register_param("FREQ", m_freq, 7159000.0 * 5.0);
|
||||
m_inc = netlist_time::from_hz(m_freq.Value()*2);
|
||||
register_param("FREQ", m_freq, 7159000.0 * 5.0);
|
||||
m_inc = netlist_time::from_hz(m_freq.Value()*2);
|
||||
|
||||
register_link_internal(m_feedback, m_Q, netlist_input_t::STATE_INP_ACTIVE);
|
||||
register_link_internal(m_feedback, m_Q, netlist_input_t::STATE_INP_ACTIVE);
|
||||
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(clock)
|
||||
{
|
||||
m_inc = netlist_time::from_hz(m_freq.Value()*2);
|
||||
m_inc = netlist_time::from_hz(m_freq.Value()*2);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(clock)
|
||||
{
|
||||
OUTLOGIC(m_Q, !m_Q.net().new_Q(), m_inc );
|
||||
OUTLOGIC(m_Q, !m_Q.net().new_Q(), m_inc );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -72,7 +72,7 @@ NETLIB_UPDATE(clock)
|
||||
|
||||
NETLIB_START(logic_input)
|
||||
{
|
||||
register_output("Q", m_Q);
|
||||
register_output("Q", m_Q);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(logic_input)
|
||||
@ -85,7 +85,7 @@ NETLIB_UPDATE(logic_input)
|
||||
|
||||
NETLIB_START(analog_input)
|
||||
{
|
||||
register_output("Q", m_Q);
|
||||
register_output("Q", m_Q);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(analog_input)
|
||||
|
@ -25,16 +25,16 @@
|
||||
NETDEV_PARAM(_name.CONST, _v)
|
||||
|
||||
#define NETDEV_MAINCLOCK(_name) \
|
||||
NET_REGISTER_DEV(mainclock, _name)
|
||||
NET_REGISTER_DEV(mainclock, _name)
|
||||
|
||||
#define NETDEV_CLOCK(_name) \
|
||||
NET_REGISTER_DEV(clock, _name)
|
||||
NET_REGISTER_DEV(clock, _name)
|
||||
|
||||
#define NETDEV_LOGIC_INPUT(_name) \
|
||||
NET_REGISTER_DEV(logic_input, _name)
|
||||
NET_REGISTER_DEV(logic_input, _name)
|
||||
|
||||
#define NETDEV_ANALOG_INPUT(_name) \
|
||||
NET_REGISTER_DEV(analog_input, _name)
|
||||
NET_REGISTER_DEV(analog_input, _name)
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// netdev_*_const
|
||||
@ -56,7 +56,7 @@ NETLIB_DEVICE_WITH_PARAMS(analog_const,
|
||||
|
||||
NETLIB_DEVICE_WITH_PARAMS(mainclock,
|
||||
public:
|
||||
netlist_ttl_output_t m_Q;
|
||||
netlist_ttl_output_t m_Q;
|
||||
|
||||
netlist_param_double_t m_freq;
|
||||
netlist_time m_inc;
|
||||
@ -69,11 +69,11 @@ public:
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
NETLIB_DEVICE_WITH_PARAMS(clock,
|
||||
netlist_ttl_input_t m_feedback;
|
||||
netlist_ttl_output_t m_Q;
|
||||
netlist_ttl_input_t m_feedback;
|
||||
netlist_ttl_output_t m_Q;
|
||||
|
||||
netlist_param_double_t m_freq;
|
||||
netlist_time m_inc;
|
||||
netlist_param_double_t m_freq;
|
||||
netlist_time m_inc;
|
||||
);
|
||||
|
||||
|
||||
@ -82,11 +82,11 @@ NETLIB_DEVICE_WITH_PARAMS(clock,
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
NETLIB_DEVICE(logic_input,
|
||||
netlist_ttl_output_t m_Q;
|
||||
netlist_ttl_output_t m_Q;
|
||||
);
|
||||
|
||||
NETLIB_DEVICE(analog_input,
|
||||
netlist_analog_output_t m_Q;
|
||||
netlist_analog_output_t m_Q;
|
||||
);
|
||||
|
||||
|
||||
|
@ -12,10 +12,10 @@
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
ATTR_COLD NETLIB_NAME(twoterm)::NETLIB_NAME(twoterm)(const family_t afamily) :
|
||||
netlist_device_t(afamily)
|
||||
netlist_device_t(afamily)
|
||||
{
|
||||
m_P.m_otherterm = &m_N;
|
||||
m_N.m_otherterm = &m_P;
|
||||
m_P.m_otherterm = &m_N;
|
||||
m_N.m_otherterm = &m_P;
|
||||
}
|
||||
|
||||
NETLIB_START(twoterm)
|
||||
@ -24,8 +24,8 @@ NETLIB_START(twoterm)
|
||||
|
||||
NETLIB_UPDATE(twoterm)
|
||||
{
|
||||
/* only called if connected to a rail net ==> notify the solver to recalculate */
|
||||
netlist().solver()->schedule();
|
||||
/* only called if connected to a rail net ==> notify the solver to recalculate */
|
||||
netlist().solver()->schedule();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -34,29 +34,29 @@ NETLIB_UPDATE(twoterm)
|
||||
|
||||
NETLIB_START(R_base)
|
||||
{
|
||||
register_terminal("1", m_P);
|
||||
register_terminal("2", m_N);
|
||||
register_terminal("1", m_P);
|
||||
register_terminal("2", m_N);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(R_base)
|
||||
{
|
||||
NETLIB_NAME(twoterm)::update();
|
||||
NETLIB_NAME(twoterm)::update();
|
||||
}
|
||||
|
||||
NETLIB_START(R)
|
||||
{
|
||||
NETLIB_NAME(R_base)::start();
|
||||
register_param("R", m_R, 1.0 / NETLIST_GMIN);
|
||||
NETLIB_NAME(R_base)::start();
|
||||
register_param("R", m_R, 1.0 / NETLIST_GMIN);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(R)
|
||||
{
|
||||
NETLIB_NAME(twoterm)::update();
|
||||
NETLIB_NAME(twoterm)::update();
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(R)
|
||||
{
|
||||
set_R(m_R.Value());
|
||||
set_R(m_R.Value());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -65,30 +65,30 @@ NETLIB_UPDATE_PARAM(R)
|
||||
|
||||
NETLIB_START(POT)
|
||||
{
|
||||
register_sub(m_R1, "R1");
|
||||
register_sub(m_R2, "R2");
|
||||
register_sub(m_R1, "R1");
|
||||
register_sub(m_R2, "R2");
|
||||
|
||||
register_subalias("1", m_R1.m_P);
|
||||
register_subalias("2", m_R1.m_N);
|
||||
register_subalias("3", m_R2.m_N);
|
||||
register_subalias("1", m_R1.m_P);
|
||||
register_subalias("2", m_R1.m_N);
|
||||
register_subalias("3", m_R2.m_N);
|
||||
|
||||
setup().connect(m_R2.m_P, m_R1.m_N);
|
||||
setup().connect(m_R2.m_P, m_R1.m_N);
|
||||
|
||||
register_param("R", m_R, 1.0 / NETLIST_GMIN);
|
||||
register_param("DIAL", m_Dial, 0.5);
|
||||
register_param("R", m_R, 1.0 / NETLIST_GMIN);
|
||||
register_param("DIAL", m_Dial, 0.5);
|
||||
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(POT)
|
||||
{
|
||||
m_R1.update_dev();
|
||||
m_R2.update_dev();
|
||||
m_R1.update_dev();
|
||||
m_R2.update_dev();
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(POT)
|
||||
{
|
||||
m_R1.set_R(MAX(m_R.Value() * m_Dial.Value(), NETLIST_GMIN));
|
||||
m_R2.set_R(MAX(m_R.Value() * (1.0 - m_Dial.Value()), NETLIST_GMIN));
|
||||
m_R1.set_R(MAX(m_R.Value() * m_Dial.Value(), NETLIST_GMIN));
|
||||
m_R2.set_R(MAX(m_R.Value() * (1.0 - m_Dial.Value()), NETLIST_GMIN));
|
||||
}
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// nld_C
|
||||
@ -96,21 +96,21 @@ NETLIB_UPDATE_PARAM(POT)
|
||||
|
||||
NETLIB_START(C)
|
||||
{
|
||||
register_terminal("1", m_P);
|
||||
register_terminal("2", m_N);
|
||||
register_terminal("1", m_P);
|
||||
register_terminal("2", m_N);
|
||||
|
||||
register_param("C", m_C, 1e-6);
|
||||
register_param("C", m_C, 1e-6);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(C)
|
||||
{
|
||||
// set to some very small step time for now
|
||||
step_time(1e-9);
|
||||
// set to some very small step time for now
|
||||
step_time(1e-9);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(C)
|
||||
{
|
||||
NETLIB_NAME(twoterm)::update();
|
||||
NETLIB_NAME(twoterm)::update();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -119,59 +119,59 @@ NETLIB_UPDATE(C)
|
||||
|
||||
NETLIB_START(D)
|
||||
{
|
||||
register_terminal("A", m_P);
|
||||
register_terminal("K", m_N);
|
||||
register_param("model", m_model, "");
|
||||
register_terminal("A", m_P);
|
||||
register_terminal("K", m_N);
|
||||
register_param("model", m_model, "");
|
||||
|
||||
m_Vd = 0.7;
|
||||
m_Vd = 0.7;
|
||||
|
||||
save(NAME(m_Vd));
|
||||
save(NAME(m_Vd));
|
||||
|
||||
}
|
||||
|
||||
|
||||
NETLIB_UPDATE_PARAM(D)
|
||||
{
|
||||
m_Is = m_model.dValue("Is", 1e-15);
|
||||
m_n = m_model.dValue("N", 1);
|
||||
m_Is = m_model.dValue("Is", 1e-15);
|
||||
m_n = m_model.dValue("N", 1);
|
||||
|
||||
m_Vt = 0.0258 * m_n;
|
||||
m_Vt = 0.0258 * m_n;
|
||||
|
||||
m_Vcrit = m_Vt * log(m_Vt / m_Is / sqrt(2.0));
|
||||
m_VtInv = 1.0 / m_Vt;
|
||||
NL_VERBOSE_OUT(("VCutoff: %f\n", m_Vcrit));
|
||||
m_Vcrit = m_Vt * log(m_Vt / m_Is / sqrt(2.0));
|
||||
m_VtInv = 1.0 / m_Vt;
|
||||
NL_VERBOSE_OUT(("VCutoff: %f\n", m_Vcrit));
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(D)
|
||||
{
|
||||
NETLIB_NAME(twoterm)::update();
|
||||
NETLIB_NAME(twoterm)::update();
|
||||
}
|
||||
|
||||
class diode
|
||||
{
|
||||
public:
|
||||
diode() : m_Is(1e-15), m_VT(0.0258), m_VT_inv(1.0 / m_VT) {}
|
||||
diode(const double Is, const double n)
|
||||
{
|
||||
m_Is = Is;
|
||||
m_VT = 0.0258 * n;
|
||||
m_VT_inv = 1.0 / m_VT;
|
||||
}
|
||||
void set(const double Is, const double n)
|
||||
{
|
||||
m_Is = Is;
|
||||
m_VT = 0.0258 * n;
|
||||
m_VT_inv = 1.0 / m_VT;
|
||||
}
|
||||
double I(const double V) const { return m_Is * exp(V * m_VT_inv) - m_Is; }
|
||||
double g(const double V) const { return m_Is * m_VT_inv * exp(V * m_VT_inv); }
|
||||
double V(const double I) const { return log(1.0 + I / m_Is) * m_VT; }
|
||||
double gI(const double I) const { return m_VT_inv * (I + m_Is); }
|
||||
diode() : m_Is(1e-15), m_VT(0.0258), m_VT_inv(1.0 / m_VT) {}
|
||||
diode(const double Is, const double n)
|
||||
{
|
||||
m_Is = Is;
|
||||
m_VT = 0.0258 * n;
|
||||
m_VT_inv = 1.0 / m_VT;
|
||||
}
|
||||
void set(const double Is, const double n)
|
||||
{
|
||||
m_Is = Is;
|
||||
m_VT = 0.0258 * n;
|
||||
m_VT_inv = 1.0 / m_VT;
|
||||
}
|
||||
double I(const double V) const { return m_Is * exp(V * m_VT_inv) - m_Is; }
|
||||
double g(const double V) const { return m_Is * m_VT_inv * exp(V * m_VT_inv); }
|
||||
double V(const double I) const { return log(1.0 + I / m_Is) * m_VT; }
|
||||
double gI(const double I) const { return m_VT_inv * (I + m_Is); }
|
||||
|
||||
private:
|
||||
double m_Is;
|
||||
double m_VT;
|
||||
double m_VT_inv;
|
||||
double m_Is;
|
||||
double m_VT;
|
||||
double m_VT_inv;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -180,61 +180,61 @@ private:
|
||||
|
||||
NETLIB_START(Q)
|
||||
{
|
||||
register_param("model", m_model, "");
|
||||
register_param("model", m_model, "");
|
||||
}
|
||||
|
||||
template <NETLIB_NAME(Q)::q_type _type>
|
||||
NETLIB_START(QBJT_switch<_type>)
|
||||
{
|
||||
NETLIB_NAME(Q)::start();
|
||||
NETLIB_NAME(Q)::start();
|
||||
|
||||
register_sub(m_RB, "RB");
|
||||
register_sub(m_RC, "RC");
|
||||
register_input("BV", m_BV);
|
||||
register_input("EV", m_EV);
|
||||
register_sub(m_RB, "RB");
|
||||
register_sub(m_RC, "RC");
|
||||
register_input("BV", m_BV);
|
||||
register_input("EV", m_EV);
|
||||
|
||||
register_subalias("B", m_RB.m_P);
|
||||
register_subalias("E", m_RB.m_N);
|
||||
register_subalias("C", m_RC.m_P);
|
||||
register_subalias("B", m_RB.m_P);
|
||||
register_subalias("E", m_RB.m_N);
|
||||
register_subalias("C", m_RC.m_P);
|
||||
|
||||
setup().connect(m_RB.m_N, m_RC.m_N);
|
||||
setup().connect(m_RB.m_P, m_BV);
|
||||
setup().connect(m_RB.m_N, m_EV);
|
||||
setup().connect(m_RB.m_N, m_RC.m_N);
|
||||
setup().connect(m_RB.m_P, m_BV);
|
||||
setup().connect(m_RB.m_N, m_EV);
|
||||
|
||||
save(NAME(m_state_on));
|
||||
save(NAME(m_state_on));
|
||||
}
|
||||
|
||||
NETLIB_UPDATE(Q)
|
||||
{
|
||||
netlist().solver()->schedule();
|
||||
netlist().solver()->schedule();
|
||||
}
|
||||
|
||||
template <NETLIB_NAME(Q)::q_type _type>
|
||||
NETLIB_UPDATE_PARAM(QBJT_switch<_type>)
|
||||
{
|
||||
double IS = m_model.dValue("IS", 1e-15);
|
||||
double BF = m_model.dValue("BF", 100);
|
||||
double NF = m_model.dValue("NF", 1);
|
||||
//double VJE = m_model.dValue("VJE", 0.75);
|
||||
double IS = m_model.dValue("IS", 1e-15);
|
||||
double BF = m_model.dValue("BF", 100);
|
||||
double NF = m_model.dValue("NF", 1);
|
||||
//double VJE = m_model.dValue("VJE", 0.75);
|
||||
|
||||
double alpha = BF / (1.0 + BF);
|
||||
double alpha = BF / (1.0 + BF);
|
||||
|
||||
diode d(IS, NF);
|
||||
diode d(IS, NF);
|
||||
|
||||
// Assume 5mA Collector current for switch operation
|
||||
// Assume 5mA Collector current for switch operation
|
||||
|
||||
if (_type == BJT_NPN)
|
||||
m_V = d.V(0.005 / alpha);
|
||||
else
|
||||
m_V = - d.V(0.005 / alpha);
|
||||
if (_type == BJT_NPN)
|
||||
m_V = d.V(0.005 / alpha);
|
||||
else
|
||||
m_V = - d.V(0.005 / alpha);
|
||||
|
||||
m_gB = d.gI(0.005 / alpha);
|
||||
if (m_gB < NETLIST_GMIN)
|
||||
m_gB = NETLIST_GMIN;
|
||||
m_gC = BF * m_gB; // very rough estimate
|
||||
//printf("%f %f \n", m_V, m_gB);
|
||||
m_RB.set(NETLIST_GMIN, 0.0, 0.0);
|
||||
m_RC.set(NETLIST_GMIN, 0.0, 0.0);
|
||||
m_gB = d.gI(0.005 / alpha);
|
||||
if (m_gB < NETLIST_GMIN)
|
||||
m_gB = NETLIST_GMIN;
|
||||
m_gC = BF * m_gB; // very rough estimate
|
||||
//printf("%f %f \n", m_V, m_gB);
|
||||
m_RB.set(NETLIST_GMIN, 0.0, 0.0);
|
||||
m_RC.set(NETLIST_GMIN, 0.0, 0.0);
|
||||
}
|
||||
|
||||
template NETLIB_START(QBJT_switch<NETLIB_NAME(Q)::BJT_NPN>);
|
||||
@ -248,40 +248,39 @@ template NETLIB_UPDATE_PARAM(QBJT_switch<NETLIB_NAME(Q)::BJT_PNP>);
|
||||
|
||||
NETLIB_START(VCCS)
|
||||
{
|
||||
configure(1.0, NETLIST_GMIN);
|
||||
configure(1.0, NETLIST_GMIN);
|
||||
}
|
||||
|
||||
ATTR_COLD void NETLIB_NAME(VCCS)::configure(const double Gfac, const double GI)
|
||||
{
|
||||
register_param("G", m_G, 1.0);
|
||||
|
||||
register_param("G", m_G, 1.0);
|
||||
register_terminal("IP", m_IP);
|
||||
register_terminal("IN", m_IN);
|
||||
register_terminal("OP", m_OP);
|
||||
register_terminal("ON", m_ON);
|
||||
|
||||
register_terminal("IP", m_IP);
|
||||
register_terminal("IN", m_IN);
|
||||
register_terminal("OP", m_OP);
|
||||
register_terminal("ON", m_ON);
|
||||
m_OP1.init_object(*this, name() + ".OP1", netlist_core_terminal_t::STATE_INP_ACTIVE);
|
||||
m_ON1.init_object(*this, name() + ".ON1", netlist_core_terminal_t::STATE_INP_ACTIVE);
|
||||
|
||||
m_OP1.init_object(*this, name() + ".OP1", netlist_core_terminal_t::STATE_INP_ACTIVE);
|
||||
m_ON1.init_object(*this, name() + ".ON1", netlist_core_terminal_t::STATE_INP_ACTIVE);
|
||||
const double m_mult = m_G.Value() * Gfac; // 1.0 ==> 1V ==> 1A
|
||||
m_IP.set(GI);
|
||||
m_IP.m_otherterm = &m_IN; // <= this should be NULL and terminal be filtered out prior to solving...
|
||||
m_IN.set(GI);
|
||||
m_IN.m_otherterm = &m_IP; // <= this should be NULL and terminal be filtered out prior to solving...
|
||||
|
||||
const double m_mult = m_G.Value() * Gfac; // 1.0 ==> 1V ==> 1A
|
||||
m_IP.set(GI);
|
||||
m_IP.m_otherterm = &m_IN; // <= this should be NULL and terminal be filtered out prior to solving...
|
||||
m_IN.set(GI);
|
||||
m_IN.m_otherterm = &m_IP; // <= this should be NULL and terminal be filtered out prior to solving...
|
||||
m_OP.set(m_mult, 0.0);
|
||||
m_OP.m_otherterm = &m_IP;
|
||||
m_OP1.set(-m_mult, 0.0);
|
||||
m_OP1.m_otherterm = &m_IN;
|
||||
|
||||
m_OP.set(m_mult, 0.0);
|
||||
m_OP.m_otherterm = &m_IP;
|
||||
m_OP1.set(-m_mult, 0.0);
|
||||
m_OP1.m_otherterm = &m_IN;
|
||||
m_ON.set(-m_mult, 0.0);
|
||||
m_ON.m_otherterm = &m_IP;
|
||||
m_ON1.set(m_mult, 0.0);
|
||||
m_ON1.m_otherterm = &m_IN;
|
||||
|
||||
m_ON.set(-m_mult, 0.0);
|
||||
m_ON.m_otherterm = &m_IP;
|
||||
m_ON1.set(m_mult, 0.0);
|
||||
m_ON1.m_otherterm = &m_IN;
|
||||
|
||||
setup().connect(m_OP, m_OP1);
|
||||
setup().connect(m_ON, m_ON1);
|
||||
setup().connect(m_OP, m_OP1);
|
||||
setup().connect(m_ON, m_ON1);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(VCCS)
|
||||
@ -290,8 +289,8 @@ NETLIB_UPDATE_PARAM(VCCS)
|
||||
|
||||
NETLIB_UPDATE(VCCS)
|
||||
{
|
||||
/* only called if connected to a rail net ==> notify the solver to recalculate */
|
||||
netlist().solver()->schedule();
|
||||
/* only called if connected to a rail net ==> notify the solver to recalculate */
|
||||
netlist().solver()->schedule();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -300,25 +299,24 @@ NETLIB_UPDATE(VCCS)
|
||||
|
||||
NETLIB_START(VCVS)
|
||||
{
|
||||
register_param("RO", m_RO, 1.0);
|
||||
register_param("RO", m_RO, 1.0);
|
||||
|
||||
const double gRO = 1.0 / m_RO.Value();
|
||||
const double gRO = 1.0 / m_RO.Value();
|
||||
|
||||
configure(gRO, NETLIST_GMIN);
|
||||
configure(gRO, NETLIST_GMIN);
|
||||
|
||||
m_OP2.init_object(*this, "OP2", netlist_core_terminal_t::STATE_INP_ACTIVE);
|
||||
m_ON2.init_object(*this, "ON2", netlist_core_terminal_t::STATE_INP_ACTIVE);
|
||||
m_OP2.init_object(*this, "OP2", netlist_core_terminal_t::STATE_INP_ACTIVE);
|
||||
m_ON2.init_object(*this, "ON2", netlist_core_terminal_t::STATE_INP_ACTIVE);
|
||||
|
||||
m_OP2.set(gRO);
|
||||
m_ON2.set(gRO);
|
||||
m_OP2.m_otherterm = &m_ON2;
|
||||
m_ON2.m_otherterm = &m_OP2;
|
||||
m_OP2.set(gRO);
|
||||
m_ON2.set(gRO);
|
||||
m_OP2.m_otherterm = &m_ON2;
|
||||
m_ON2.m_otherterm = &m_OP2;
|
||||
|
||||
setup().connect(m_OP2, m_OP1);
|
||||
setup().connect(m_ON2, m_ON1);
|
||||
setup().connect(m_OP2, m_OP1);
|
||||
setup().connect(m_ON2, m_ON1);
|
||||
}
|
||||
|
||||
NETLIB_UPDATE_PARAM(VCVS)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -40,30 +40,30 @@
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
#define NETDEV_R(_name, _R) \
|
||||
NET_REGISTER_DEV(R, _name) \
|
||||
NETDEV_PARAMI(_name, R, _R)
|
||||
NET_REGISTER_DEV(R, _name) \
|
||||
NETDEV_PARAMI(_name, R, _R)
|
||||
|
||||
#define NETDEV_POT(_name, _R) \
|
||||
NET_REGISTER_DEV(POT, _name) \
|
||||
NETDEV_PARAMI(_name, R, _R)
|
||||
NET_REGISTER_DEV(POT, _name) \
|
||||
NETDEV_PARAMI(_name, R, _R)
|
||||
|
||||
|
||||
#define NETDEV_C(_name, _C) \
|
||||
NET_REGISTER_DEV(C, _name) \
|
||||
NETDEV_PARAMI(_name, C, _C)
|
||||
NET_REGISTER_DEV(C, _name) \
|
||||
NETDEV_PARAMI(_name, C, _C)
|
||||
|
||||
/* Generic Diode */
|
||||
#define NETDEV_D(_name, _model) \
|
||||
NET_REGISTER_DEV(D, _name) \
|
||||
NETDEV_PARAMI(_name, model, # _model)
|
||||
NET_REGISTER_DEV(D, _name) \
|
||||
NETDEV_PARAMI(_name, model, # _model)
|
||||
|
||||
#define NETDEV_QPNP(_name, _model) \
|
||||
NET_REGISTER_DEV(QPNP_switch, _name) \
|
||||
NETDEV_PARAMI(_name, model, # _model)
|
||||
NET_REGISTER_DEV(QPNP_switch, _name) \
|
||||
NETDEV_PARAMI(_name, model, # _model)
|
||||
|
||||
#define NETDEV_QNPN(_name, _model) \
|
||||
NET_REGISTER_DEV(QNPN_switch, _name) \
|
||||
NETDEV_PARAMI(_name, model, # _model)
|
||||
NET_REGISTER_DEV(QNPN_switch, _name) \
|
||||
NETDEV_PARAMI(_name, model, # _model)
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Implementation
|
||||
@ -76,24 +76,24 @@
|
||||
class NETLIB_NAME(twoterm) : public netlist_device_t
|
||||
{
|
||||
public:
|
||||
ATTR_COLD NETLIB_NAME(twoterm)(const family_t afamily);
|
||||
ATTR_COLD NETLIB_NAME(twoterm)(const family_t afamily);
|
||||
|
||||
netlist_terminal_t m_P;
|
||||
netlist_terminal_t m_N;
|
||||
netlist_terminal_t m_P;
|
||||
netlist_terminal_t m_N;
|
||||
|
||||
virtual NETLIB_UPDATE_TERMINALS()
|
||||
{
|
||||
}
|
||||
virtual NETLIB_UPDATE_TERMINALS()
|
||||
{
|
||||
}
|
||||
|
||||
ATTR_HOT inline void set(const double G, const double V, const double I)
|
||||
{
|
||||
m_P.m_go = m_N.m_go = m_P.m_gt = m_N.m_gt = G;
|
||||
m_N.m_Idr = ( -V) * G + I;
|
||||
m_P.m_Idr = ( V) * G - I;
|
||||
}
|
||||
ATTR_HOT inline void set(const double G, const double V, const double I)
|
||||
{
|
||||
m_P.m_go = m_N.m_go = m_P.m_gt = m_N.m_gt = G;
|
||||
m_N.m_Idr = ( -V) * G + I;
|
||||
m_P.m_Idr = ( V) * G - I;
|
||||
}
|
||||
protected:
|
||||
ATTR_COLD virtual void start();
|
||||
ATTR_HOT ATTR_ALIGN void update();
|
||||
ATTR_COLD virtual void start();
|
||||
ATTR_HOT ATTR_ALIGN void update();
|
||||
|
||||
private:
|
||||
};
|
||||
@ -105,17 +105,17 @@ private:
|
||||
class NETLIB_NAME(R_base) : public NETLIB_NAME(twoterm)
|
||||
{
|
||||
public:
|
||||
ATTR_COLD NETLIB_NAME(R_base)() : NETLIB_NAME(twoterm)(RESISTOR) { }
|
||||
ATTR_COLD NETLIB_NAME(R_base)() : NETLIB_NAME(twoterm)(RESISTOR) { }
|
||||
|
||||
inline void set_R(const double R) { set(1.0 / R, 0.0, 0.0); }
|
||||
inline void set_R(const double R) { set(1.0 / R, 0.0, 0.0); }
|
||||
|
||||
protected:
|
||||
ATTR_COLD virtual void start();
|
||||
ATTR_HOT ATTR_ALIGN void update();
|
||||
ATTR_COLD virtual void start();
|
||||
ATTR_HOT ATTR_ALIGN void update();
|
||||
};
|
||||
|
||||
NETLIB_DEVICE_WITH_PARAMS_DERIVED(R, R_base,
|
||||
netlist_param_double_t m_R;
|
||||
netlist_param_double_t m_R;
|
||||
);
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -123,11 +123,11 @@ NETLIB_DEVICE_WITH_PARAMS_DERIVED(R, R_base,
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
NETLIB_DEVICE_WITH_PARAMS(POT,
|
||||
NETLIB_NAME(R_base) m_R1;
|
||||
NETLIB_NAME(R_base) m_R2;
|
||||
NETLIB_NAME(R_base) m_R1;
|
||||
NETLIB_NAME(R_base) m_R2;
|
||||
|
||||
netlist_param_double_t m_R;
|
||||
netlist_param_double_t m_Dial;
|
||||
netlist_param_double_t m_R;
|
||||
netlist_param_double_t m_Dial;
|
||||
);
|
||||
|
||||
|
||||
@ -138,21 +138,21 @@ NETLIB_DEVICE_WITH_PARAMS(POT,
|
||||
class NETLIB_NAME(C) : public NETLIB_NAME(twoterm)
|
||||
{
|
||||
public:
|
||||
ATTR_COLD NETLIB_NAME(C)() : NETLIB_NAME(twoterm)(CAPACITOR) { }
|
||||
ATTR_COLD NETLIB_NAME(C)() : NETLIB_NAME(twoterm)(CAPACITOR) { }
|
||||
|
||||
ATTR_HOT void step_time(const double st)
|
||||
{
|
||||
double G = m_C.Value() / st;
|
||||
double I = -G * (m_P.net().Q_Analog()- m_N.net().Q_Analog());
|
||||
set(G, 0.0, I);
|
||||
}
|
||||
ATTR_HOT void step_time(const double st)
|
||||
{
|
||||
double G = m_C.Value() / st;
|
||||
double I = -G * (m_P.net().Q_Analog()- m_N.net().Q_Analog());
|
||||
set(G, 0.0, I);
|
||||
}
|
||||
|
||||
protected:
|
||||
ATTR_COLD virtual void start();
|
||||
ATTR_COLD virtual void update_param();
|
||||
ATTR_HOT ATTR_ALIGN void update();
|
||||
ATTR_COLD virtual void start();
|
||||
ATTR_COLD virtual void update_param();
|
||||
ATTR_HOT ATTR_ALIGN void update();
|
||||
|
||||
netlist_param_double_t m_C;
|
||||
netlist_param_double_t m_C;
|
||||
|
||||
};
|
||||
|
||||
@ -167,87 +167,87 @@ protected:
|
||||
#if 0
|
||||
inline double fastexp_h(const double x)
|
||||
{
|
||||
static const double ln2r = 1.442695040888963387;
|
||||
static const double ln2 = 0.693147180559945286;
|
||||
//static const double c3 = 0.166666666666666667;
|
||||
static const double ln2r = 1.442695040888963387;
|
||||
static const double ln2 = 0.693147180559945286;
|
||||
//static const double c3 = 0.166666666666666667;
|
||||
|
||||
const double y = x * ln2r;
|
||||
const unsigned int t = y;
|
||||
const double z = (x - ln2 * (double) t);
|
||||
const double zz = z * z;
|
||||
//const double zzz = zz * z;
|
||||
const double y = x * ln2r;
|
||||
const unsigned int t = y;
|
||||
const double z = (x - ln2 * (double) t);
|
||||
const double zz = z * z;
|
||||
//const double zzz = zz * z;
|
||||
|
||||
return (double)(1 << t)*(1.0 + z + 0.5 * zz); // + c3*zzz;
|
||||
return (double)(1 << t)*(1.0 + z + 0.5 * zz); // + c3*zzz;
|
||||
}
|
||||
|
||||
inline double fastexp(const double x)
|
||||
{
|
||||
if (x<0)
|
||||
return 1.0 / fastexp_h(-x);
|
||||
else
|
||||
return fastexp_h(x);
|
||||
if (x<0)
|
||||
return 1.0 / fastexp_h(-x);
|
||||
else
|
||||
return fastexp_h(x);
|
||||
}
|
||||
#endif
|
||||
|
||||
class NETLIB_NAME(D) : public NETLIB_NAME(twoterm)
|
||||
{
|
||||
public:
|
||||
ATTR_COLD NETLIB_NAME(D)() : NETLIB_NAME(twoterm)(DIODE) { }
|
||||
ATTR_COLD NETLIB_NAME(D)() : NETLIB_NAME(twoterm)(DIODE) { }
|
||||
|
||||
NETLIB_UPDATE_TERMINALS()
|
||||
{
|
||||
const double nVd = m_P.net().Q_Analog()- m_N.net().Q_Analog();
|
||||
NETLIB_UPDATE_TERMINALS()
|
||||
{
|
||||
const double nVd = m_P.net().Q_Analog()- m_N.net().Q_Analog();
|
||||
|
||||
//FIXME: Optimize cutoff case
|
||||
//FIXME: Optimize cutoff case
|
||||
|
||||
double Id;
|
||||
double G;
|
||||
double Id;
|
||||
double G;
|
||||
|
||||
if (nVd < -5.0 * m_Vt)
|
||||
{
|
||||
m_Vd = nVd;
|
||||
G = NETLIST_GMIN;
|
||||
Id = - m_Is;
|
||||
}
|
||||
else if (nVd < m_Vcrit)
|
||||
{
|
||||
m_Vd = nVd;
|
||||
if (nVd < -5.0 * m_Vt)
|
||||
{
|
||||
m_Vd = nVd;
|
||||
G = NETLIST_GMIN;
|
||||
Id = - m_Is;
|
||||
}
|
||||
else if (nVd < m_Vcrit)
|
||||
{
|
||||
m_Vd = nVd;
|
||||
|
||||
const double eVDVt = exp(m_Vd * m_VtInv);
|
||||
Id = m_Is * (eVDVt - 1.0);
|
||||
G = m_Is * m_VtInv * eVDVt;
|
||||
}
|
||||
else
|
||||
{
|
||||
const double eVDVt = exp(m_Vd * m_VtInv);
|
||||
Id = m_Is * (eVDVt - 1.0);
|
||||
G = m_Is * m_VtInv * eVDVt;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1800
|
||||
m_Vd = m_Vd + log((nVd - m_Vd) * m_VtInv + 1.0) * m_Vt;
|
||||
m_Vd = m_Vd + log((nVd - m_Vd) * m_VtInv + 1.0) * m_Vt;
|
||||
#else
|
||||
m_Vd = m_Vd + log1p((nVd - m_Vd) * m_VtInv) * m_Vt;
|
||||
m_Vd = m_Vd + log1p((nVd - m_Vd) * m_VtInv) * m_Vt;
|
||||
#endif
|
||||
const double eVDVt = exp(m_Vd * m_VtInv);
|
||||
Id = m_Is * (eVDVt - 1.0);
|
||||
const double eVDVt = exp(m_Vd * m_VtInv);
|
||||
Id = m_Is * (eVDVt - 1.0);
|
||||
|
||||
G = m_Is * m_VtInv * eVDVt;
|
||||
}
|
||||
G = m_Is * m_VtInv * eVDVt;
|
||||
}
|
||||
|
||||
double I = (Id - m_Vd * G);
|
||||
set(G, 0.0, I);
|
||||
}
|
||||
double I = (Id - m_Vd * G);
|
||||
set(G, 0.0, I);
|
||||
}
|
||||
|
||||
protected:
|
||||
ATTR_COLD virtual void start();
|
||||
ATTR_COLD virtual void update_param();
|
||||
ATTR_HOT ATTR_ALIGN void update();
|
||||
ATTR_COLD virtual void start();
|
||||
ATTR_COLD virtual void update_param();
|
||||
ATTR_HOT ATTR_ALIGN void update();
|
||||
|
||||
netlist_param_model_t m_model;
|
||||
netlist_param_model_t m_model;
|
||||
|
||||
double m_Vt;
|
||||
double m_Is;
|
||||
double m_n;
|
||||
double m_Vt;
|
||||
double m_Is;
|
||||
double m_n;
|
||||
|
||||
double m_VtInv;
|
||||
double m_Vcrit;
|
||||
double m_Vd;
|
||||
double m_VtInv;
|
||||
double m_Vcrit;
|
||||
double m_Vd;
|
||||
|
||||
};
|
||||
|
||||
@ -269,32 +269,32 @@ protected:
|
||||
class NETLIB_NAME(Q) : public netlist_device_t
|
||||
{
|
||||
public:
|
||||
enum q_type {
|
||||
BJT_NPN,
|
||||
BJT_PNP
|
||||
};
|
||||
enum q_type {
|
||||
BJT_NPN,
|
||||
BJT_PNP
|
||||
};
|
||||
|
||||
ATTR_COLD NETLIB_NAME(Q)(const q_type atype, const family_t afamily)
|
||||
: netlist_device_t(afamily)
|
||||
, m_qtype(atype) { }
|
||||
ATTR_COLD NETLIB_NAME(Q)(const q_type atype, const family_t afamily)
|
||||
: netlist_device_t(afamily)
|
||||
, m_qtype(atype) { }
|
||||
|
||||
inline q_type qtype() const { return m_qtype; }
|
||||
inline bool is_qtype(q_type atype) const { return m_qtype == atype; }
|
||||
inline q_type qtype() const { return m_qtype; }
|
||||
inline bool is_qtype(q_type atype) const { return m_qtype == atype; }
|
||||
protected:
|
||||
ATTR_COLD virtual void start();
|
||||
ATTR_HOT ATTR_ALIGN void update();
|
||||
ATTR_COLD virtual void start();
|
||||
ATTR_HOT ATTR_ALIGN void update();
|
||||
|
||||
netlist_param_model_t m_model;
|
||||
netlist_param_model_t m_model;
|
||||
private:
|
||||
q_type m_qtype;
|
||||
q_type m_qtype;
|
||||
};
|
||||
|
||||
class NETLIB_NAME(QBJT) : public NETLIB_NAME(Q)
|
||||
{
|
||||
public:
|
||||
|
||||
ATTR_COLD NETLIB_NAME(QBJT)(const q_type atype, const family_t afamily)
|
||||
: NETLIB_NAME(Q)(atype, afamily) { }
|
||||
ATTR_COLD NETLIB_NAME(QBJT)(const q_type atype, const family_t afamily)
|
||||
: NETLIB_NAME(Q)(atype, afamily) { }
|
||||
|
||||
protected:
|
||||
|
||||
@ -306,51 +306,51 @@ template <NETLIB_NAME(Q)::q_type _type>
|
||||
class NETLIB_NAME(QBJT_switch) : public NETLIB_NAME(QBJT)
|
||||
{
|
||||
public:
|
||||
ATTR_COLD NETLIB_NAME(QBJT_switch)()
|
||||
: NETLIB_NAME(QBJT)(_type, BJT_SWITCH), m_gB(NETLIST_GMIN), m_gC(NETLIST_GMIN), m_V(0.0), m_state_on(0) { }
|
||||
ATTR_COLD NETLIB_NAME(QBJT_switch)()
|
||||
: NETLIB_NAME(QBJT)(_type, BJT_SWITCH), m_gB(NETLIST_GMIN), m_gC(NETLIST_GMIN), m_V(0.0), m_state_on(0) { }
|
||||
|
||||
NETLIB_UPDATEI()
|
||||
{
|
||||
double vE = INPANALOG(m_EV);
|
||||
double vB = INPANALOG(m_BV);
|
||||
NETLIB_UPDATEI()
|
||||
{
|
||||
double vE = INPANALOG(m_EV);
|
||||
double vB = INPANALOG(m_BV);
|
||||
|
||||
int new_state = (vB - vE > m_V ) ? 1 : 0;
|
||||
if (m_state_on ^ new_state)
|
||||
{
|
||||
double gb = m_gB;
|
||||
double gc = m_gC;
|
||||
double v = m_V;
|
||||
if (!new_state )
|
||||
{
|
||||
// not conducting
|
||||
gb = NETLIST_GMIN;
|
||||
v = 0;
|
||||
gc = NETLIST_GMIN;
|
||||
}
|
||||
m_RB.set(gb, v, 0.0);
|
||||
m_RC.set(gc, 0.0, 0.0);
|
||||
m_state_on = new_state;
|
||||
m_RB.update_dev();
|
||||
m_RC.update_dev();
|
||||
}
|
||||
int new_state = (vB - vE > m_V ) ? 1 : 0;
|
||||
if (m_state_on ^ new_state)
|
||||
{
|
||||
double gb = m_gB;
|
||||
double gc = m_gC;
|
||||
double v = m_V;
|
||||
if (!new_state )
|
||||
{
|
||||
// not conducting
|
||||
gb = NETLIST_GMIN;
|
||||
v = 0;
|
||||
gc = NETLIST_GMIN;
|
||||
}
|
||||
m_RB.set(gb, v, 0.0);
|
||||
m_RC.set(gc, 0.0, 0.0);
|
||||
m_state_on = new_state;
|
||||
m_RB.update_dev();
|
||||
m_RC.update_dev();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
NETLIB_NAME(R) m_RB;
|
||||
NETLIB_NAME(R) m_RC;
|
||||
NETLIB_NAME(R) m_RB;
|
||||
NETLIB_NAME(R) m_RC;
|
||||
|
||||
netlist_analog_input_t m_BV;
|
||||
netlist_analog_input_t m_EV;
|
||||
netlist_analog_input_t m_BV;
|
||||
netlist_analog_input_t m_EV;
|
||||
|
||||
protected:
|
||||
|
||||
ATTR_COLD virtual void start();
|
||||
ATTR_COLD void update_param();
|
||||
ATTR_COLD virtual void start();
|
||||
ATTR_COLD void update_param();
|
||||
|
||||
double m_gB; // base conductance / switch on
|
||||
double m_gC; // collector conductance / switch on
|
||||
double m_V; // internal voltage source
|
||||
UINT8 m_state_on;
|
||||
double m_gB; // base conductance / switch on
|
||||
double m_gC; // collector conductance / switch on
|
||||
double m_V; // internal voltage source
|
||||
UINT8 m_state_on;
|
||||
|
||||
private:
|
||||
};
|
||||
@ -380,35 +380,34 @@ typedef NETLIB_NAME(QBJT_switch)<NETLIB_NAME(Q)::BJT_NPN> NETLIB_NAME(QNPN_switc
|
||||
*/
|
||||
|
||||
#define NETDEV_VCCS(_name) \
|
||||
NET_REGISTER_DEV(VCCS, _name) \
|
||||
|
||||
NET_REGISTER_DEV(VCCS, _name)
|
||||
//NETDEV_PARAMI(_name, model, _model)
|
||||
|
||||
class NETLIB_NAME(VCCS) : public netlist_device_t
|
||||
{
|
||||
public:
|
||||
ATTR_COLD NETLIB_NAME(VCCS)()
|
||||
: netlist_device_t(VCCS) { }
|
||||
ATTR_COLD NETLIB_NAME(VCCS)(const family_t afamily)
|
||||
: netlist_device_t(afamily) { }
|
||||
ATTR_COLD NETLIB_NAME(VCCS)()
|
||||
: netlist_device_t(VCCS) { }
|
||||
ATTR_COLD NETLIB_NAME(VCCS)(const family_t afamily)
|
||||
: netlist_device_t(afamily) { }
|
||||
|
||||
protected:
|
||||
ATTR_COLD virtual void start();
|
||||
ATTR_COLD virtual void update_param();
|
||||
ATTR_HOT ATTR_ALIGN void update();
|
||||
ATTR_COLD virtual void start();
|
||||
ATTR_COLD virtual void update_param();
|
||||
ATTR_HOT ATTR_ALIGN void update();
|
||||
|
||||
ATTR_COLD void configure(const double Gfac, const double GI);
|
||||
ATTR_COLD void configure(const double Gfac, const double GI);
|
||||
|
||||
netlist_terminal_t m_OP;
|
||||
netlist_terminal_t m_ON;
|
||||
netlist_terminal_t m_OP;
|
||||
netlist_terminal_t m_ON;
|
||||
|
||||
netlist_terminal_t m_IP;
|
||||
netlist_terminal_t m_IN;
|
||||
netlist_terminal_t m_IP;
|
||||
netlist_terminal_t m_IN;
|
||||
|
||||
netlist_terminal_t m_OP1;
|
||||
netlist_terminal_t m_ON1;
|
||||
netlist_terminal_t m_OP1;
|
||||
netlist_terminal_t m_ON1;
|
||||
|
||||
netlist_param_double_t m_G;
|
||||
netlist_param_double_t m_G;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -439,28 +438,27 @@ protected:
|
||||
*/
|
||||
|
||||
#define NETDEV_VCVS(_name) \
|
||||
NET_REGISTER_DEV(VCVS, _name) \
|
||||
|
||||
NET_REGISTER_DEV(VCVS, _name)
|
||||
//NETDEV_PARAMI(_name, model, _model)
|
||||
|
||||
|
||||
class NETLIB_NAME(VCVS) : public NETLIB_NAME(VCCS)
|
||||
{
|
||||
public:
|
||||
ATTR_COLD NETLIB_NAME(VCVS)()
|
||||
: NETLIB_NAME(VCCS)(VCVS) { }
|
||||
ATTR_COLD NETLIB_NAME(VCVS)()
|
||||
: NETLIB_NAME(VCCS)(VCVS) { }
|
||||
|
||||
protected:
|
||||
ATTR_COLD virtual void start();
|
||||
ATTR_COLD virtual void update_param();
|
||||
//ATTR_HOT ATTR_ALIGN void update();
|
||||
ATTR_COLD virtual void start();
|
||||
ATTR_COLD virtual void update_param();
|
||||
//ATTR_HOT ATTR_ALIGN void update();
|
||||
|
||||
netlist_terminal_t m_OP2;
|
||||
netlist_terminal_t m_ON2;
|
||||
netlist_terminal_t m_OP2;
|
||||
netlist_terminal_t m_ON2;
|
||||
|
||||
double m_mult;
|
||||
double m_mult;
|
||||
|
||||
netlist_param_double_t m_RO;
|
||||
netlist_param_double_t m_RO;
|
||||
};
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -65,10 +65,9 @@ typedef UINT8 netlist_sig_t;
|
||||
|
||||
// prevent implicit copying
|
||||
#define NETLIST_PREVENT_COPYING(_name) \
|
||||
private: \
|
||||
_name(const _name &); \
|
||||
_name &operator=(const _name &); \
|
||||
|
||||
private: \
|
||||
_name(const _name &); \
|
||||
_name &operator=(const _name &);
|
||||
#if NL_KEEP_STATISTICS
|
||||
#define add_to_stat(v,x) do { v += (x); } while (0)
|
||||
#define inc_stat(v) add_to_stat(v, 1)
|
||||
|
@ -20,13 +20,12 @@ struct netlist_list_t
|
||||
{
|
||||
public:
|
||||
|
||||
struct entry_t {
|
||||
struct entry_t {
|
||||
// keep compatibility with tagmap
|
||||
_ListClass object() { return m_obj; }
|
||||
|
||||
// keep compatibility with tagmap
|
||||
_ListClass object() { return m_obj; }
|
||||
|
||||
_ListClass m_obj;
|
||||
};
|
||||
_ListClass m_obj;
|
||||
};
|
||||
|
||||
ATTR_COLD netlist_list_t(int numElements = _NumElem)
|
||||
{
|
||||
@ -36,25 +35,25 @@ public:
|
||||
m_ptr--;
|
||||
}
|
||||
|
||||
ATTR_COLD netlist_list_t(const netlist_list_t &rhs)
|
||||
{
|
||||
m_list = new entry_t[m_num_elements];
|
||||
m_ptr = m_list;
|
||||
m_ptr--;
|
||||
for (int i=0; i<rhs.count(); i++)
|
||||
{
|
||||
this->add(rhs[i]);
|
||||
}
|
||||
}
|
||||
ATTR_COLD netlist_list_t(const netlist_list_t &rhs)
|
||||
{
|
||||
m_list = new entry_t[m_num_elements];
|
||||
m_ptr = m_list;
|
||||
m_ptr--;
|
||||
for (int i=0; i<rhs.count(); i++)
|
||||
{
|
||||
this->add(rhs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
ATTR_COLD netlist_list_t &operator=(const netlist_list_t &rhs)
|
||||
{
|
||||
for (int i=0; i<rhs.count(); i++)
|
||||
{
|
||||
this->add(rhs[i]);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
ATTR_COLD netlist_list_t &operator=(const netlist_list_t &rhs)
|
||||
{
|
||||
for (int i=0; i<rhs.count(); i++)
|
||||
{
|
||||
this->add(rhs[i]);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
ATTR_COLD ~netlist_list_t()
|
||||
@ -64,50 +63,50 @@ public:
|
||||
ATTR_HOT inline void add(const _ListClass elem)
|
||||
{
|
||||
if (m_ptr-m_list >= m_num_elements - 1)
|
||||
resize(m_num_elements * 2);
|
||||
resize(m_num_elements * 2);
|
||||
|
||||
(++m_ptr)->m_obj = elem;
|
||||
}
|
||||
ATTR_HOT inline void resize(const int new_size)
|
||||
{
|
||||
int cnt = count();
|
||||
entry_t *m_new = new entry_t[new_size];
|
||||
entry_t *pd = m_new;
|
||||
int cnt = count();
|
||||
entry_t *m_new = new entry_t[new_size];
|
||||
entry_t *pd = m_new;
|
||||
|
||||
for (entry_t *ps = m_list; ps <= m_ptr; ps++, pd++)
|
||||
*pd = *ps;
|
||||
delete[] m_list;
|
||||
m_list = m_new;
|
||||
m_ptr = m_list + cnt - 1;
|
||||
m_num_elements = new_size;
|
||||
for (entry_t *ps = m_list; ps <= m_ptr; ps++, pd++)
|
||||
*pd = *ps;
|
||||
delete[] m_list;
|
||||
m_list = m_new;
|
||||
m_ptr = m_list + cnt - 1;
|
||||
m_num_elements = new_size;
|
||||
}
|
||||
ATTR_HOT inline void remove(const _ListClass elem)
|
||||
{
|
||||
for (entry_t *i = m_list; i <= m_ptr; i++)
|
||||
{
|
||||
if (i->object() == elem)
|
||||
{
|
||||
while (i < m_ptr)
|
||||
{
|
||||
*i = *(i+1);
|
||||
i++;
|
||||
}
|
||||
m_ptr--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
ATTR_HOT inline bool contains(const _ListClass elem) const
|
||||
{
|
||||
for (entry_t *i = m_list; i <= m_ptr; i++)
|
||||
{
|
||||
if (i->object() == elem)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
ATTR_HOT inline void remove(const _ListClass elem)
|
||||
{
|
||||
for (entry_t *i = m_list; i <= m_ptr; i++)
|
||||
{
|
||||
if (i->object() == elem)
|
||||
{
|
||||
while (i < m_ptr)
|
||||
{
|
||||
*i = *(i+1);
|
||||
i++;
|
||||
}
|
||||
m_ptr--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
ATTR_HOT inline bool contains(const _ListClass elem) const
|
||||
{
|
||||
for (entry_t *i = m_list; i <= m_ptr; i++)
|
||||
{
|
||||
if (i->object() == elem)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
ATTR_HOT inline entry_t *first() const { return (m_ptr >= m_list ? &m_list[0] : NULL ); }
|
||||
ATTR_HOT inline entry_t *next(entry_t *lc) const { return (lc < last() ? lc + 1 : NULL ); }
|
||||
ATTR_HOT inline entry_t *next(entry_t *lc) const { return (lc < last() ? lc + 1 : NULL ); }
|
||||
ATTR_HOT inline entry_t *last() const { return m_ptr; }
|
||||
ATTR_HOT inline int count() const { return m_ptr - m_list + 1; }
|
||||
ATTR_HOT inline bool empty() const { return (m_ptr < m_list); }
|
||||
@ -115,16 +114,16 @@ public:
|
||||
|
||||
ATTR_COLD void reset_and_free()
|
||||
{
|
||||
for (entry_t *i = m_list; i <= m_ptr; i++)
|
||||
{
|
||||
delete i->object();
|
||||
}
|
||||
reset();
|
||||
for (entry_t *i = m_list; i <= m_ptr; i++)
|
||||
{
|
||||
delete i->object();
|
||||
}
|
||||
reset();
|
||||
}
|
||||
|
||||
//ATTR_HOT inline entry_t *item(int i) const { return &m_list[i]; }
|
||||
//ATTR_HOT inline entry_t *item(int i) const { return &m_list[i]; }
|
||||
ATTR_HOT inline _ListClass& operator[](const int & index) { return m_list[index].m_obj; }
|
||||
ATTR_HOT inline const _ListClass& operator[](const int & index) const { return m_list[index].m_obj; }
|
||||
ATTR_HOT inline const _ListClass& operator[](const int & index) const { return m_list[index].m_obj; }
|
||||
|
||||
private:
|
||||
entry_t * m_ptr;
|
||||
@ -140,7 +139,7 @@ private:
|
||||
template <class _Element, class _Time, int _Size>
|
||||
class netlist_timed_queue
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_timed_queue)
|
||||
NETLIST_PREVENT_COPYING(netlist_timed_queue)
|
||||
public:
|
||||
|
||||
struct entry_t
|
||||
@ -153,7 +152,7 @@ public:
|
||||
ATTR_HOT inline _Element & object() const { return *m_object; }
|
||||
|
||||
ATTR_HOT inline const _Time *time_ptr() const { return &m_time; }
|
||||
ATTR_HOT inline _Element *object_ptr() const { return m_object; }
|
||||
ATTR_HOT inline _Element *object_ptr() const { return m_object; }
|
||||
private:
|
||||
_Time m_time;
|
||||
_Element *m_object;
|
||||
@ -165,7 +164,7 @@ public:
|
||||
clear();
|
||||
}
|
||||
|
||||
ATTR_HOT inline int capacity() const { return _Size; }
|
||||
ATTR_HOT inline int capacity() const { return _Size; }
|
||||
ATTR_HOT inline bool is_empty() const { return (m_end == &m_list[0]); }
|
||||
ATTR_HOT inline bool is_not_empty() const { return (m_end > &m_list[0]); }
|
||||
|
||||
|
@ -27,18 +27,18 @@ void netlist_parser::parse(const char *buf)
|
||||
NL_VERBOSE_OUT(("Parser: Device: %s\n", n.cstr()));
|
||||
if (n == "NET_ALIAS")
|
||||
net_alias();
|
||||
else if (n == "NET_C")
|
||||
net_c();
|
||||
else if (n == "NET_C")
|
||||
net_c();
|
||||
else if (n == "NETDEV_PARAM")
|
||||
netdev_param();
|
||||
else if (n == "NETDEV_R")
|
||||
netdev_device(n, "R");
|
||||
else if (n == "NETDEV_C")
|
||||
netdev_device(n, "C");
|
||||
else if (n == "NETDEV_POT")
|
||||
netdev_device(n, "R");
|
||||
else if (n == "NETDEV_D")
|
||||
netdev_device(n, "model", true);
|
||||
else if (n == "NETDEV_R")
|
||||
netdev_device(n, "R");
|
||||
else if (n == "NETDEV_C")
|
||||
netdev_device(n, "C");
|
||||
else if (n == "NETDEV_POT")
|
||||
netdev_device(n, "R");
|
||||
else if (n == "NETDEV_D")
|
||||
netdev_device(n, "model", true);
|
||||
else if ((n == "NETDEV_TTL_CONST") || (n == "NETDEV_ANALOG_CONST"))
|
||||
netdev_const(n);
|
||||
else
|
||||
@ -60,14 +60,14 @@ void netlist_parser::net_alias()
|
||||
|
||||
void netlist_parser::net_c()
|
||||
{
|
||||
pstring t1;
|
||||
pstring t2;
|
||||
skipws();
|
||||
t1 = getname(',');
|
||||
skipws();
|
||||
t2 = getname(')');
|
||||
NL_VERBOSE_OUT(("Parser: Connect: %s %s\n", t1.cstr(), t2.cstr()));
|
||||
m_setup.register_link(t1 , t2);
|
||||
pstring t1;
|
||||
pstring t2;
|
||||
skipws();
|
||||
t1 = getname(',');
|
||||
skipws();
|
||||
t2 = getname(')');
|
||||
NL_VERBOSE_OUT(("Parser: Connect: %s %s\n", t1.cstr(), t2.cstr()));
|
||||
m_setup.register_link(t1 , t2);
|
||||
}
|
||||
|
||||
void netlist_parser::netdev_param()
|
||||
@ -98,7 +98,7 @@ void netlist_parser::netdev_const(const pstring &dev_name)
|
||||
val = eval_param();
|
||||
paramfq = name + ".CONST";
|
||||
NL_VERBOSE_OUT(("Parser: Const: %s %f\n", name.cstr(), val));
|
||||
check_char(')');
|
||||
check_char(')');
|
||||
m_setup.register_param(paramfq, val);
|
||||
}
|
||||
|
||||
@ -126,43 +126,43 @@ void netlist_parser::netdev_device(const pstring &dev_type)
|
||||
}
|
||||
/*
|
||||
if (cnt != dev->m_terminals.count() && !dev->variable_input_count())
|
||||
fatalerror("netlist: input count mismatch for %s - expected %d found %d\n", devname.cstr(), dev->m_terminals.count(), cnt);
|
||||
if (dev->variable_input_count())
|
||||
{
|
||||
NL_VERBOSE_OUT(("variable inputs %s: %d\n", dev->name().cstr(), cnt));
|
||||
}
|
||||
*/
|
||||
fatalerror("netlist: input count mismatch for %s - expected %d found %d\n", devname.cstr(), dev->m_terminals.count(), cnt);
|
||||
if (dev->variable_input_count())
|
||||
{
|
||||
NL_VERBOSE_OUT(("variable inputs %s: %d\n", dev->name().cstr(), cnt));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void netlist_parser::netdev_device(const pstring &dev_type, const pstring &default_param, bool isString)
|
||||
{
|
||||
netlist_device_t *dev;
|
||||
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(')');
|
||||
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(')');
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -171,7 +171,7 @@ void netlist_parser::netdev_device(const pstring &dev_type, const pstring &defau
|
||||
|
||||
void netlist_parser::skipeol()
|
||||
{
|
||||
char c = getc();
|
||||
char c = getc();
|
||||
while (c)
|
||||
{
|
||||
if (c == 10)
|
||||
@ -197,27 +197,27 @@ void netlist_parser::skipws()
|
||||
case 13:
|
||||
break;
|
||||
case '/':
|
||||
c = getc();
|
||||
c = getc();
|
||||
if (c == '/')
|
||||
{
|
||||
skipeol();
|
||||
skipeol();
|
||||
}
|
||||
else if (c == '*')
|
||||
{
|
||||
int f=0;
|
||||
while ((c = getc()) != 0 )
|
||||
{
|
||||
if (f == 0 && c == '*')
|
||||
f=1;
|
||||
else if (f == 1 && c== '/' )
|
||||
break;
|
||||
else
|
||||
f=0;
|
||||
}
|
||||
int f=0;
|
||||
while ((c = getc()) != 0 )
|
||||
{
|
||||
if (f == 0 && c == '*')
|
||||
f=1;
|
||||
else if (f == 1 && c== '/' )
|
||||
break;
|
||||
else
|
||||
f=0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ungetc();
|
||||
ungetc();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -243,8 +243,8 @@ pstring netlist_parser::getname2(char sep1, char sep2)
|
||||
|
||||
while ((c != sep1) && (c != sep2))
|
||||
{
|
||||
*p1++ = c;
|
||||
c = getc();
|
||||
*p1++ = c;
|
||||
c = getc();
|
||||
}
|
||||
*p1 = 0;
|
||||
ungetc();
|
||||
@ -278,21 +278,21 @@ double netlist_parser::eval_param()
|
||||
f = i;
|
||||
ret = s.substr(strlen(macs[f])).as_double(&e);
|
||||
if ((f>0) && e)
|
||||
m_setup.netlist().xfatalerror("Parser: Error with parameter ...\n");
|
||||
if (f>0)
|
||||
check_char(')');
|
||||
m_setup.netlist().xfatalerror("Parser: Error with parameter ...\n");
|
||||
if (f>0)
|
||||
check_char(')');
|
||||
return ret * facs[f];
|
||||
}
|
||||
|
||||
unsigned char netlist_parser::getc()
|
||||
{
|
||||
if (*m_px)
|
||||
return *(m_px++);
|
||||
else
|
||||
return *m_px;
|
||||
if (*m_px)
|
||||
return *(m_px++);
|
||||
else
|
||||
return *m_px;
|
||||
}
|
||||
|
||||
void netlist_parser::ungetc()
|
||||
{
|
||||
m_px--;
|
||||
m_px--;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
class netlist_parser
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_parser)
|
||||
NETLIST_PREVENT_COPYING(netlist_parser)
|
||||
public:
|
||||
netlist_parser(netlist_setup_t &setup)
|
||||
: m_setup(setup) {}
|
||||
@ -20,10 +20,10 @@ public:
|
||||
void parse(const char *buf);
|
||||
void net_alias();
|
||||
void netdev_param();
|
||||
void net_c();
|
||||
void net_c();
|
||||
void netdev_const(const pstring &dev_name);
|
||||
void netdev_device(const pstring &dev_type);
|
||||
void netdev_device(const pstring &dev_type, const pstring &default_param, bool isString = false);
|
||||
void netdev_device(const pstring &dev_type, const pstring &default_param, bool isString = false);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -17,9 +17,9 @@ static NETLIST_START(base)
|
||||
NETDEV_TTL_CONST(ttllow, 0)
|
||||
NETDEV_ANALOG_CONST(NC, NETLIST_HIGHIMP_V)
|
||||
|
||||
NET_MODEL(".model 1N914 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)")
|
||||
NET_MODEL(".model 1N4148 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)")
|
||||
NET_MODEL(".MODEL BC237B NPN(IS=1.8E-14 ISE=5.0E-14 ISC=1.72E-13 XTI=3 BF=400 BR=35.5 IKF=0.14 IKR=0.03 XTB=1.5 VAF=80 VAR=12.5 VJE=0.58 VJC=0.54 RE=0.6 RC=0.25 RB=0.56 CJE=13E-12 CJC=4E-12 XCJC=0.75 FC=0.5 NF=0.9955 NR=1.005 NE=1.46 NC=1.27 MJE=0.33 MJC=0.33 TF=0.64E-9 TR=50.72E-9 EG=1.11 KF=0 AF=1 VCEO=45V ICRATING=100M MFG=ZETEX)")
|
||||
NET_MODEL(".model 1N914 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)")
|
||||
NET_MODEL(".model 1N4148 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)")
|
||||
NET_MODEL(".MODEL BC237B NPN(IS=1.8E-14 ISE=5.0E-14 ISC=1.72E-13 XTI=3 BF=400 BR=35.5 IKF=0.14 IKR=0.03 XTB=1.5 VAF=80 VAR=12.5 VJE=0.58 VJC=0.54 RE=0.6 RC=0.25 RB=0.56 CJE=13E-12 CJC=4E-12 XCJC=0.75 FC=0.5 NF=0.9955 NR=1.005 NE=1.46 NC=1.27 MJE=0.33 MJC=0.33 TF=0.64E-9 TR=50.72E-9 EG=1.11 KF=0 AF=1 VCEO=45V ICRATING=100M MFG=ZETEX)")
|
||||
|
||||
NETLIST_END
|
||||
|
||||
@ -30,15 +30,15 @@ NETLIST_END
|
||||
|
||||
netlist_setup_t::netlist_setup_t(netlist_base_t &netlist)
|
||||
: m_netlist(netlist)
|
||||
, m_proxy_cnt(0)
|
||||
, m_proxy_cnt(0)
|
||||
{
|
||||
netlist.set_setup(this);
|
||||
netlist.set_setup(this);
|
||||
}
|
||||
|
||||
void netlist_setup_t::init()
|
||||
{
|
||||
m_factory.initialize();
|
||||
NETLIST_NAME(base)(*this);
|
||||
m_factory.initialize();
|
||||
NETLIST_NAME(base)(*this);
|
||||
}
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ netlist_setup_t::~netlist_setup_t()
|
||||
netlist_device_t *netlist_setup_t::register_dev(netlist_device_t *dev, const pstring &name)
|
||||
{
|
||||
if (!(netlist().m_devices.add(name, dev, false)==TMERR_NONE))
|
||||
netlist().xfatalerror("Error adding %s to device list\n", name.cstr());
|
||||
netlist().xfatalerror("Error adding %s to device list\n", name.cstr());
|
||||
return dev;
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ void netlist_setup_t::remove_dev(const pstring &name)
|
||||
netlist_device_t *dev = netlist().m_devices.find(name);
|
||||
pstring temp = name + ".";
|
||||
if (dev == NULL)
|
||||
netlist().xfatalerror("Device %s does not exist\n", name.cstr());
|
||||
netlist().xfatalerror("Device %s does not exist\n", name.cstr());
|
||||
|
||||
//remove_start_with<tagmap_input_t>(m_inputs, temp);
|
||||
remove_start_with<tagmap_terminal_t>(m_terminals, temp);
|
||||
@ -94,193 +94,193 @@ void netlist_setup_t::remove_dev(const pstring &name)
|
||||
tagmap_link_t::entry_t *p = m_links.first();
|
||||
while (p != NULL)
|
||||
{
|
||||
tagmap_link_t::entry_t *n = m_links.next(p);
|
||||
if (temp.equals(p->object().e1.substr(0,temp.len())) || temp.equals(p->object().e2.substr(0,temp.len())))
|
||||
m_links.remove(p->object());
|
||||
p = n;
|
||||
tagmap_link_t::entry_t *n = m_links.next(p);
|
||||
if (temp.equals(p->object().e1.substr(0,temp.len())) || temp.equals(p->object().e2.substr(0,temp.len())))
|
||||
m_links.remove(p->object());
|
||||
p = n;
|
||||
}
|
||||
netlist().m_devices.remove(name);
|
||||
}
|
||||
|
||||
void netlist_setup_t::register_model(const pstring &model)
|
||||
{
|
||||
m_models.add(model);
|
||||
m_models.add(model);
|
||||
}
|
||||
|
||||
void netlist_setup_t::register_alias(const pstring &alias, const pstring &out)
|
||||
{
|
||||
//if (!(m_alias.add(alias, new nstring(out), false)==TMERR_NONE))
|
||||
//if (!(m_alias.add(alias, new nstring(out), false)==TMERR_NONE))
|
||||
if (!(m_alias.add(alias, out, false)==TMERR_NONE))
|
||||
netlist().xfatalerror("Error adding alias %s to alias list\n", alias.cstr());
|
||||
netlist().xfatalerror("Error adding alias %s to alias list\n", alias.cstr());
|
||||
}
|
||||
|
||||
pstring netlist_setup_t::objtype_as_astr(netlist_object_t &in)
|
||||
{
|
||||
switch (in.type())
|
||||
{
|
||||
case netlist_terminal_t::TERMINAL:
|
||||
return "TERMINAL";
|
||||
break;
|
||||
case netlist_terminal_t::INPUT:
|
||||
return "INPUT";
|
||||
break;
|
||||
case netlist_terminal_t::OUTPUT:
|
||||
return "OUTPUT";
|
||||
break;
|
||||
case netlist_terminal_t::NET:
|
||||
return "NET";
|
||||
break;
|
||||
case netlist_terminal_t::PARAM:
|
||||
return "PARAM";
|
||||
break;
|
||||
case netlist_terminal_t::DEVICE:
|
||||
return "DEVICE";
|
||||
break;
|
||||
case netlist_terminal_t::NETLIST:
|
||||
return "NETLIST";
|
||||
break;
|
||||
}
|
||||
// FIXME: noreturn
|
||||
netlist().xfatalerror("Unknown object type %d\n", in.type());
|
||||
return "Error";
|
||||
switch (in.type())
|
||||
{
|
||||
case netlist_terminal_t::TERMINAL:
|
||||
return "TERMINAL";
|
||||
break;
|
||||
case netlist_terminal_t::INPUT:
|
||||
return "INPUT";
|
||||
break;
|
||||
case netlist_terminal_t::OUTPUT:
|
||||
return "OUTPUT";
|
||||
break;
|
||||
case netlist_terminal_t::NET:
|
||||
return "NET";
|
||||
break;
|
||||
case netlist_terminal_t::PARAM:
|
||||
return "PARAM";
|
||||
break;
|
||||
case netlist_terminal_t::DEVICE:
|
||||
return "DEVICE";
|
||||
break;
|
||||
case netlist_terminal_t::NETLIST:
|
||||
return "NETLIST";
|
||||
break;
|
||||
}
|
||||
// FIXME: noreturn
|
||||
netlist().xfatalerror("Unknown object type %d\n", in.type());
|
||||
return "Error";
|
||||
}
|
||||
|
||||
void netlist_setup_t::register_object(netlist_device_t &dev, netlist_core_device_t &upd_dev, const pstring &name, netlist_object_t &obj, const netlist_input_t::state_e state)
|
||||
{
|
||||
switch (obj.type())
|
||||
{
|
||||
case netlist_terminal_t::TERMINAL:
|
||||
case netlist_terminal_t::INPUT:
|
||||
case netlist_terminal_t::OUTPUT:
|
||||
{
|
||||
netlist_core_terminal_t &term = dynamic_cast<netlist_core_terminal_t &>(obj);
|
||||
if (obj.isType(netlist_terminal_t::OUTPUT))
|
||||
dynamic_cast<netlist_output_t &>(term).init_object(upd_dev, dev.name() + "." + name);
|
||||
else
|
||||
term.init_object(upd_dev, dev.name() + "." + name, state);
|
||||
switch (obj.type())
|
||||
{
|
||||
case netlist_terminal_t::TERMINAL:
|
||||
case netlist_terminal_t::INPUT:
|
||||
case netlist_terminal_t::OUTPUT:
|
||||
{
|
||||
netlist_core_terminal_t &term = dynamic_cast<netlist_core_terminal_t &>(obj);
|
||||
if (obj.isType(netlist_terminal_t::OUTPUT))
|
||||
dynamic_cast<netlist_output_t &>(term).init_object(upd_dev, dev.name() + "." + name);
|
||||
else
|
||||
term.init_object(upd_dev, dev.name() + "." + name, state);
|
||||
|
||||
if (!(m_terminals.add(term.name(), &term, false)==TMERR_NONE))
|
||||
netlist().xfatalerror("Error adding %s %s to terminal list\n", objtype_as_astr(term).cstr(), term.name().cstr());
|
||||
NL_VERBOSE_OUT(("%s %s\n", objtype_as_astr(term).cstr(), name.cstr()));
|
||||
}
|
||||
break;
|
||||
case netlist_terminal_t::NET:
|
||||
break;
|
||||
case netlist_terminal_t::PARAM:
|
||||
{
|
||||
netlist_param_t ¶m = dynamic_cast<netlist_param_t &>(obj);
|
||||
const pstring val = m_params_temp.find(name);
|
||||
if (val != "")
|
||||
{
|
||||
switch (param.param_type())
|
||||
{
|
||||
case netlist_param_t::DOUBLE:
|
||||
{
|
||||
NL_VERBOSE_OUT(("Found parameter ... %s : %s\n", temp.cstr(), val->cstr()));
|
||||
double vald = 0;
|
||||
if (sscanf(val.cstr(), "%lf", &vald) != 1)
|
||||
netlist().xfatalerror("Invalid number conversion %s : %s\n", name.cstr(), val.cstr());
|
||||
dynamic_cast<netlist_param_double_t &>(param).initial(vald);
|
||||
}
|
||||
break;
|
||||
case netlist_param_t::INTEGER:
|
||||
case netlist_param_t::LOGIC:
|
||||
{
|
||||
NL_VERBOSE_OUT(("Found parameter ... %s : %s\n", name.cstr(), val->cstr()));
|
||||
int vald = 0;
|
||||
if (sscanf(val.cstr(), "%d", &vald) != 1)
|
||||
netlist().xfatalerror("Invalid number conversion %s : %s\n", name.cstr(), val.cstr());
|
||||
dynamic_cast<netlist_param_int_t &>(param).initial(vald);
|
||||
}
|
||||
break;
|
||||
case netlist_param_t::STRING:
|
||||
{
|
||||
dynamic_cast<netlist_param_str_t &>(param).initial(val);
|
||||
}
|
||||
break;
|
||||
case netlist_param_t::MODEL:
|
||||
{
|
||||
pstring search = (".model " + val + " ").ucase();
|
||||
bool found = false;
|
||||
for (int i=0; i < m_models.count(); i++)
|
||||
{
|
||||
if (m_models[i].ucase().startsWith(search))
|
||||
{
|
||||
int pl=m_models[i].find("(");
|
||||
int pr=m_models[i].find("(");
|
||||
dynamic_cast<netlist_param_model_t &>(param).initial(m_models[i].substr(pl+1,pr-pl-1));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
netlist().xfatalerror("Model %s not found\n", val.cstr());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
netlist().xfatalerror("Parameter is not supported %s : %s\n", name.cstr(), val.cstr());
|
||||
}
|
||||
}
|
||||
if (!(m_params.add(name, ¶m, false)==TMERR_NONE))
|
||||
netlist().xfatalerror("Error adding parameter %s to parameter list\n", name.cstr());
|
||||
}
|
||||
break;
|
||||
case netlist_terminal_t::DEVICE:
|
||||
netlist().xfatalerror("Device registration not yet supported - \n", name.cstr());
|
||||
break;
|
||||
case netlist_terminal_t::NETLIST:
|
||||
netlist().xfatalerror("Netlist registration not yet supported - \n", name.cstr());
|
||||
break;
|
||||
}
|
||||
if (!(m_terminals.add(term.name(), &term, false)==TMERR_NONE))
|
||||
netlist().xfatalerror("Error adding %s %s to terminal list\n", objtype_as_astr(term).cstr(), term.name().cstr());
|
||||
NL_VERBOSE_OUT(("%s %s\n", objtype_as_astr(term).cstr(), name.cstr()));
|
||||
}
|
||||
break;
|
||||
case netlist_terminal_t::NET:
|
||||
break;
|
||||
case netlist_terminal_t::PARAM:
|
||||
{
|
||||
netlist_param_t ¶m = dynamic_cast<netlist_param_t &>(obj);
|
||||
const pstring val = m_params_temp.find(name);
|
||||
if (val != "")
|
||||
{
|
||||
switch (param.param_type())
|
||||
{
|
||||
case netlist_param_t::DOUBLE:
|
||||
{
|
||||
NL_VERBOSE_OUT(("Found parameter ... %s : %s\n", temp.cstr(), val->cstr()));
|
||||
double vald = 0;
|
||||
if (sscanf(val.cstr(), "%lf", &vald) != 1)
|
||||
netlist().xfatalerror("Invalid number conversion %s : %s\n", name.cstr(), val.cstr());
|
||||
dynamic_cast<netlist_param_double_t &>(param).initial(vald);
|
||||
}
|
||||
break;
|
||||
case netlist_param_t::INTEGER:
|
||||
case netlist_param_t::LOGIC:
|
||||
{
|
||||
NL_VERBOSE_OUT(("Found parameter ... %s : %s\n", name.cstr(), val->cstr()));
|
||||
int vald = 0;
|
||||
if (sscanf(val.cstr(), "%d", &vald) != 1)
|
||||
netlist().xfatalerror("Invalid number conversion %s : %s\n", name.cstr(), val.cstr());
|
||||
dynamic_cast<netlist_param_int_t &>(param).initial(vald);
|
||||
}
|
||||
break;
|
||||
case netlist_param_t::STRING:
|
||||
{
|
||||
dynamic_cast<netlist_param_str_t &>(param).initial(val);
|
||||
}
|
||||
break;
|
||||
case netlist_param_t::MODEL:
|
||||
{
|
||||
pstring search = (".model " + val + " ").ucase();
|
||||
bool found = false;
|
||||
for (int i=0; i < m_models.count(); i++)
|
||||
{
|
||||
if (m_models[i].ucase().startsWith(search))
|
||||
{
|
||||
int pl=m_models[i].find("(");
|
||||
int pr=m_models[i].find("(");
|
||||
dynamic_cast<netlist_param_model_t &>(param).initial(m_models[i].substr(pl+1,pr-pl-1));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
netlist().xfatalerror("Model %s not found\n", val.cstr());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
netlist().xfatalerror("Parameter is not supported %s : %s\n", name.cstr(), val.cstr());
|
||||
}
|
||||
}
|
||||
if (!(m_params.add(name, ¶m, false)==TMERR_NONE))
|
||||
netlist().xfatalerror("Error adding parameter %s to parameter list\n", name.cstr());
|
||||
}
|
||||
break;
|
||||
case netlist_terminal_t::DEVICE:
|
||||
netlist().xfatalerror("Device registration not yet supported - \n", name.cstr());
|
||||
break;
|
||||
case netlist_terminal_t::NETLIST:
|
||||
netlist().xfatalerror("Netlist registration not yet supported - \n", name.cstr());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void netlist_setup_t::register_link(const pstring &sin, const pstring &sout)
|
||||
{
|
||||
link_t temp = link_t(sin, sout);
|
||||
NL_VERBOSE_OUT(("link %s <== %s\n", sin.cstr(), sout.cstr()));
|
||||
m_links.add(temp);
|
||||
m_links.add(temp);
|
||||
//if (!(m_links.add(sin + "." + sout, temp, false)==TMERR_NONE))
|
||||
// fatalerror("Error adding link %s<==%s to link list\n", sin.cstr(), sout.cstr());
|
||||
// fatalerror("Error adding link %s<==%s to link list\n", sin.cstr(), sout.cstr());
|
||||
}
|
||||
|
||||
void netlist_setup_t::register_param(const pstring ¶m, const double value)
|
||||
{
|
||||
// FIXME: there should be a better way
|
||||
register_param(param, pstring::sprintf("%.9e", value));
|
||||
// FIXME: there should be a better way
|
||||
register_param(param, pstring::sprintf("%.9e", value));
|
||||
}
|
||||
|
||||
void netlist_setup_t::register_param(const pstring ¶m, const pstring &value)
|
||||
{
|
||||
//if (!(m_params_temp.add(param, new nstring(value), false)==TMERR_NONE))
|
||||
if (!(m_params_temp.add(param, value, false)==TMERR_NONE))
|
||||
netlist().xfatalerror("Error adding parameter %s to parameter list\n", param.cstr());
|
||||
//if (!(m_params_temp.add(param, new nstring(value), false)==TMERR_NONE))
|
||||
if (!(m_params_temp.add(param, value, false)==TMERR_NONE))
|
||||
netlist().xfatalerror("Error adding parameter %s to parameter list\n", param.cstr());
|
||||
}
|
||||
|
||||
const pstring netlist_setup_t::resolve_alias(const pstring &name) const
|
||||
{
|
||||
pstring temp = name;
|
||||
pstring ret;
|
||||
pstring temp = name;
|
||||
pstring ret;
|
||||
|
||||
/* FIXME: Detect endless loop */
|
||||
do {
|
||||
ret = temp;
|
||||
temp = m_alias.find(ret);
|
||||
} while (temp != "");
|
||||
/* FIXME: Detect endless loop */
|
||||
do {
|
||||
ret = temp;
|
||||
temp = m_alias.find(ret);
|
||||
} while (temp != "");
|
||||
|
||||
int p = ret.find(".[");
|
||||
int p = ret.find(".[");
|
||||
if (p > 0)
|
||||
{
|
||||
pstring dname = ret;
|
||||
netlist_device_t *dev = netlist().m_devices.find(dname.substr(0,p));
|
||||
if (dev == NULL)
|
||||
netlist().xfatalerror("Device for %s not found\n", name.cstr());
|
||||
int c = atoi(ret.substr(p+2,ret.len()-p-3));
|
||||
temp = dev->name() + "." + dev->m_terminals[c];
|
||||
// reresolve ....
|
||||
do {
|
||||
ret = temp;
|
||||
temp = m_alias.find(ret);
|
||||
} while (temp != "");
|
||||
pstring dname = ret;
|
||||
netlist_device_t *dev = netlist().m_devices.find(dname.substr(0,p));
|
||||
if (dev == NULL)
|
||||
netlist().xfatalerror("Device for %s not found\n", name.cstr());
|
||||
int c = atoi(ret.substr(p+2,ret.len()-p-3));
|
||||
temp = dev->name() + "." + dev->m_terminals[c];
|
||||
// reresolve ....
|
||||
do {
|
||||
ret = temp;
|
||||
temp = m_alias.find(ret);
|
||||
} while (temp != "");
|
||||
}
|
||||
|
||||
NL_VERBOSE_OUT(("%s==>%s\n", name.cstr(), ret.cstr()));
|
||||
@ -289,22 +289,22 @@ const pstring netlist_setup_t::resolve_alias(const pstring &name) const
|
||||
|
||||
netlist_core_terminal_t *netlist_setup_t::find_terminal(const pstring &terminal_in, bool required)
|
||||
{
|
||||
const pstring &tname = resolve_alias(terminal_in);
|
||||
netlist_core_terminal_t *ret;
|
||||
const pstring &tname = resolve_alias(terminal_in);
|
||||
netlist_core_terminal_t *ret;
|
||||
|
||||
ret = m_terminals.find(tname);
|
||||
/* look for default */
|
||||
if (ret == NULL)
|
||||
{
|
||||
/* look for ".Q" std output */
|
||||
pstring s = tname + ".Q";
|
||||
ret = m_terminals.find(s);
|
||||
}
|
||||
if (ret == NULL && required)
|
||||
netlist().xfatalerror("terminal %s(%s) not found!\n", terminal_in.cstr(), tname.cstr());
|
||||
if (ret != NULL)
|
||||
NL_VERBOSE_OUT(("Found input %s\n", tname.cstr()));
|
||||
return ret;
|
||||
ret = m_terminals.find(tname);
|
||||
/* look for default */
|
||||
if (ret == NULL)
|
||||
{
|
||||
/* look for ".Q" std output */
|
||||
pstring s = tname + ".Q";
|
||||
ret = m_terminals.find(s);
|
||||
}
|
||||
if (ret == NULL && required)
|
||||
netlist().xfatalerror("terminal %s(%s) not found!\n", terminal_in.cstr(), tname.cstr());
|
||||
if (ret != NULL)
|
||||
NL_VERBOSE_OUT(("Found input %s\n", tname.cstr()));
|
||||
return ret;
|
||||
}
|
||||
|
||||
netlist_core_terminal_t *netlist_setup_t::find_terminal(const pstring &terminal_in, netlist_object_t::type_t atype, bool required)
|
||||
@ -322,15 +322,15 @@ netlist_core_terminal_t *netlist_setup_t::find_terminal(const pstring &terminal_
|
||||
}
|
||||
if (ret == NULL && required)
|
||||
netlist().xfatalerror("terminal %s(%s) not found!\n", terminal_in.cstr(), tname.cstr());
|
||||
if (ret != NULL && ret->type() != atype)
|
||||
{
|
||||
if (required)
|
||||
netlist().xfatalerror("object %s(%s) found but wrong type\n", terminal_in.cstr(), tname.cstr());
|
||||
else
|
||||
ret = NULL;
|
||||
}
|
||||
if (ret != NULL)
|
||||
NL_VERBOSE_OUT(("Found input %s\n", tname.cstr()));
|
||||
if (ret != NULL && ret->type() != atype)
|
||||
{
|
||||
if (required)
|
||||
netlist().xfatalerror("object %s(%s) found but wrong type\n", terminal_in.cstr(), tname.cstr());
|
||||
else
|
||||
ret = NULL;
|
||||
}
|
||||
if (ret != NULL)
|
||||
NL_VERBOSE_OUT(("Found input %s\n", tname.cstr()));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -341,269 +341,267 @@ netlist_param_t *netlist_setup_t::find_param(const pstring ¶m_in, bool requi
|
||||
|
||||
ret = m_params.find(outname);
|
||||
if (ret == NULL && required)
|
||||
netlist().xfatalerror("parameter %s(%s) not found!\n", param_in.cstr(), outname.cstr());
|
||||
netlist().xfatalerror("parameter %s(%s) not found!\n", param_in.cstr(), outname.cstr());
|
||||
if (ret != NULL)
|
||||
NL_VERBOSE_OUT(("Found parameter %s\n", outname.cstr()));
|
||||
NL_VERBOSE_OUT(("Found parameter %s\n", outname.cstr()));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void netlist_setup_t::connect_input_output(netlist_input_t &in, netlist_output_t &out)
|
||||
{
|
||||
if (out.isFamily(netlist_terminal_t::ANALOG) && in.isFamily(netlist_terminal_t::LOGIC))
|
||||
{
|
||||
nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(in);
|
||||
pstring x = pstring::sprintf("proxy_ad_%d", m_proxy_cnt);
|
||||
m_proxy_cnt++;
|
||||
if (out.isFamily(netlist_terminal_t::ANALOG) && in.isFamily(netlist_terminal_t::LOGIC))
|
||||
{
|
||||
nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(in);
|
||||
pstring x = pstring::sprintf("proxy_ad_%d", m_proxy_cnt);
|
||||
m_proxy_cnt++;
|
||||
|
||||
proxy->init(netlist(), x);
|
||||
register_dev(proxy, x);
|
||||
proxy->init(netlist(), x);
|
||||
register_dev(proxy, x);
|
||||
|
||||
proxy->m_Q.net().register_con(in);
|
||||
out.net().register_con(proxy->m_I);
|
||||
proxy->m_Q.net().register_con(in);
|
||||
out.net().register_con(proxy->m_I);
|
||||
|
||||
}
|
||||
else if (out.isFamily(netlist_terminal_t::LOGIC) && in.isFamily(netlist_terminal_t::ANALOG))
|
||||
{
|
||||
nld_d_to_a_proxy *proxy = new nld_d_to_a_proxy(out);
|
||||
pstring x = pstring::sprintf("proxy_da_%d", m_proxy_cnt);
|
||||
m_proxy_cnt++;
|
||||
}
|
||||
else if (out.isFamily(netlist_terminal_t::LOGIC) && in.isFamily(netlist_terminal_t::ANALOG))
|
||||
{
|
||||
nld_d_to_a_proxy *proxy = new nld_d_to_a_proxy(out);
|
||||
pstring x = pstring::sprintf("proxy_da_%d", m_proxy_cnt);
|
||||
m_proxy_cnt++;
|
||||
|
||||
proxy->init(netlist(), x);
|
||||
register_dev(proxy, x);
|
||||
proxy->init(netlist(), x);
|
||||
register_dev(proxy, x);
|
||||
|
||||
proxy->m_Q.net().register_con(in);
|
||||
out.net().register_con(proxy->m_I);
|
||||
}
|
||||
else
|
||||
{
|
||||
out.net().register_con(in);
|
||||
}
|
||||
proxy->m_Q.net().register_con(in);
|
||||
out.net().register_con(proxy->m_I);
|
||||
}
|
||||
else
|
||||
{
|
||||
out.net().register_con(in);
|
||||
}
|
||||
}
|
||||
|
||||
void netlist_setup_t::connect_terminal_input(netlist_terminal_t &term, netlist_input_t &inp)
|
||||
{
|
||||
if (inp.isFamily(netlist_terminal_t::ANALOG))
|
||||
{
|
||||
connect_terminals(inp, term);
|
||||
}
|
||||
else if (inp.isFamily(netlist_terminal_t::LOGIC))
|
||||
{
|
||||
NL_VERBOSE_OUT(("connect_terminal_input: connecting proxy\n"));
|
||||
nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(inp);
|
||||
pstring x = pstring::sprintf("proxy_da_%d", m_proxy_cnt);
|
||||
m_proxy_cnt++;
|
||||
if (inp.isFamily(netlist_terminal_t::ANALOG))
|
||||
{
|
||||
connect_terminals(inp, term);
|
||||
}
|
||||
else if (inp.isFamily(netlist_terminal_t::LOGIC))
|
||||
{
|
||||
NL_VERBOSE_OUT(("connect_terminal_input: connecting proxy\n"));
|
||||
nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(inp);
|
||||
pstring x = pstring::sprintf("proxy_da_%d", m_proxy_cnt);
|
||||
m_proxy_cnt++;
|
||||
|
||||
proxy->init(netlist(), x);
|
||||
register_dev(proxy, x);
|
||||
proxy->init(netlist(), x);
|
||||
register_dev(proxy, x);
|
||||
|
||||
connect_terminals(term, proxy->m_I);
|
||||
connect_terminals(term, proxy->m_I);
|
||||
|
||||
if (inp.has_net())
|
||||
//fatalerror("logic inputs can only belong to one net!\n");
|
||||
proxy->m_Q.net().merge_net(&inp.net());
|
||||
else
|
||||
proxy->m_Q.net().register_con(inp);
|
||||
}
|
||||
else
|
||||
{
|
||||
netlist().xfatalerror("Netlist: Severe Error");
|
||||
}
|
||||
if (inp.has_net())
|
||||
//fatalerror("logic inputs can only belong to one net!\n");
|
||||
proxy->m_Q.net().merge_net(&inp.net());
|
||||
else
|
||||
proxy->m_Q.net().register_con(inp);
|
||||
}
|
||||
else
|
||||
{
|
||||
netlist().xfatalerror("Netlist: Severe Error");
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: optimize code ...
|
||||
void netlist_setup_t::connect_terminal_output(netlist_terminal_t &in, netlist_output_t &out)
|
||||
{
|
||||
if (out.isFamily(netlist_terminal_t::ANALOG))
|
||||
{
|
||||
/* no proxy needed, just merge existing terminal net */
|
||||
if (in.has_net())
|
||||
out.net().merge_net(&in.net());
|
||||
else
|
||||
out.net().register_con(in);
|
||||
if (out.isFamily(netlist_terminal_t::ANALOG))
|
||||
{
|
||||
/* no proxy needed, just merge existing terminal net */
|
||||
if (in.has_net())
|
||||
out.net().merge_net(&in.net());
|
||||
else
|
||||
out.net().register_con(in);
|
||||
|
||||
}
|
||||
else if (out.isFamily(netlist_terminal_t::LOGIC))
|
||||
{
|
||||
NL_VERBOSE_OUT(("connect_terminal_output: connecting proxy\n"));
|
||||
nld_d_to_a_proxy *proxy = new nld_d_to_a_proxy(out);
|
||||
pstring x = pstring::sprintf("proxy_da_%d", m_proxy_cnt);
|
||||
m_proxy_cnt++;
|
||||
}
|
||||
else if (out.isFamily(netlist_terminal_t::LOGIC))
|
||||
{
|
||||
NL_VERBOSE_OUT(("connect_terminal_output: connecting proxy\n"));
|
||||
nld_d_to_a_proxy *proxy = new nld_d_to_a_proxy(out);
|
||||
pstring x = pstring::sprintf("proxy_da_%d", m_proxy_cnt);
|
||||
m_proxy_cnt++;
|
||||
|
||||
proxy->init(netlist(), x);
|
||||
register_dev(proxy, x);
|
||||
proxy->init(netlist(), x);
|
||||
register_dev(proxy, x);
|
||||
|
||||
out.net().register_con(proxy->m_I);
|
||||
out.net().register_con(proxy->m_I);
|
||||
|
||||
if (in.has_net())
|
||||
proxy->m_Q.net().merge_net(&in.net());
|
||||
else
|
||||
proxy->m_Q.net().register_con(in);
|
||||
}
|
||||
else
|
||||
{
|
||||
netlist().xfatalerror("Netlist: Severe Error");
|
||||
}
|
||||
if (in.has_net())
|
||||
proxy->m_Q.net().merge_net(&in.net());
|
||||
else
|
||||
proxy->m_Q.net().register_con(in);
|
||||
}
|
||||
else
|
||||
{
|
||||
netlist().xfatalerror("Netlist: Severe Error");
|
||||
}
|
||||
}
|
||||
|
||||
void netlist_setup_t::connect_terminals(netlist_core_terminal_t &t1, netlist_core_terminal_t &t2)
|
||||
{
|
||||
//assert(in.isType(netlist_terminal_t::TERMINAL));
|
||||
//assert(out.isType(netlist_terminal_t::TERMINAL));
|
||||
//assert(in.isType(netlist_terminal_t::TERMINAL));
|
||||
//assert(out.isType(netlist_terminal_t::TERMINAL));
|
||||
|
||||
if (t1.has_net() && t2.has_net())
|
||||
{
|
||||
NL_VERBOSE_OUT(("T2 and T1 have net\n"));
|
||||
t1.net().merge_net(&t2.net());
|
||||
}
|
||||
else if (t2.has_net())
|
||||
{
|
||||
NL_VERBOSE_OUT(("T2 has net\n"));
|
||||
t2.net().register_con(t1);
|
||||
}
|
||||
else if (t1.has_net())
|
||||
{
|
||||
NL_VERBOSE_OUT(("T1 has net\n"));
|
||||
t1.net().register_con(t2);
|
||||
}
|
||||
else
|
||||
{
|
||||
NL_VERBOSE_OUT(("adding net ...\n"));
|
||||
netlist_net_t *anet = new netlist_net_t(netlist_object_t::NET, netlist_object_t::ANALOG);
|
||||
t1.set_net(*anet);
|
||||
//m_netlist.solver()->m_nets.add(anet);
|
||||
// FIXME: Nets should have a unique name
|
||||
t1.net().init_object(netlist(),"net." + t1.name() );
|
||||
t1.net().register_con(t2);
|
||||
t1.net().register_con(t1);
|
||||
}
|
||||
if (t1.has_net() && t2.has_net())
|
||||
{
|
||||
NL_VERBOSE_OUT(("T2 and T1 have net\n"));
|
||||
t1.net().merge_net(&t2.net());
|
||||
}
|
||||
else if (t2.has_net())
|
||||
{
|
||||
NL_VERBOSE_OUT(("T2 has net\n"));
|
||||
t2.net().register_con(t1);
|
||||
}
|
||||
else if (t1.has_net())
|
||||
{
|
||||
NL_VERBOSE_OUT(("T1 has net\n"));
|
||||
t1.net().register_con(t2);
|
||||
}
|
||||
else
|
||||
{
|
||||
NL_VERBOSE_OUT(("adding net ...\n"));
|
||||
netlist_net_t *anet = new netlist_net_t(netlist_object_t::NET, netlist_object_t::ANALOG);
|
||||
t1.set_net(*anet);
|
||||
//m_netlist.solver()->m_nets.add(anet);
|
||||
// FIXME: Nets should have a unique name
|
||||
t1.net().init_object(netlist(),"net." + t1.name() );
|
||||
t1.net().register_con(t2);
|
||||
t1.net().register_con(t1);
|
||||
}
|
||||
}
|
||||
|
||||
void netlist_setup_t::connect(netlist_core_terminal_t &t1, netlist_core_terminal_t &t2)
|
||||
{
|
||||
NL_VERBOSE_OUT(("Connecting %s to %s\n", t1.name().cstr(), t2.name().cstr()));
|
||||
// FIXME: amend device design so that warnings can be turned into errors
|
||||
// Only variable inputs have this issue
|
||||
if (t1.isType(netlist_core_terminal_t::OUTPUT) && t2.isType(netlist_core_terminal_t::INPUT))
|
||||
{
|
||||
if (t2.has_net())
|
||||
NL_VERBOSE_OUT(("Input %s already connected\n", t2.name().cstr()));
|
||||
connect_input_output(dynamic_cast<netlist_input_t &>(t2), dynamic_cast<netlist_output_t &>(t1));
|
||||
}
|
||||
else if (t1.isType(netlist_core_terminal_t::INPUT) && t2.isType(netlist_core_terminal_t::OUTPUT))
|
||||
{
|
||||
if (t1.has_net())
|
||||
NL_VERBOSE_OUT(("Input %s already connected\n", t1.name().cstr()));
|
||||
connect_input_output(dynamic_cast<netlist_input_t &>(t1), dynamic_cast<netlist_output_t &>(t2));
|
||||
}
|
||||
else if (t1.isType(netlist_core_terminal_t::OUTPUT) && t2.isType(netlist_core_terminal_t::TERMINAL))
|
||||
{
|
||||
connect_terminal_output(dynamic_cast<netlist_terminal_t &>(t2), dynamic_cast<netlist_output_t &>(t1));
|
||||
}
|
||||
else if (t1.isType(netlist_core_terminal_t::TERMINAL) && t2.isType(netlist_core_terminal_t::OUTPUT))
|
||||
{
|
||||
connect_terminal_output(dynamic_cast<netlist_terminal_t &>(t1), dynamic_cast<netlist_output_t &>(t2));
|
||||
}
|
||||
else if (t1.isType(netlist_core_terminal_t::INPUT) && t2.isType(netlist_core_terminal_t::TERMINAL))
|
||||
{
|
||||
connect_terminal_input(dynamic_cast<netlist_terminal_t &>(t2), dynamic_cast<netlist_input_t &>(t1));
|
||||
}
|
||||
else if (t1.isType(netlist_core_terminal_t::TERMINAL) && t2.isType(netlist_core_terminal_t::INPUT))
|
||||
{
|
||||
connect_terminal_input(dynamic_cast<netlist_terminal_t &>(t1), dynamic_cast<netlist_input_t &>(t2));
|
||||
}
|
||||
else if (t1.isType(netlist_core_terminal_t::TERMINAL) && t2.isType(netlist_core_terminal_t::TERMINAL))
|
||||
{
|
||||
connect_terminals(dynamic_cast<netlist_terminal_t &>(t1), dynamic_cast<netlist_terminal_t &>(t2));
|
||||
}
|
||||
else
|
||||
netlist().xfatalerror("Connecting %s to %s not supported!\n", t1.name().cstr(), t2.name().cstr());
|
||||
NL_VERBOSE_OUT(("Connecting %s to %s\n", t1.name().cstr(), t2.name().cstr()));
|
||||
// FIXME: amend device design so that warnings can be turned into errors
|
||||
// Only variable inputs have this issue
|
||||
if (t1.isType(netlist_core_terminal_t::OUTPUT) && t2.isType(netlist_core_terminal_t::INPUT))
|
||||
{
|
||||
if (t2.has_net())
|
||||
NL_VERBOSE_OUT(("Input %s already connected\n", t2.name().cstr()));
|
||||
connect_input_output(dynamic_cast<netlist_input_t &>(t2), dynamic_cast<netlist_output_t &>(t1));
|
||||
}
|
||||
else if (t1.isType(netlist_core_terminal_t::INPUT) && t2.isType(netlist_core_terminal_t::OUTPUT))
|
||||
{
|
||||
if (t1.has_net())
|
||||
NL_VERBOSE_OUT(("Input %s already connected\n", t1.name().cstr()));
|
||||
connect_input_output(dynamic_cast<netlist_input_t &>(t1), dynamic_cast<netlist_output_t &>(t2));
|
||||
}
|
||||
else if (t1.isType(netlist_core_terminal_t::OUTPUT) && t2.isType(netlist_core_terminal_t::TERMINAL))
|
||||
{
|
||||
connect_terminal_output(dynamic_cast<netlist_terminal_t &>(t2), dynamic_cast<netlist_output_t &>(t1));
|
||||
}
|
||||
else if (t1.isType(netlist_core_terminal_t::TERMINAL) && t2.isType(netlist_core_terminal_t::OUTPUT))
|
||||
{
|
||||
connect_terminal_output(dynamic_cast<netlist_terminal_t &>(t1), dynamic_cast<netlist_output_t &>(t2));
|
||||
}
|
||||
else if (t1.isType(netlist_core_terminal_t::INPUT) && t2.isType(netlist_core_terminal_t::TERMINAL))
|
||||
{
|
||||
connect_terminal_input(dynamic_cast<netlist_terminal_t &>(t2), dynamic_cast<netlist_input_t &>(t1));
|
||||
}
|
||||
else if (t1.isType(netlist_core_terminal_t::TERMINAL) && t2.isType(netlist_core_terminal_t::INPUT))
|
||||
{
|
||||
connect_terminal_input(dynamic_cast<netlist_terminal_t &>(t1), dynamic_cast<netlist_input_t &>(t2));
|
||||
}
|
||||
else if (t1.isType(netlist_core_terminal_t::TERMINAL) && t2.isType(netlist_core_terminal_t::TERMINAL))
|
||||
{
|
||||
connect_terminals(dynamic_cast<netlist_terminal_t &>(t1), dynamic_cast<netlist_terminal_t &>(t2));
|
||||
}
|
||||
else
|
||||
netlist().xfatalerror("Connecting %s to %s not supported!\n", t1.name().cstr(), t2.name().cstr());
|
||||
}
|
||||
|
||||
void netlist_setup_t::resolve_inputs()
|
||||
{
|
||||
NL_VERBOSE_OUT(("Resolving ...\n"));
|
||||
for (tagmap_link_t::entry_t *entry = m_links.first(); entry != NULL; entry = m_links.next(entry))
|
||||
{
|
||||
const pstring t1s = entry->object().e1;
|
||||
const pstring t2s = entry->object().e2;
|
||||
netlist_core_terminal_t *t1 = find_terminal(t1s);
|
||||
netlist_core_terminal_t *t2 = find_terminal(t2s);
|
||||
|
||||
NL_VERBOSE_OUT(("Resolving ...\n"));
|
||||
for (tagmap_link_t::entry_t *entry = m_links.first(); entry != NULL; entry = m_links.next(entry))
|
||||
{
|
||||
const pstring t1s = entry->object().e1;
|
||||
const pstring t2s = entry->object().e2;
|
||||
netlist_core_terminal_t *t1 = find_terminal(t1s);
|
||||
netlist_core_terminal_t *t2 = find_terminal(t2s);
|
||||
connect(*t1, *t2);
|
||||
}
|
||||
|
||||
connect(*t1, *t2);
|
||||
}
|
||||
|
||||
/* print all outputs */
|
||||
for (tagmap_terminal_t::entry_t *entry = m_terminals.first(); entry != NULL; entry = m_terminals.next(entry))
|
||||
{
|
||||
ATTR_UNUSED netlist_output_t *out = dynamic_cast<netlist_output_t *>(entry->object());
|
||||
//if (out != NULL)
|
||||
//VERBOSE_OUT(("%s %d\n", out->netdev()->name(), *out->Q_ptr()));
|
||||
}
|
||||
/* print all outputs */
|
||||
for (tagmap_terminal_t::entry_t *entry = m_terminals.first(); entry != NULL; entry = m_terminals.next(entry))
|
||||
{
|
||||
ATTR_UNUSED netlist_output_t *out = dynamic_cast<netlist_output_t *>(entry->object());
|
||||
//if (out != NULL)
|
||||
//VERBOSE_OUT(("%s %d\n", out->netdev()->name(), *out->Q_ptr()));
|
||||
}
|
||||
|
||||
#if 0
|
||||
NL_VERBOSE_OUT(("deleting empty nets ...\n"));
|
||||
NL_VERBOSE_OUT(("deleting empty nets ...\n"));
|
||||
|
||||
// delete empty nets ...
|
||||
for (netlist_net_t::list_t::entry_t *pn = netlist().m_nets.first(); pn != NULL; pn = netlist().m_nets.next(pn))
|
||||
{
|
||||
if (pn->object()->m_head == NULL)
|
||||
{
|
||||
NL_VERBOSE_OUT(("Deleting net ...\n"));
|
||||
netlist_net_t *to_delete = pn->object();
|
||||
netlist().m_nets.remove(to_delete);
|
||||
if (!to_delete->isRailNet())
|
||||
delete to_delete;
|
||||
pn--;
|
||||
}
|
||||
}
|
||||
// delete empty nets ...
|
||||
for (netlist_net_t::list_t::entry_t *pn = netlist().m_nets.first(); pn != NULL; pn = netlist().m_nets.next(pn))
|
||||
{
|
||||
if (pn->object()->m_head == NULL)
|
||||
{
|
||||
NL_VERBOSE_OUT(("Deleting net ...\n"));
|
||||
netlist_net_t *to_delete = pn->object();
|
||||
netlist().m_nets.remove(to_delete);
|
||||
if (!to_delete->isRailNet())
|
||||
delete to_delete;
|
||||
pn--;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (m_netlist.solver() != NULL)
|
||||
m_netlist.solver()->post_start();
|
||||
if (m_netlist.solver() != NULL)
|
||||
m_netlist.solver()->post_start();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void netlist_setup_t::start_devices()
|
||||
{
|
||||
|
||||
if (getenv("NL_LOGS"))
|
||||
{
|
||||
NL_VERBOSE_OUT(("Creating dynamic logs ...\n"));
|
||||
nl_util::pstring_list ll = nl_util::split(getenv("NL_LOGS"), ":");
|
||||
for (int i=0; i < ll.count(); i++)
|
||||
{
|
||||
NL_VERBOSE_OUT(("%d: <%s>\n",i, ll[i].cstr()));
|
||||
netlist_device_t *nc = factory().new_device_by_classname("nld_log", *this);
|
||||
pstring name = "log_" + ll[i];
|
||||
register_dev(nc, name);
|
||||
register_link(name + ".I", ll[i]);
|
||||
}
|
||||
}
|
||||
if (getenv("NL_LOGS"))
|
||||
{
|
||||
NL_VERBOSE_OUT(("Creating dynamic logs ...\n"));
|
||||
nl_util::pstring_list ll = nl_util::split(getenv("NL_LOGS"), ":");
|
||||
for (int i=0; i < ll.count(); i++)
|
||||
{
|
||||
NL_VERBOSE_OUT(("%d: <%s>\n",i, ll[i].cstr()));
|
||||
netlist_device_t *nc = factory().new_device_by_classname("nld_log", *this);
|
||||
pstring name = "log_" + ll[i];
|
||||
register_dev(nc, name);
|
||||
register_link(name + ".I", ll[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NL_VERBOSE_OUT(("Searching for mainclock and solver ...\n"));
|
||||
/* find the main clock ... */
|
||||
for (tagmap_devices_t::entry_t *entry = netlist().m_devices.first(); entry != NULL; entry = netlist().m_devices.next(entry))
|
||||
{
|
||||
netlist_device_t *dev = entry->object();
|
||||
if (dynamic_cast<NETLIB_NAME(mainclock)*>(dev) != NULL)
|
||||
{
|
||||
m_netlist.set_mainclock_dev(dynamic_cast<NETLIB_NAME(mainclock)*>(dev));
|
||||
}
|
||||
if (dynamic_cast<NETLIB_NAME(solver)*>(dev) != NULL)
|
||||
{
|
||||
m_netlist.set_solver_dev(dynamic_cast<NETLIB_NAME(solver)*>(dev));
|
||||
}
|
||||
}
|
||||
NL_VERBOSE_OUT(("Searching for mainclock and solver ...\n"));
|
||||
/* find the main clock ... */
|
||||
for (tagmap_devices_t::entry_t *entry = netlist().m_devices.first(); entry != NULL; entry = netlist().m_devices.next(entry))
|
||||
{
|
||||
netlist_device_t *dev = entry->object();
|
||||
if (dynamic_cast<NETLIB_NAME(mainclock)*>(dev) != NULL)
|
||||
{
|
||||
m_netlist.set_mainclock_dev(dynamic_cast<NETLIB_NAME(mainclock)*>(dev));
|
||||
}
|
||||
if (dynamic_cast<NETLIB_NAME(solver)*>(dev) != NULL)
|
||||
{
|
||||
m_netlist.set_solver_dev(dynamic_cast<NETLIB_NAME(solver)*>(dev));
|
||||
}
|
||||
}
|
||||
|
||||
NL_VERBOSE_OUT(("Initializing devices ...\n"));
|
||||
for (tagmap_devices_t::entry_t *entry = netlist().m_devices.first(); entry != NULL; entry = netlist().m_devices.next(entry))
|
||||
{
|
||||
netlist_device_t *dev = entry->object();
|
||||
dev->init(netlist(), entry->tag().cstr());
|
||||
}
|
||||
NL_VERBOSE_OUT(("Initializing devices ...\n"));
|
||||
for (tagmap_devices_t::entry_t *entry = netlist().m_devices.first(); entry != NULL; entry = netlist().m_devices.next(entry))
|
||||
{
|
||||
netlist_device_t *dev = entry->object();
|
||||
dev->init(netlist(), entry->tag().cstr());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define NET_STR(_x) # _x
|
||||
|
||||
#define NET_MODEL(_model) \
|
||||
netlist.register_model(_model);
|
||||
netlist.register_model(_model);
|
||||
|
||||
#define NET_ALIAS(_alias, _name) \
|
||||
netlist.register_alias(# _alias, # _name);
|
||||
@ -39,13 +39,13 @@
|
||||
netlist.register_link(# _name "." # _input, # _output);
|
||||
|
||||
#define NET_C(_input, _output) \
|
||||
netlist.register_link(NET_STR(_input) , NET_STR(_output));
|
||||
netlist.register_link(NET_STR(_input) , NET_STR(_output));
|
||||
|
||||
#define NETDEV_PARAM(_name, _val) \
|
||||
netlist.register_param(# _name, _val);
|
||||
|
||||
#define NETDEV_PARAMI(_name, _param, _val) \
|
||||
netlist.register_param(# _name "." # _param, _val);
|
||||
netlist.register_param(# _name "." # _param, _val);
|
||||
|
||||
#define NETLIST_NAME(_name) netlist ## _ ## _name
|
||||
|
||||
@ -69,30 +69,30 @@ ATTR_COLD void NETLIST_NAME(_name)(netlist_setup_t &netlist) \
|
||||
|
||||
class netlist_setup_t
|
||||
{
|
||||
NETLIST_PREVENT_COPYING(netlist_setup_t)
|
||||
NETLIST_PREVENT_COPYING(netlist_setup_t)
|
||||
public:
|
||||
|
||||
struct link_t
|
||||
{
|
||||
link_t() { }
|
||||
// Copy constructor
|
||||
link_t(const link_t &from)
|
||||
{
|
||||
e1 = from.e1;
|
||||
e2 = from.e2;
|
||||
}
|
||||
struct link_t
|
||||
{
|
||||
link_t() { }
|
||||
// Copy constructor
|
||||
link_t(const link_t &from)
|
||||
{
|
||||
e1 = from.e1;
|
||||
e2 = from.e2;
|
||||
}
|
||||
|
||||
link_t(const pstring &ae1, const pstring &ae2)
|
||||
{
|
||||
e1 = ae1;
|
||||
e2 = ae2;
|
||||
}
|
||||
pstring e1;
|
||||
pstring e2;
|
||||
link_t(const pstring &ae1, const pstring &ae2)
|
||||
{
|
||||
e1 = ae1;
|
||||
e2 = ae2;
|
||||
}
|
||||
pstring e1;
|
||||
pstring e2;
|
||||
|
||||
bool operator==(const link_t &rhs) const { return (e1 == rhs.e1) && (e2 == rhs.e2); }
|
||||
link_t &operator=(const link_t &rhs) { e1 = rhs.e1; e2 = rhs.e2; return *this; }
|
||||
};
|
||||
bool operator==(const link_t &rhs) const { return (e1 == rhs.e1) && (e2 == rhs.e2); }
|
||||
link_t &operator=(const link_t &rhs) { e1 = rhs.e1; e2 = rhs.e2; return *this; }
|
||||
};
|
||||
|
||||
typedef tagmap_t<pstring, 393> tagmap_nstring_t;
|
||||
typedef tagmap_t<netlist_param_t *, 393> tagmap_param_t;
|
||||
@ -105,29 +105,29 @@ public:
|
||||
void init();
|
||||
|
||||
netlist_base_t &netlist() { return m_netlist; }
|
||||
const netlist_base_t &netlist() const { return m_netlist; }
|
||||
const netlist_base_t &netlist() const { return m_netlist; }
|
||||
netlist_factory &factory() { return m_factory; }
|
||||
|
||||
netlist_device_t *register_dev(netlist_device_t *dev, const pstring &name);
|
||||
void remove_dev(const pstring &name);
|
||||
|
||||
void register_model(const pstring &model);
|
||||
void register_alias(const pstring &alias, const pstring &out);
|
||||
void register_link(const pstring &sin, const pstring &sout);
|
||||
void register_param(const pstring ¶m, const pstring &value);
|
||||
void register_param(const pstring ¶m, const double value);
|
||||
void register_model(const pstring &model);
|
||||
void register_alias(const pstring &alias, const pstring &out);
|
||||
void register_link(const pstring &sin, const pstring &sout);
|
||||
void register_param(const pstring ¶m, const pstring &value);
|
||||
void register_param(const pstring ¶m, const double value);
|
||||
|
||||
void register_object(netlist_device_t &dev, netlist_core_device_t &upd_dev, const pstring &name, netlist_object_t &obj, netlist_input_t::state_e state);
|
||||
void connect(netlist_core_terminal_t &t1, netlist_core_terminal_t &t2);
|
||||
void register_object(netlist_device_t &dev, netlist_core_device_t &upd_dev, const pstring &name, netlist_object_t &obj, netlist_input_t::state_e state);
|
||||
void connect(netlist_core_terminal_t &t1, netlist_core_terminal_t &t2);
|
||||
|
||||
netlist_core_terminal_t *find_terminal(const pstring &outname_in, bool required = true);
|
||||
netlist_core_terminal_t *find_terminal(const pstring &outname_in, netlist_object_t::type_t atype, bool required = true);
|
||||
netlist_core_terminal_t *find_terminal(const pstring &outname_in, bool required = true);
|
||||
netlist_core_terminal_t *find_terminal(const pstring &outname_in, netlist_object_t::type_t atype, bool required = true);
|
||||
|
||||
netlist_param_t *find_param(const pstring ¶m_in, bool required = true);
|
||||
netlist_param_t *find_param(const pstring ¶m_in, bool required = true);
|
||||
|
||||
void parse(const char *buf);
|
||||
void parse(const char *buf);
|
||||
|
||||
void start_devices();
|
||||
void start_devices();
|
||||
void resolve_inputs();
|
||||
|
||||
/* not ideal, but needed for save_state */
|
||||
@ -144,21 +144,21 @@ private:
|
||||
tagmap_nstring_t m_alias;
|
||||
tagmap_param_t m_params;
|
||||
tagmap_link_t m_links;
|
||||
tagmap_nstring_t m_params_temp;
|
||||
tagmap_nstring_t m_params_temp;
|
||||
|
||||
netlist_factory m_factory;
|
||||
netlist_factory m_factory;
|
||||
|
||||
netlist_list_t<pstring> m_models;
|
||||
netlist_list_t<pstring> m_models;
|
||||
|
||||
int m_proxy_cnt;
|
||||
|
||||
void connect_terminals(netlist_core_terminal_t &in, netlist_core_terminal_t &out);
|
||||
void connect_input_output(netlist_input_t &in, netlist_output_t &out);
|
||||
void connect_terminal_output(netlist_terminal_t &in, netlist_output_t &out);
|
||||
void connect_terminal_input(netlist_terminal_t &term, netlist_input_t &inp);
|
||||
void connect_terminal_output(netlist_terminal_t &in, netlist_output_t &out);
|
||||
void connect_terminal_input(netlist_terminal_t &term, netlist_input_t &inp);
|
||||
|
||||
// helpers
|
||||
pstring objtype_as_astr(netlist_object_t &in);
|
||||
// helpers
|
||||
pstring objtype_as_astr(netlist_object_t &in);
|
||||
|
||||
const pstring resolve_alias(const pstring &name) const;
|
||||
};
|
||||
|
@ -26,87 +26,87 @@ struct netlist_time
|
||||
{
|
||||
public:
|
||||
|
||||
typedef UINT64 INTERNALTYPE;
|
||||
typedef UINT64 INTERNALTYPE;
|
||||
|
||||
static const INTERNALTYPE RESOLUTION = NETLIST_INTERNAL_RES;
|
||||
static const INTERNALTYPE RESOLUTION = NETLIST_INTERNAL_RES;
|
||||
|
||||
ATTR_HOT inline netlist_time() : m_time(0) {}
|
||||
ATTR_HOT inline netlist_time() : m_time(0) {}
|
||||
|
||||
ATTR_HOT friend inline const netlist_time operator-(const netlist_time &left, const netlist_time &right);
|
||||
ATTR_HOT friend inline const netlist_time operator+(const netlist_time &left, const netlist_time &right);
|
||||
ATTR_HOT friend inline const netlist_time operator*(const netlist_time &left, const UINT32 factor);
|
||||
ATTR_HOT friend inline const UINT32 operator/(const netlist_time &left, const netlist_time &right);
|
||||
ATTR_HOT friend inline bool operator>(const netlist_time &left, const netlist_time &right);
|
||||
ATTR_HOT friend inline bool operator<(const netlist_time &left, const netlist_time &right);
|
||||
ATTR_HOT friend inline bool operator>=(const netlist_time &left, const netlist_time &right);
|
||||
ATTR_HOT friend inline bool operator<=(const netlist_time &left, const netlist_time &right);
|
||||
ATTR_HOT friend inline const netlist_time operator-(const netlist_time &left, const netlist_time &right);
|
||||
ATTR_HOT friend inline const netlist_time operator+(const netlist_time &left, const netlist_time &right);
|
||||
ATTR_HOT friend inline const netlist_time operator*(const netlist_time &left, const UINT32 factor);
|
||||
ATTR_HOT friend inline const UINT32 operator/(const netlist_time &left, const netlist_time &right);
|
||||
ATTR_HOT friend inline bool operator>(const netlist_time &left, const netlist_time &right);
|
||||
ATTR_HOT friend inline bool operator<(const netlist_time &left, const netlist_time &right);
|
||||
ATTR_HOT friend inline bool operator>=(const netlist_time &left, const netlist_time &right);
|
||||
ATTR_HOT friend inline bool operator<=(const netlist_time &left, const netlist_time &right);
|
||||
|
||||
ATTR_HOT inline const netlist_time &operator=(const netlist_time &right) { m_time = right.m_time; return *this; }
|
||||
ATTR_HOT inline const netlist_time &operator=(const double &right) { m_time = (INTERNALTYPE) ( right * (double) RESOLUTION); return *this; }
|
||||
ATTR_HOT inline operator double() const { return as_double(); }
|
||||
ATTR_HOT inline const netlist_time &operator=(const netlist_time &right) { m_time = right.m_time; return *this; }
|
||||
ATTR_HOT inline const netlist_time &operator=(const double &right) { m_time = (INTERNALTYPE) ( right * (double) RESOLUTION); return *this; }
|
||||
ATTR_HOT inline operator double() const { return as_double(); }
|
||||
|
||||
ATTR_HOT inline const netlist_time &operator+=(const netlist_time &right) { m_time += right.m_time; return *this; }
|
||||
ATTR_HOT inline const netlist_time &operator+=(const netlist_time &right) { m_time += right.m_time; return *this; }
|
||||
|
||||
ATTR_HOT inline const INTERNALTYPE as_raw() const { return m_time; }
|
||||
ATTR_HOT inline const double as_double() const { return (double) m_time / (double) RESOLUTION; }
|
||||
ATTR_HOT inline const INTERNALTYPE as_raw() const { return m_time; }
|
||||
ATTR_HOT inline const double as_double() const { return (double) m_time / (double) RESOLUTION; }
|
||||
|
||||
// for save states ....
|
||||
ATTR_HOT inline INTERNALTYPE *get_internaltype_ptr() { return &m_time; }
|
||||
// for save states ....
|
||||
ATTR_HOT inline INTERNALTYPE *get_internaltype_ptr() { return &m_time; }
|
||||
|
||||
ATTR_HOT static inline const netlist_time from_nsec(const int ns) { return netlist_time((UINT64) ns * (RESOLUTION / U64(1000000000))); }
|
||||
ATTR_HOT static inline const netlist_time from_usec(const int us) { return netlist_time((UINT64) us * (RESOLUTION / U64(1000000))); }
|
||||
ATTR_HOT static inline const netlist_time from_msec(const int ms) { return netlist_time((UINT64) ms * (RESOLUTION / U64(1000))); }
|
||||
ATTR_HOT static inline const netlist_time from_hz(const UINT64 hz) { return netlist_time(RESOLUTION / hz); }
|
||||
ATTR_HOT static inline const netlist_time from_double(const double t) { return netlist_time((INTERNALTYPE) ( t * (double) RESOLUTION)); }
|
||||
ATTR_HOT static inline const netlist_time from_raw(const INTERNALTYPE raw) { return netlist_time(raw); }
|
||||
ATTR_HOT static inline const netlist_time from_nsec(const int ns) { return netlist_time((UINT64) ns * (RESOLUTION / U64(1000000000))); }
|
||||
ATTR_HOT static inline const netlist_time from_usec(const int us) { return netlist_time((UINT64) us * (RESOLUTION / U64(1000000))); }
|
||||
ATTR_HOT static inline const netlist_time from_msec(const int ms) { return netlist_time((UINT64) ms * (RESOLUTION / U64(1000))); }
|
||||
ATTR_HOT static inline const netlist_time from_hz(const UINT64 hz) { return netlist_time(RESOLUTION / hz); }
|
||||
ATTR_HOT static inline const netlist_time from_double(const double t) { return netlist_time((INTERNALTYPE) ( t * (double) RESOLUTION)); }
|
||||
ATTR_HOT static inline const netlist_time from_raw(const INTERNALTYPE raw) { return netlist_time(raw); }
|
||||
|
||||
static const netlist_time zero;
|
||||
static const netlist_time zero;
|
||||
|
||||
protected:
|
||||
|
||||
ATTR_HOT inline netlist_time(const INTERNALTYPE val) : m_time(val) {}
|
||||
ATTR_HOT inline netlist_time(const INTERNALTYPE val) : m_time(val) {}
|
||||
|
||||
INTERNALTYPE m_time;
|
||||
INTERNALTYPE m_time;
|
||||
};
|
||||
|
||||
ATTR_HOT inline const netlist_time operator-(const netlist_time &left, const netlist_time &right)
|
||||
{
|
||||
return netlist_time::from_raw(left.m_time - right.m_time);
|
||||
return netlist_time::from_raw(left.m_time - right.m_time);
|
||||
}
|
||||
|
||||
ATTR_HOT inline const netlist_time operator*(const netlist_time &left, const UINT32 factor)
|
||||
{
|
||||
return netlist_time::from_raw(left.m_time * factor);
|
||||
return netlist_time::from_raw(left.m_time * factor);
|
||||
}
|
||||
|
||||
ATTR_HOT inline const UINT32 operator/(const netlist_time &left, const netlist_time &right)
|
||||
{
|
||||
return left.m_time / right.m_time;
|
||||
return left.m_time / right.m_time;
|
||||
}
|
||||
|
||||
ATTR_HOT inline const netlist_time operator+(const netlist_time &left, const netlist_time &right)
|
||||
{
|
||||
return netlist_time::from_raw(left.m_time + right.m_time);
|
||||
return netlist_time::from_raw(left.m_time + right.m_time);
|
||||
}
|
||||
|
||||
ATTR_HOT inline bool operator<(const netlist_time &left, const netlist_time &right)
|
||||
{
|
||||
return (left.m_time < right.m_time);
|
||||
return (left.m_time < right.m_time);
|
||||
}
|
||||
|
||||
ATTR_HOT inline bool operator>(const netlist_time &left, const netlist_time &right)
|
||||
{
|
||||
return (left.m_time > right.m_time);
|
||||
return (left.m_time > right.m_time);
|
||||
}
|
||||
|
||||
ATTR_HOT inline bool operator<=(const netlist_time &left, const netlist_time &right)
|
||||
{
|
||||
return (left.m_time <= right.m_time);
|
||||
return (left.m_time <= right.m_time);
|
||||
}
|
||||
|
||||
ATTR_HOT inline bool operator>=(const netlist_time &left, const netlist_time &right)
|
||||
{
|
||||
return (left.m_time >= right.m_time);
|
||||
return (left.m_time >= right.m_time);
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,29 +13,29 @@ class nl_util
|
||||
{
|
||||
// this is purely static
|
||||
private:
|
||||
nl_util() {};
|
||||
nl_util() {};
|
||||
|
||||
public:
|
||||
typedef netlist_list_t<pstring, 10> pstring_list;
|
||||
typedef netlist_list_t<pstring, 10> pstring_list;
|
||||
|
||||
static pstring_list split(const pstring &str, const pstring &onstr)
|
||||
{
|
||||
pstring_list temp;
|
||||
static pstring_list split(const pstring &str, const pstring &onstr)
|
||||
{
|
||||
pstring_list temp;
|
||||
|
||||
int p = 0;
|
||||
int pn;
|
||||
int p = 0;
|
||||
int pn;
|
||||
|
||||
pn = str.find(onstr, p);
|
||||
while (pn>=0)
|
||||
{
|
||||
temp.add(str.substr(p, pn - p));
|
||||
p = pn + onstr.len();
|
||||
pn = str.find(onstr, p);
|
||||
}
|
||||
if (p<str.len())
|
||||
temp.add(str.substr(p));
|
||||
return temp;
|
||||
}
|
||||
pn = str.find(onstr, p);
|
||||
while (pn>=0)
|
||||
{
|
||||
temp.add(str.substr(p, pn - p));
|
||||
p = pn + onstr.len();
|
||||
pn = str.find(onstr, p);
|
||||
}
|
||||
if (p<str.len())
|
||||
temp.add(str.substr(p));
|
||||
return temp;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* NL_UTIL_H_ */
|
||||
|
@ -7,24 +7,24 @@
|
||||
|
||||
ATTR_COLD pstate_manager_t::~pstate_manager_t()
|
||||
{
|
||||
m_save.reset_and_free();
|
||||
m_save.reset_and_free();
|
||||
}
|
||||
|
||||
|
||||
|
||||
ATTR_COLD void pstate_manager_t::save_state_ptr(const pstring &stname, const netlist_data_type_e dt, const int size, const int count, void *ptr)
|
||||
{
|
||||
pstring fullname = stname;
|
||||
ATTR_UNUSED pstring ts[] = {
|
||||
"NOT_SUPPORTED",
|
||||
"DT_DOUBLE",
|
||||
"DT_INT64",
|
||||
"DT_INT8",
|
||||
"DT_INT",
|
||||
"DT_BOOLEAN"
|
||||
};
|
||||
pstring fullname = stname;
|
||||
ATTR_UNUSED pstring ts[] = {
|
||||
"NOT_SUPPORTED",
|
||||
"DT_DOUBLE",
|
||||
"DT_INT64",
|
||||
"DT_INT8",
|
||||
"DT_INT",
|
||||
"DT_BOOLEAN"
|
||||
};
|
||||
|
||||
NL_VERBOSE_OUT(("SAVE: <%s> %s(%d) %p\n", fullname.cstr(), ts[dt].cstr(), size, ptr));
|
||||
pstate_entry_t *p = new pstate_entry_t(stname, dt, size, count, ptr);
|
||||
m_save.add(p);
|
||||
NL_VERBOSE_OUT(("SAVE: <%s> %s(%d) %p\n", fullname.cstr(), ts[dt].cstr(), size, ptr));
|
||||
pstate_entry_t *p = new pstate_entry_t(stname, dt, size, count, ptr);
|
||||
m_save.add(p);
|
||||
}
|
||||
|
@ -16,18 +16,18 @@
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
#define PSTATE_INTERFACE(manager, module) \
|
||||
template<class C> ATTR_COLD void save(C &state, const pstring &stname) \
|
||||
{ \
|
||||
dynamic_cast<pstate_manager_t &>(manager).save_manager(state, module + "." + stname); \
|
||||
}
|
||||
template<class C> ATTR_COLD void save(C &state, const pstring &stname) \
|
||||
{ \
|
||||
dynamic_cast<pstate_manager_t &>(manager).save_manager(state, module + "." + stname); \
|
||||
}
|
||||
|
||||
enum netlist_data_type_e {
|
||||
NOT_SUPPORTED,
|
||||
DT_DOUBLE,
|
||||
DT_INT64,
|
||||
DT_INT8,
|
||||
DT_INT,
|
||||
DT_BOOLEAN
|
||||
NOT_SUPPORTED,
|
||||
DT_DOUBLE,
|
||||
DT_INT64,
|
||||
DT_INT8,
|
||||
DT_INT,
|
||||
DT_BOOLEAN
|
||||
};
|
||||
|
||||
template<typename _ItemType> struct nl_datatype { static const netlist_data_type_e type = netlist_data_type_e(NOT_SUPPORTED); };
|
||||
@ -46,50 +46,50 @@ NETLIST_SAVE_TYPE(INT32, DT_INT);
|
||||
|
||||
struct pstate_entry_t
|
||||
{
|
||||
typedef netlist_list_t<pstate_entry_t *> list_t;
|
||||
typedef netlist_list_t<pstate_entry_t *> list_t;
|
||||
|
||||
pstate_entry_t(const pstring &stname, const netlist_data_type_e dt, const int size, const int count, void *ptr) :
|
||||
m_name(stname), m_dt(dt), m_size(size), m_count(count), m_ptr(ptr) { }
|
||||
pstring m_name;
|
||||
netlist_data_type_e m_dt;
|
||||
int m_size;
|
||||
int m_count;
|
||||
void *m_ptr;
|
||||
pstate_entry_t(const pstring &stname, const netlist_data_type_e dt, const int size, const int count, void *ptr) :
|
||||
m_name(stname), m_dt(dt), m_size(size), m_count(count), m_ptr(ptr) { }
|
||||
pstring m_name;
|
||||
netlist_data_type_e m_dt;
|
||||
int m_size;
|
||||
int m_count;
|
||||
void *m_ptr;
|
||||
};
|
||||
|
||||
class pstate_manager_t
|
||||
{
|
||||
public:
|
||||
|
||||
ATTR_COLD ~pstate_manager_t();
|
||||
ATTR_COLD ~pstate_manager_t();
|
||||
|
||||
template<class C> ATTR_COLD void save_manager(C &state, const pstring &stname)
|
||||
{
|
||||
save_state_ptr(stname, nl_datatype<C>::type, sizeof(C), 1, &state);
|
||||
}
|
||||
template<class C> ATTR_COLD void save_manager(C &state, const pstring &stname)
|
||||
{
|
||||
save_state_ptr(stname, nl_datatype<C>::type, sizeof(C), 1, &state);
|
||||
}
|
||||
|
||||
template<class C> ATTR_COLD void save_manager(C *state, const pstring &stname, const int count)
|
||||
{
|
||||
save_state_ptr(stname, nl_datatype<C>::type, sizeof(C), count, state);
|
||||
}
|
||||
template<class C> ATTR_COLD void save_manager(C *state, const pstring &stname, const int count)
|
||||
{
|
||||
save_state_ptr(stname, nl_datatype<C>::type, sizeof(C), count, state);
|
||||
}
|
||||
|
||||
template<class C, std::size_t N> ATTR_COLD void save_manager(C (&state)[N], const pstring &stname)
|
||||
{
|
||||
save_state_ptr(stname, nl_datatype<C>::type, sizeof(C), N, &(state[0]));
|
||||
}
|
||||
template<class C, std::size_t N> ATTR_COLD void save_manager(C (&state)[N], const pstring &stname)
|
||||
{
|
||||
save_state_ptr(stname, nl_datatype<C>::type, sizeof(C), N, &(state[0]));
|
||||
}
|
||||
|
||||
inline const pstate_entry_t::list_t &save_list() const { return m_save; }
|
||||
inline const pstate_entry_t::list_t &save_list() const { return m_save; }
|
||||
|
||||
protected:
|
||||
ATTR_COLD void save_state_ptr(const pstring &stname, const netlist_data_type_e, const int size, const int count, void *ptr);
|
||||
ATTR_COLD void save_state_ptr(const pstring &stname, const netlist_data_type_e, const int size, const int count, void *ptr);
|
||||
|
||||
private:
|
||||
pstate_entry_t::list_t m_save;
|
||||
pstate_entry_t::list_t m_save;
|
||||
};
|
||||
|
||||
template<> ATTR_COLD inline void pstate_manager_t::save_manager(netlist_time &nlt, const pstring &stname)
|
||||
{
|
||||
save_state_ptr(stname, DT_INT64, sizeof(netlist_time::INTERNALTYPE), 1, nlt.get_internaltype_ptr());
|
||||
save_state_ptr(stname, DT_INT64, sizeof(netlist_time::INTERNALTYPE), 1, nlt.get_internaltype_ptr());
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,68 +24,68 @@ pstring::str_t *pstring::m_zero = NULL;
|
||||
//#define DEBUG_MODE (0)
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
#ifndef IMMEDIATE_MODE
|
||||
#define IMMEDIATE_MODE (0)
|
||||
#endif
|
||||
#ifndef DEBUG_MODE
|
||||
#define DEBUG_MODE (1)
|
||||
#endif
|
||||
#ifndef IMMEDIATE_MODE
|
||||
#define IMMEDIATE_MODE (0)
|
||||
#endif
|
||||
#ifndef DEBUG_MODE
|
||||
#define DEBUG_MODE (1)
|
||||
#endif
|
||||
#else
|
||||
#ifndef IMMEDIATE_MODE
|
||||
#define IMMEDIATE_MODE (1)
|
||||
#endif
|
||||
#ifndef DEBUG_MODE
|
||||
#define DEBUG_MODE (0)
|
||||
#endif
|
||||
#ifndef IMMEDIATE_MODE
|
||||
#define IMMEDIATE_MODE (1)
|
||||
#endif
|
||||
#ifndef DEBUG_MODE
|
||||
#define DEBUG_MODE (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
pstring::~pstring()
|
||||
{
|
||||
sfree(m_ptr);
|
||||
sfree(m_ptr);
|
||||
}
|
||||
|
||||
void pstring::pcat(const char *s)
|
||||
{
|
||||
int slen = strlen(s);
|
||||
str_t *n = salloc(m_ptr->len() + slen);
|
||||
if (m_ptr->len() > 0)
|
||||
memcpy(n->str(), m_ptr->str(), m_ptr->len());
|
||||
if (slen > 0)
|
||||
memcpy(n->str() + m_ptr->len(), s, slen);
|
||||
*(n->str() + n->len()) = 0;
|
||||
sfree(m_ptr);
|
||||
m_ptr = n;
|
||||
int slen = strlen(s);
|
||||
str_t *n = salloc(m_ptr->len() + slen);
|
||||
if (m_ptr->len() > 0)
|
||||
memcpy(n->str(), m_ptr->str(), m_ptr->len());
|
||||
if (slen > 0)
|
||||
memcpy(n->str() + m_ptr->len(), s, slen);
|
||||
*(n->str() + n->len()) = 0;
|
||||
sfree(m_ptr);
|
||||
m_ptr = n;
|
||||
}
|
||||
|
||||
void pstring::pcopy(const char *from, int size)
|
||||
{
|
||||
str_t *n = salloc(size);
|
||||
if (size > 0)
|
||||
memcpy(n->str(), from, size);
|
||||
*(n->str() + size) = 0;
|
||||
sfree(m_ptr);
|
||||
m_ptr = n;
|
||||
str_t *n = salloc(size);
|
||||
if (size > 0)
|
||||
memcpy(n->str(), from, size);
|
||||
*(n->str() + size) = 0;
|
||||
sfree(m_ptr);
|
||||
m_ptr = n;
|
||||
}
|
||||
|
||||
pstring pstring::substr(unsigned int start, int count) const
|
||||
{
|
||||
int alen = len();
|
||||
if (start >= alen)
|
||||
return pstring();
|
||||
if (count <0 || start + count > alen)
|
||||
count = alen - start;
|
||||
pstring ret;
|
||||
ret.pcopy(cstr() + start, count);
|
||||
return ret;
|
||||
int alen = len();
|
||||
if (start >= alen)
|
||||
return pstring();
|
||||
if (count <0 || start + count > alen)
|
||||
count = alen - start;
|
||||
pstring ret;
|
||||
ret.pcopy(cstr() + start, count);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pstring pstring::ucase() const
|
||||
{
|
||||
pstring ret = *this;
|
||||
ret.pcopy(cstr(), len());
|
||||
for (int i=0; i<ret.len(); i++)
|
||||
ret.m_ptr->m_str[i] = toupper((unsigned) ret.m_ptr->m_str[i]);
|
||||
return ret;
|
||||
pstring ret = *this;
|
||||
ret.pcopy(cstr(), len());
|
||||
for (int i=0; i<ret.len(); i++)
|
||||
ret.m_ptr->m_str[i] = toupper((unsigned) ret.m_ptr->m_str[i]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -94,58 +94,58 @@ pstring pstring::ucase() const
|
||||
|
||||
int pstring::pcmpi(const char *lhs, const char *rhs, int count) const
|
||||
{
|
||||
// loop while equal until we hit the end of strings
|
||||
int index;
|
||||
for (index = 0; index < count; index++)
|
||||
if (lhs[index] == 0 || tolower(lhs[index]) != tolower(rhs[index]))
|
||||
break;
|
||||
// loop while equal until we hit the end of strings
|
||||
int index;
|
||||
for (index = 0; index < count; index++)
|
||||
if (lhs[index] == 0 || tolower(lhs[index]) != tolower(rhs[index]))
|
||||
break;
|
||||
|
||||
// determine the final result
|
||||
if (index < count)
|
||||
return tolower(lhs[index]) - tolower(rhs[index]);
|
||||
if (lhs[index] == 0)
|
||||
return 0;
|
||||
return 1;
|
||||
// determine the final result
|
||||
if (index < count)
|
||||
return tolower(lhs[index]) - tolower(rhs[index]);
|
||||
if (lhs[index] == 0)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
double pstring::as_double(bool *error) const
|
||||
{
|
||||
double ret;
|
||||
char *e = NULL;
|
||||
double ret;
|
||||
char *e = NULL;
|
||||
|
||||
if (error != NULL)
|
||||
*error = false;
|
||||
ret = strtod(cstr(), &e);
|
||||
if (*e != 0)
|
||||
if (error != NULL)
|
||||
*error = true;
|
||||
return ret;
|
||||
if (error != NULL)
|
||||
*error = false;
|
||||
ret = strtod(cstr(), &e);
|
||||
if (*e != 0)
|
||||
if (error != NULL)
|
||||
*error = true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
long pstring::as_long(bool *error) const
|
||||
{
|
||||
double ret;
|
||||
char *e = NULL;
|
||||
double ret;
|
||||
char *e = NULL;
|
||||
|
||||
if (error != NULL)
|
||||
*error = false;
|
||||
if (startsWith("0x"))
|
||||
ret = strtol(&(cstr()[2]), &e, 16);
|
||||
else
|
||||
ret = strtol(cstr(), &e, 10);
|
||||
if (*e != 0)
|
||||
if (error != NULL)
|
||||
*error = true;
|
||||
return ret;
|
||||
if (error != NULL)
|
||||
*error = false;
|
||||
if (startsWith("0x"))
|
||||
ret = strtol(&(cstr()[2]), &e, 16);
|
||||
else
|
||||
ret = strtol(cstr(), &e, 10);
|
||||
if (*e != 0)
|
||||
if (error != NULL)
|
||||
*error = true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
pstring pstring::vprintf(va_list args) const
|
||||
{
|
||||
// sprintf into the temporary buffer
|
||||
char tempbuf[4096];
|
||||
vsprintf(tempbuf, cstr(), args);
|
||||
// sprintf into the temporary buffer
|
||||
char tempbuf[4096];
|
||||
vsprintf(tempbuf, cstr(), args);
|
||||
|
||||
return pstring(tempbuf);
|
||||
return pstring(tempbuf);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -154,35 +154,35 @@ pstring pstring::vprintf(va_list args) const
|
||||
|
||||
void pstring::sfree(str_t *s)
|
||||
{
|
||||
s->m_ref_count--;
|
||||
if (s->m_ref_count == 0)
|
||||
m_pool.dealloc(s);
|
||||
s->m_ref_count--;
|
||||
if (s->m_ref_count == 0)
|
||||
m_pool.dealloc(s);
|
||||
}
|
||||
|
||||
pstring::str_t *pstring::salloc(int n)
|
||||
{
|
||||
str_t *ret = new(m_pool, n+1) str_t(n);
|
||||
return ret;
|
||||
str_t *ret = new(m_pool, n+1) str_t(n);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pstring pstring::sprintf(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
pstring ret = pstring(format).vprintf(ap);
|
||||
va_end(ap);
|
||||
return ret;
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
pstring ret = pstring(format).vprintf(ap);
|
||||
va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void pstring::resetmem()
|
||||
{
|
||||
// Release the 0 string
|
||||
if (m_zero != NULL)
|
||||
sfree(m_zero);
|
||||
m_zero = NULL;
|
||||
m_pool.m_shutdown = true;
|
||||
m_pool.resetmem();
|
||||
// Release the 0 string
|
||||
if (m_zero != NULL)
|
||||
sfree(m_zero);
|
||||
m_zero = NULL;
|
||||
m_pool.m_shutdown = true;
|
||||
m_pool.resetmem();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -191,10 +191,10 @@ void pstring::resetmem()
|
||||
|
||||
|
||||
pblockpool::pblockpool()
|
||||
: m_shutdown(false)
|
||||
, m_first(NULL)
|
||||
, m_blocksize((DEBUG_MODE) ? 16384 : 16384)
|
||||
, m_align(8)
|
||||
: m_shutdown(false)
|
||||
, m_first(NULL)
|
||||
, m_blocksize((DEBUG_MODE) ? 16384 : 16384)
|
||||
, m_align(8)
|
||||
{
|
||||
}
|
||||
|
||||
@ -205,105 +205,105 @@ pblockpool::~pblockpool()
|
||||
|
||||
void *pblockpool::alloc(const std::size_t n)
|
||||
{
|
||||
if (IMMEDIATE_MODE)
|
||||
return (char *) malloc(n);
|
||||
else
|
||||
{
|
||||
int memsize = ((n + m_align - 1) / m_align) * m_align;
|
||||
int min_alloc = MAX(m_blocksize, memsize+sizeof(memblock)-MINDATASIZE);
|
||||
char *ret = NULL;
|
||||
//std::printf("m_first %p\n", m_first);
|
||||
for (memblock *p = m_first; p != NULL && ret == NULL; p = p->next)
|
||||
{
|
||||
if (p->remaining > memsize)
|
||||
{
|
||||
ret = p->cur;
|
||||
p->cur += memsize;
|
||||
p->allocated += 1;
|
||||
p->remaining -= memsize;
|
||||
}
|
||||
}
|
||||
if (IMMEDIATE_MODE)
|
||||
return (char *) malloc(n);
|
||||
else
|
||||
{
|
||||
int memsize = ((n + m_align - 1) / m_align) * m_align;
|
||||
int min_alloc = MAX(m_blocksize, memsize+sizeof(memblock)-MINDATASIZE);
|
||||
char *ret = NULL;
|
||||
//std::printf("m_first %p\n", m_first);
|
||||
for (memblock *p = m_first; p != NULL && ret == NULL; p = p->next)
|
||||
{
|
||||
if (p->remaining > memsize)
|
||||
{
|
||||
ret = p->cur;
|
||||
p->cur += memsize;
|
||||
p->allocated += 1;
|
||||
p->remaining -= memsize;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == NULL)
|
||||
{
|
||||
// need to allocate a new block
|
||||
memblock *p = (memblock *) malloc(min_alloc); //new char[min_alloc];
|
||||
p->allocated = 0;
|
||||
p->cur = &p->data[0];
|
||||
p->size = p->remaining = min_alloc - (sizeof(memblock)-MINDATASIZE);
|
||||
p->next = m_first;
|
||||
//std::printf("allocated block size %d\n", sizeof(p->data));
|
||||
if (ret == NULL)
|
||||
{
|
||||
// need to allocate a new block
|
||||
memblock *p = (memblock *) malloc(min_alloc); //new char[min_alloc];
|
||||
p->allocated = 0;
|
||||
p->cur = &p->data[0];
|
||||
p->size = p->remaining = min_alloc - (sizeof(memblock)-MINDATASIZE);
|
||||
p->next = m_first;
|
||||
//std::printf("allocated block size %d\n", sizeof(p->data));
|
||||
|
||||
ret = p->cur;
|
||||
p->cur += memsize;
|
||||
p->allocated += 1;
|
||||
p->remaining -= memsize;
|
||||
ret = p->cur;
|
||||
p->cur += memsize;
|
||||
p->allocated += 1;
|
||||
p->remaining -= memsize;
|
||||
|
||||
m_first = p;
|
||||
}
|
||||
m_first = p;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
void pblockpool::dealloc(void *ptr)
|
||||
{
|
||||
if (IMMEDIATE_MODE)
|
||||
free(ptr);
|
||||
else
|
||||
{
|
||||
for (memblock *p = m_first; p != NULL; p = p->next)
|
||||
{
|
||||
if (ptr >= &p->data[0] && ptr < &p->data[p->size])
|
||||
{
|
||||
p->allocated -= 1;
|
||||
if (p->allocated < 0)
|
||||
std::fprintf(stderr, "nstring: memory corruption - crash likely\n");
|
||||
if (p->allocated == 0)
|
||||
{
|
||||
//std::printf("Block entirely freed\n");
|
||||
p->remaining = p->size;
|
||||
p->cur = &p->data[0];
|
||||
}
|
||||
// shutting down ?
|
||||
if (m_shutdown)
|
||||
resetmem(); // try to free blocks
|
||||
return;
|
||||
}
|
||||
}
|
||||
std::fprintf(stderr, "nstring: string <%p> not found on free\n", ptr);
|
||||
}
|
||||
if (IMMEDIATE_MODE)
|
||||
free(ptr);
|
||||
else
|
||||
{
|
||||
for (memblock *p = m_first; p != NULL; p = p->next)
|
||||
{
|
||||
if (ptr >= &p->data[0] && ptr < &p->data[p->size])
|
||||
{
|
||||
p->allocated -= 1;
|
||||
if (p->allocated < 0)
|
||||
std::fprintf(stderr, "nstring: memory corruption - crash likely\n");
|
||||
if (p->allocated == 0)
|
||||
{
|
||||
//std::printf("Block entirely freed\n");
|
||||
p->remaining = p->size;
|
||||
p->cur = &p->data[0];
|
||||
}
|
||||
// shutting down ?
|
||||
if (m_shutdown)
|
||||
resetmem(); // try to free blocks
|
||||
return;
|
||||
}
|
||||
}
|
||||
std::fprintf(stderr, "nstring: string <%p> not found on free\n", ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void pblockpool::resetmem()
|
||||
{
|
||||
if (!IMMEDIATE_MODE)
|
||||
{
|
||||
memblock **p = &m_first;
|
||||
int totalblocks = 0;
|
||||
int freedblocks = 0;
|
||||
if (!IMMEDIATE_MODE)
|
||||
{
|
||||
memblock **p = &m_first;
|
||||
int totalblocks = 0;
|
||||
int freedblocks = 0;
|
||||
|
||||
while (*p != NULL)
|
||||
{
|
||||
totalblocks++;
|
||||
memblock **next = &((*p)->next);
|
||||
if ((*p)->allocated == 0)
|
||||
{
|
||||
//std::printf("freeing block %p\n", *p);
|
||||
memblock *freeme = *p;
|
||||
*p = *next;
|
||||
free(freeme); //delete[] *p;
|
||||
freedblocks++;
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (DEBUG_MODE)
|
||||
// std::printf("Allocated: <%s>\n", ((str_t *)(&(*p)->data[0]))->str());
|
||||
while (*p != NULL)
|
||||
{
|
||||
totalblocks++;
|
||||
memblock **next = &((*p)->next);
|
||||
if ((*p)->allocated == 0)
|
||||
{
|
||||
//std::printf("freeing block %p\n", *p);
|
||||
memblock *freeme = *p;
|
||||
*p = *next;
|
||||
free(freeme); //delete[] *p;
|
||||
freedblocks++;
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (DEBUG_MODE)
|
||||
// std::printf("Allocated: <%s>\n", ((str_t *)(&(*p)->data[0]))->str());
|
||||
|
||||
p = next;
|
||||
}
|
||||
}
|
||||
if (DEBUG_MODE)
|
||||
std::printf("Freed %d out of total %d blocks\n", freedblocks, totalblocks);
|
||||
}
|
||||
p = next;
|
||||
}
|
||||
}
|
||||
if (DEBUG_MODE)
|
||||
std::printf("Freed %d out of total %d blocks\n", freedblocks, totalblocks);
|
||||
}
|
||||
}
|
||||
|
@ -15,56 +15,56 @@
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
struct pblockpool {
|
||||
NETLIST_PREVENT_COPYING(pblockpool)
|
||||
NETLIST_PREVENT_COPYING(pblockpool)
|
||||
public:
|
||||
static const int MINDATASIZE = 8;
|
||||
static const int MINDATASIZE = 8;
|
||||
|
||||
pblockpool();
|
||||
~pblockpool();
|
||||
pblockpool();
|
||||
~pblockpool();
|
||||
|
||||
void resetmem();
|
||||
void resetmem();
|
||||
|
||||
void *alloc(std::size_t n);
|
||||
void dealloc(void *ptr);
|
||||
void *alloc(std::size_t n);
|
||||
void dealloc(void *ptr);
|
||||
|
||||
template<class T>
|
||||
void destroy(T* object)
|
||||
{
|
||||
object->~T();
|
||||
dealloc(object);
|
||||
}
|
||||
bool m_shutdown;
|
||||
template<class T>
|
||||
void destroy(T* object)
|
||||
{
|
||||
object->~T();
|
||||
dealloc(object);
|
||||
}
|
||||
bool m_shutdown;
|
||||
|
||||
private:
|
||||
struct memblock
|
||||
{
|
||||
memblock *next;
|
||||
int size;
|
||||
int allocated;
|
||||
int remaining;
|
||||
char *cur;
|
||||
char data[MINDATASIZE];
|
||||
};
|
||||
struct memblock
|
||||
{
|
||||
memblock *next;
|
||||
int size;
|
||||
int allocated;
|
||||
int remaining;
|
||||
char *cur;
|
||||
char data[MINDATASIZE];
|
||||
};
|
||||
|
||||
memblock *m_first;
|
||||
int m_blocksize;
|
||||
int m_align;
|
||||
memblock *m_first;
|
||||
int m_blocksize;
|
||||
int m_align;
|
||||
};
|
||||
|
||||
/* objects must be destroyed using destroy above */
|
||||
|
||||
inline void *operator new(std::size_t size, pblockpool &pool, int extra = 0) throw (std::bad_alloc)
|
||||
{
|
||||
void *result = pool.alloc(size + extra);
|
||||
//std::printf("allocating %ld + %d\n", size, extra);
|
||||
if (result == NULL)
|
||||
throw std::bad_alloc();
|
||||
return result;
|
||||
void *result = pool.alloc(size + extra);
|
||||
//std::printf("allocating %ld + %d\n", size, extra);
|
||||
if (result == NULL)
|
||||
throw std::bad_alloc();
|
||||
return result;
|
||||
}
|
||||
|
||||
inline void operator delete(void *pMem, pblockpool &pool, int extra)
|
||||
{
|
||||
pool.dealloc(pMem);
|
||||
pool.dealloc(pMem);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -77,158 +77,157 @@ inline void operator delete(void *pMem, pblockpool &pool, int extra)
|
||||
struct pstring
|
||||
{
|
||||
public:
|
||||
// simple construction/destruction
|
||||
pstring()
|
||||
{
|
||||
init();
|
||||
}
|
||||
~pstring();
|
||||
// simple construction/destruction
|
||||
pstring()
|
||||
{
|
||||
init();
|
||||
}
|
||||
~pstring();
|
||||
|
||||
// construction with copy
|
||||
pstring(const char *string) {init(); if (string != NULL && *string != 0) pcopy(string); }
|
||||
pstring(const pstring &string) {init(); pcopy(string); }
|
||||
// construction with copy
|
||||
pstring(const char *string) {init(); if (string != NULL && *string != 0) pcopy(string); }
|
||||
pstring(const pstring &string) {init(); pcopy(string); }
|
||||
|
||||
// assignment operators
|
||||
pstring &operator=(const char *string) { pcopy(string); return *this; }
|
||||
pstring &operator=(const pstring &string) { pcopy(string); return *this; }
|
||||
// assignment operators
|
||||
pstring &operator=(const char *string) { pcopy(string); return *this; }
|
||||
pstring &operator=(const pstring &string) { pcopy(string); return *this; }
|
||||
|
||||
// C string conversion operators and helpers
|
||||
operator const char *() const { return m_ptr->str(); }
|
||||
inline const char *cstr() const { return m_ptr->str(); }
|
||||
// C string conversion operators and helpers
|
||||
operator const char *() const { return m_ptr->str(); }
|
||||
inline const char *cstr() const { return m_ptr->str(); }
|
||||
|
||||
// concatenation operators
|
||||
pstring& operator+=(const pstring &string) { pcat(string.cstr()); return *this; }
|
||||
friend pstring operator+(const pstring &lhs, const pstring &rhs) { return pstring(lhs) += rhs; }
|
||||
friend pstring operator+(const pstring &lhs, const char *rhs) { return pstring(lhs) += rhs; }
|
||||
friend pstring operator+(const char *lhs, const pstring &rhs) { return pstring(lhs) += rhs; }
|
||||
// concatenation operators
|
||||
pstring& operator+=(const pstring &string) { pcat(string.cstr()); return *this; }
|
||||
friend pstring operator+(const pstring &lhs, const pstring &rhs) { return pstring(lhs) += rhs; }
|
||||
friend pstring operator+(const pstring &lhs, const char *rhs) { return pstring(lhs) += rhs; }
|
||||
friend pstring operator+(const char *lhs, const pstring &rhs) { return pstring(lhs) += rhs; }
|
||||
|
||||
// comparison operators
|
||||
bool operator==(const char *string) const { return (pcmp(string) == 0); }
|
||||
bool operator==(const pstring &string) const { return (pcmp(string.cstr()) == 0); }
|
||||
bool operator!=(const char *string) const { return (pcmp(string) != 0); }
|
||||
bool operator!=(const pstring &string) const { return (pcmp(string.cstr()) != 0); }
|
||||
bool operator<(const char *string) const { return (pcmp(string) < 0); }
|
||||
bool operator<(const pstring &string) const { return (pcmp(string.cstr()) < 0); }
|
||||
bool operator<=(const char *string) const { return (pcmp(string) <= 0); }
|
||||
bool operator<=(const pstring &string) const { return (pcmp(string.cstr()) <= 0); }
|
||||
bool operator>(const char *string) const { return (pcmp(string) > 0); }
|
||||
bool operator>(const pstring &string) const { return (pcmp(string.cstr()) > 0); }
|
||||
bool operator>=(const char *string) const { return (pcmp(string) >= 0); }
|
||||
bool operator>=(const pstring &string) const { return (pcmp(string.cstr()) >= 0); }
|
||||
// comparison operators
|
||||
bool operator==(const char *string) const { return (pcmp(string) == 0); }
|
||||
bool operator==(const pstring &string) const { return (pcmp(string.cstr()) == 0); }
|
||||
bool operator!=(const char *string) const { return (pcmp(string) != 0); }
|
||||
bool operator!=(const pstring &string) const { return (pcmp(string.cstr()) != 0); }
|
||||
bool operator<(const char *string) const { return (pcmp(string) < 0); }
|
||||
bool operator<(const pstring &string) const { return (pcmp(string.cstr()) < 0); }
|
||||
bool operator<=(const char *string) const { return (pcmp(string) <= 0); }
|
||||
bool operator<=(const pstring &string) const { return (pcmp(string.cstr()) <= 0); }
|
||||
bool operator>(const char *string) const { return (pcmp(string) > 0); }
|
||||
bool operator>(const pstring &string) const { return (pcmp(string.cstr()) > 0); }
|
||||
bool operator>=(const char *string) const { return (pcmp(string) >= 0); }
|
||||
bool operator>=(const pstring &string) const { return (pcmp(string.cstr()) >= 0); }
|
||||
|
||||
//
|
||||
inline int len() const { return m_ptr->len(); }
|
||||
//
|
||||
inline int len() const { return m_ptr->len(); }
|
||||
|
||||
inline bool equals(const pstring &string) { return (pcmp(string.cstr(), m_ptr->str()) == 0); }
|
||||
inline bool iequals(const pstring &string) { return (pcmpi(string.cstr(), m_ptr->str()) == 0); }
|
||||
inline bool equals(const pstring &string) { return (pcmp(string.cstr(), m_ptr->str()) == 0); }
|
||||
inline bool iequals(const pstring &string) { return (pcmpi(string.cstr(), m_ptr->str()) == 0); }
|
||||
|
||||
inline int cmp(const pstring &string) const { return pcmp(string.cstr()); }
|
||||
inline int cmpi(const pstring &string) const { return pcmpi(cstr(), string.cstr()); }
|
||||
inline int cmp(const pstring &string) const { return pcmp(string.cstr()); }
|
||||
inline int cmpi(const pstring &string) const { return pcmpi(cstr(), string.cstr()); }
|
||||
|
||||
inline int find(const char *search, int start = 0) const
|
||||
{
|
||||
int alen = len();
|
||||
const char *result = strstr(cstr() + MIN(start, alen), search);
|
||||
return (result != NULL) ? (result - cstr()) : -1;
|
||||
}
|
||||
inline int find(const char *search, int start = 0) const
|
||||
{
|
||||
int alen = len();
|
||||
const char *result = strstr(cstr() + MIN(start, alen), search);
|
||||
return (result != NULL) ? (result - cstr()) : -1;
|
||||
}
|
||||
|
||||
// various
|
||||
// various
|
||||
|
||||
inline bool startsWith(const pstring &arg) const { return (pcmp(cstr(), arg.cstr(), arg.len()) == 0); }
|
||||
inline bool startsWith(const char *arg) const { return (pcmp(cstr(), arg, strlen(arg)) == 0); }
|
||||
inline bool startsWith(const pstring &arg) const { return (pcmp(cstr(), arg.cstr(), arg.len()) == 0); }
|
||||
inline bool startsWith(const char *arg) const { return (pcmp(cstr(), arg, strlen(arg)) == 0); }
|
||||
|
||||
// these return nstring ...
|
||||
inline pstring cat(const pstring &s) const { return *this + s; }
|
||||
inline pstring cat(const char *s) const { return *this + s; }
|
||||
// these return nstring ...
|
||||
inline pstring cat(const pstring &s) const { return *this + s; }
|
||||
inline pstring cat(const char *s) const { return *this + s; }
|
||||
|
||||
pstring substr(unsigned int start, int count = -1) const ;
|
||||
pstring substr(unsigned int start, int count = -1) const ;
|
||||
|
||||
inline pstring left(unsigned int count) const { return substr(0, count); }
|
||||
inline pstring right(unsigned int count) const { return substr(len() - count, count); }
|
||||
inline pstring left(unsigned int count) const { return substr(0, count); }
|
||||
inline pstring right(unsigned int count) const { return substr(len() - count, count); }
|
||||
|
||||
pstring ucase() const;
|
||||
pstring ucase() const;
|
||||
|
||||
// conversions
|
||||
// conversions
|
||||
|
||||
double as_double(bool *error = NULL) const;
|
||||
double as_double(bool *error = NULL) const;
|
||||
|
||||
long as_long(bool *error = NULL) const;
|
||||
long as_long(bool *error = NULL) const;
|
||||
|
||||
// printf using string as format ...
|
||||
// printf using string as format ...
|
||||
|
||||
pstring vprintf(va_list args) const;
|
||||
pstring vprintf(va_list args) const;
|
||||
|
||||
// static
|
||||
static pstring sprintf(const char *format, ...);
|
||||
static void resetmem();
|
||||
// static
|
||||
static pstring sprintf(const char *format, ...);
|
||||
static void resetmem();
|
||||
|
||||
protected:
|
||||
|
||||
struct str_t
|
||||
{
|
||||
str_t(int alen) : m_ref_count(1), m_len(alen) { m_str[0] = 0; }
|
||||
struct str_t
|
||||
{
|
||||
str_t(int alen) : m_ref_count(1), m_len(alen) { m_str[0] = 0; }
|
||||
|
||||
char *str() { return &m_str[0]; }
|
||||
int len() { return m_len; }
|
||||
//private:
|
||||
int m_ref_count;
|
||||
int m_len;
|
||||
char m_str[1];
|
||||
};
|
||||
char *str() { return &m_str[0]; }
|
||||
int len() { return m_len; }
|
||||
//private:
|
||||
int m_ref_count;
|
||||
int m_len;
|
||||
char m_str[1];
|
||||
};
|
||||
|
||||
str_t *m_ptr;
|
||||
str_t *m_ptr;
|
||||
|
||||
static pblockpool m_pool;
|
||||
static pblockpool m_pool;
|
||||
|
||||
private:
|
||||
inline void init()
|
||||
{
|
||||
if (m_zero == NULL)
|
||||
{
|
||||
m_zero = new(pstring::m_pool, 0) pstring::str_t(0);
|
||||
}
|
||||
m_ptr = m_zero;
|
||||
m_ptr->m_ref_count++;
|
||||
}
|
||||
inline void init()
|
||||
{
|
||||
if (m_zero == NULL)
|
||||
{
|
||||
m_zero = new(pstring::m_pool, 0) pstring::str_t(0);
|
||||
}
|
||||
m_ptr = m_zero;
|
||||
m_ptr->m_ref_count++;
|
||||
}
|
||||
|
||||
inline int pcmp(const char *right) const
|
||||
{
|
||||
return pcmp(m_ptr->str(), right);
|
||||
}
|
||||
inline int pcmp(const char *right) const
|
||||
{
|
||||
return pcmp(m_ptr->str(), right);
|
||||
}
|
||||
|
||||
inline int pcmp(const char *left, const char *right, int count = -1) const
|
||||
{
|
||||
if (count < 0)
|
||||
return strcmp(left, right);
|
||||
else
|
||||
return strncmp(left, right, count);
|
||||
}
|
||||
inline int pcmp(const char *left, const char *right, int count = -1) const
|
||||
{
|
||||
if (count < 0)
|
||||
return strcmp(left, right);
|
||||
else
|
||||
return strncmp(left, right, count);
|
||||
}
|
||||
|
||||
int pcmpi(const char *lhs, const char *rhs, int count = -1) const;
|
||||
int pcmpi(const char *lhs, const char *rhs, int count = -1) const;
|
||||
|
||||
void pcopy(const char *from, int size);
|
||||
void pcopy(const char *from, int size);
|
||||
|
||||
inline void pcopy(const char *from)
|
||||
{
|
||||
pcopy(from, strlen(from));
|
||||
}
|
||||
inline void pcopy(const char *from)
|
||||
{
|
||||
pcopy(from, strlen(from));
|
||||
}
|
||||
|
||||
inline void pcopy(const pstring &from)
|
||||
{
|
||||
sfree(m_ptr);
|
||||
m_ptr = from.m_ptr;
|
||||
m_ptr->m_ref_count++;
|
||||
}
|
||||
inline void pcopy(const pstring &from)
|
||||
{
|
||||
sfree(m_ptr);
|
||||
m_ptr = from.m_ptr;
|
||||
m_ptr->m_ref_count++;
|
||||
}
|
||||
|
||||
void pcat(const char *s);
|
||||
void pcat(const char *s);
|
||||
|
||||
static str_t *salloc(int n);
|
||||
static void sfree(str_t *s);
|
||||
static str_t *salloc(int n);
|
||||
static void sfree(str_t *s);
|
||||
|
||||
static str_t *m_zero;
|
||||
static str_t *m_zero;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* _PSTRING_H_ */
|
||||
|
||||
|
@ -698,7 +698,7 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list)
|
||||
{
|
||||
const discrete_block *block = block_list[i];
|
||||
|
||||
//discrete_base_node *node = block->factory->Create(this, block);
|
||||
//discrete_base_node *node = block->factory->Create(this, block);
|
||||
discrete_base_node *node = block->factory(this, block);
|
||||
/* keep track of special nodes */
|
||||
if (block->node == NODE_SPECIAL)
|
||||
|
@ -4531,7 +4531,7 @@ discrete_base_node * discrete_node_factory<C>::Create(discrete_device * pdev, co
|
||||
template <class C>
|
||||
discrete_base_node *discrete_create_node(discrete_device * pdev, const discrete_block *block)
|
||||
{
|
||||
return discrete_node_factory< C >().Create(pdev, block);
|
||||
return discrete_node_factory< C >().Create(pdev, block);
|
||||
}
|
||||
|
||||
#define DISCRETE_SOUND_EXTERN(name) extern const discrete_block name##_discrete_interface[]
|
||||
|
@ -381,7 +381,7 @@ void es5505_device::device_start()
|
||||
/* initialize the regions */
|
||||
m_region_base[0] = m_es5505_region0 ? (UINT16 *)machine().root_device().memregion(m_es5505_region0)->base() : NULL;
|
||||
m_region_base[1] = m_es5505_region1 ? (UINT16 *)machine().root_device().memregion(m_es5505_region1)->base() : NULL;
|
||||
|
||||
|
||||
/* initialize the rest of the structure */
|
||||
m_master_clock = clock();
|
||||
m_irq_callback_func.resolve(m_es5505_irq_callback, *this);
|
||||
@ -2208,7 +2208,6 @@ READ16_MEMBER( es5505_device::read )
|
||||
|
||||
void es5505_device::voice_bank_w(int voice, int bank)
|
||||
{
|
||||
|
||||
#if RAINE_CHECK
|
||||
m_voice[voice].control = CONTROL_STOPMASK;
|
||||
#endif
|
||||
@ -2226,7 +2225,6 @@ void es550x_device::sound_stream_update(sound_stream &stream, stream_sample_t **
|
||||
|
||||
void es5506_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
|
||||
{
|
||||
|
||||
#if MAKE_WAVS
|
||||
/* start the logging once we have a sample rate */
|
||||
if (m_sample_rate)
|
||||
@ -2273,7 +2271,6 @@ void es5506_device::sound_stream_update(sound_stream &stream, stream_sample_t **
|
||||
|
||||
void es5505_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
|
||||
{
|
||||
|
||||
#if MAKE_WAVS
|
||||
/* start the logging once we have a sample rate */
|
||||
if (m_sample_rate)
|
||||
@ -2316,4 +2313,4 @@ void es5505_device::sound_stream_update(sound_stream &stream, stream_sample_t **
|
||||
offset += length;
|
||||
samples -= length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ struct es550x_voice
|
||||
index(0),
|
||||
filtcount(0),
|
||||
accum_mask(0) {}
|
||||
|
||||
|
||||
/* external state */
|
||||
UINT32 control; /* control register */
|
||||
UINT32 freqcount; /* frequency count register */
|
||||
@ -139,9 +139,9 @@ protected:
|
||||
#if MAKE_WAVS
|
||||
void * m_wavraw; /* raw waveform */
|
||||
#endif
|
||||
|
||||
|
||||
FILE *m_eslog;
|
||||
|
||||
|
||||
void update_irq_state();
|
||||
void update_internal_irq_state();
|
||||
void compute_tables();
|
||||
@ -158,7 +158,7 @@ class es5506_device : public es550x_device,
|
||||
public:
|
||||
es5506_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
~es5506_device() {}
|
||||
|
||||
|
||||
DECLARE_READ8_MEMBER( read );
|
||||
DECLARE_WRITE8_MEMBER( write );
|
||||
void voice_bank_w(int voice, int bank);
|
||||
@ -170,8 +170,8 @@ protected:
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||
|
||||
|
||||
|
||||
|
||||
void generate_samples(INT32 **outputs, int offset, int samples);
|
||||
|
||||
private:
|
||||
@ -191,7 +191,7 @@ class es5505_device : public es550x_device,
|
||||
{
|
||||
public:
|
||||
es5505_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
|
||||
DECLARE_READ16_MEMBER( read );
|
||||
DECLARE_WRITE16_MEMBER( write );
|
||||
void voice_bank_w(int voice, int bank);
|
||||
@ -200,11 +200,11 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
|
||||
|
||||
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||
|
||||
|
||||
void generate_samples(INT32 **outputs, int offset, int samples);
|
||||
|
||||
|
||||
private:
|
||||
// internal state
|
||||
inline void reg_write_low(es550x_voice *voice, offs_t offset, UINT16 data, UINT16 mem_mask);
|
||||
|
@ -63,14 +63,14 @@ void k054539_device::static_set_interface(device_t &device, const k054539_interf
|
||||
22d: Data read/write port
|
||||
22e: ROM/RAM select (00..7f == ROM banks, 80 = Reverb RAM)
|
||||
22f: Global control:
|
||||
.......x - Enable PCM
|
||||
......x. - Timer related?
|
||||
...x.... - Enable ROM/RAM readback from 0x22d
|
||||
..x..... - Timer output enable?
|
||||
x....... - Disable register RAM updates
|
||||
.......x - Enable PCM
|
||||
......x. - Timer related?
|
||||
...x.... - Enable ROM/RAM readback from 0x22d
|
||||
..x..... - Timer output enable?
|
||||
x....... - Disable register RAM updates
|
||||
|
||||
The chip has an optional 0x8000 byte reverb buffer.
|
||||
The reverb delay is actually an offset in this buffer.
|
||||
The chip has an optional 0x8000 byte reverb buffer.
|
||||
The reverb delay is actually an offset in this buffer.
|
||||
*/
|
||||
|
||||
void k054539_device::init_flags(int _flags)
|
||||
@ -440,7 +440,7 @@ WRITE8_MEMBER(k054539_device::write)
|
||||
cur_limit = data == 0x80 ? 0x4000 : 0x20000;
|
||||
cur_ptr = 0;
|
||||
break;
|
||||
|
||||
|
||||
case 0x22f:
|
||||
if (!(data & 0x20)) // Disable timer output?
|
||||
{
|
||||
@ -537,4 +537,4 @@ void k054539_device::device_start()
|
||||
void k054539_device::device_reset()
|
||||
{
|
||||
m_timer->enable(false);
|
||||
}
|
||||
}
|
||||
|
@ -49,9 +49,9 @@ public:
|
||||
k054539_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
// static configuration helpers
|
||||
static void static_set_interface(device_t &device, const k054539_interface &interface);
|
||||
static void static_set_interface(device_t &device, const k054539_interface &interface);
|
||||
template<class _Object> static devcb2_base &set_timer_handler(device_t &device, _Object object) { return downcast<k054539_device &>(device).m_timer_handler.set_callback(object); }
|
||||
|
||||
|
||||
|
||||
DECLARE_WRITE8_MEMBER(write);
|
||||
DECLARE_READ8_MEMBER(read);
|
||||
@ -109,10 +109,10 @@ private:
|
||||
|
||||
channel channels[8];
|
||||
sound_stream *stream;
|
||||
|
||||
emu_timer *m_timer;
|
||||
UINT32 m_timer_state;
|
||||
devcb2_write_line m_timer_handler;
|
||||
|
||||
emu_timer *m_timer;
|
||||
UINT32 m_timer_state;
|
||||
devcb2_write_line m_timer_handler;
|
||||
|
||||
bool regupdate();
|
||||
void keyon(int channel);
|
||||
|
@ -59,7 +59,7 @@ READ8_MEMBER( k056800_device::host_r )
|
||||
{
|
||||
UINT32 r = offset & 7;
|
||||
UINT8 data = 0;
|
||||
|
||||
|
||||
switch (r)
|
||||
{
|
||||
case 0:
|
||||
@ -102,7 +102,7 @@ WRITE8_MEMBER( k056800_device::host_w )
|
||||
// .... ...x - Mute front
|
||||
// .... ..x. - Mute rear
|
||||
break;
|
||||
|
||||
|
||||
case 7:
|
||||
// Sound interrupt
|
||||
m_int_pending = true;
|
||||
@ -119,7 +119,7 @@ READ8_MEMBER( k056800_device::sound_r )
|
||||
{
|
||||
UINT32 r = offset & 7;
|
||||
UINT8 data = 0;
|
||||
|
||||
|
||||
switch (r)
|
||||
{
|
||||
case 0:
|
||||
@ -144,7 +144,7 @@ WRITE8_MEMBER( k056800_device::sound_w )
|
||||
case 1:
|
||||
m_snd_to_host_regs[r] = data;
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
// TODO: Unknown
|
||||
@ -167,9 +167,9 @@ WRITE8_MEMBER( k056800_device::sound_w )
|
||||
m_int_handler(CLEAR_LINE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 5:
|
||||
// TODO: Unknown
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#define MCFG_K056800_ADD(_tag, _clock) \
|
||||
MCFG_DEVICE_ADD(_tag, K056800, _clock) \
|
||||
|
||||
MCFG_DEVICE_ADD(_tag, K056800, _clock)
|
||||
#define MCFG_K056800_INT_HANDLER(_devcb) \
|
||||
devcb = &k056800_device::set_int_handler(*device, DEVCB2_##_devcb);
|
||||
|
||||
@ -45,12 +44,12 @@ protected:
|
||||
|
||||
private:
|
||||
// internal state
|
||||
bool m_int_pending;
|
||||
bool m_int_enabled;
|
||||
UINT8 m_host_to_snd_regs[4];
|
||||
UINT8 m_snd_to_host_regs[2];
|
||||
bool m_int_pending;
|
||||
bool m_int_enabled;
|
||||
UINT8 m_host_to_snd_regs[4];
|
||||
UINT8 m_snd_to_host_regs[2];
|
||||
|
||||
devcb2_write_line m_int_handler;
|
||||
devcb2_write_line m_int_handler;
|
||||
};
|
||||
|
||||
extern const device_type K056800;
|
||||
|
@ -128,7 +128,7 @@ bool mpeg_audio::read_header_amm(bool layer25)
|
||||
int stereo_mode_ext = gb(2);
|
||||
param_index = gb(3);
|
||||
gb(1); // must be zero
|
||||
|
||||
|
||||
channel_count = stereo_mode != 3 ? 2 : 1;
|
||||
|
||||
total_bands = total_band_counts[param_index];
|
||||
@ -137,7 +137,7 @@ bool mpeg_audio::read_header_amm(bool layer25)
|
||||
joint_bands = joint_band_counts[stereo_mode_ext];
|
||||
if(joint_bands > total_bands )
|
||||
joint_bands = total_bands;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -34,9 +34,9 @@
|
||||
* Also make sure to correspond the memory regions to those used in the
|
||||
* processor, as each is shared.
|
||||
*/
|
||||
|
||||
|
||||
#include "nes_defs.h"
|
||||
|
||||
|
||||
/* GLOBAL CONSTANTS */
|
||||
#define SYNCS_MAX1 0x20
|
||||
#define SYNCS_MAX2 0x80
|
||||
@ -56,7 +56,7 @@ public:
|
||||
|
||||
DECLARE_READ8_MEMBER( read );
|
||||
DECLARE_WRITE8_MEMBER( write );
|
||||
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
@ -77,7 +77,7 @@ private:
|
||||
uint32 m_sync_times1[SYNCS_MAX1]; /* Samples per sync table */
|
||||
uint32 m_sync_times2[SYNCS_MAX2]; /* Samples per sync table */
|
||||
sound_stream *m_stream;
|
||||
|
||||
|
||||
void create_syncs(unsigned long sps);
|
||||
int8 apu_square(square_t *chan);
|
||||
int8 apu_triangle(triangle_t *chan);
|
||||
|
@ -301,7 +301,7 @@ void sn76477_device::device_start()
|
||||
}
|
||||
|
||||
intialize_noise();
|
||||
|
||||
|
||||
/* set up interface values */
|
||||
_SN76477_enable_w(m_intf_enable);
|
||||
_SN76477_vco_w(m_intf_vco);
|
||||
|
@ -82,7 +82,7 @@ class sn76477_device : public device_t,
|
||||
public:
|
||||
sn76477_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
~sn76477_device() {}
|
||||
|
||||
|
||||
/* these functions take 0 or 1 as a logic input */
|
||||
WRITE_LINE_MEMBER( enable_w ); /* active LO, 0 = enabled, 1 = disabled */
|
||||
WRITE_LINE_MEMBER( mixer_a_w );
|
||||
@ -106,8 +106,8 @@ public:
|
||||
|
||||
/* these functions take a capacitor value in Farads or the voltage on it in Volts */
|
||||
#define SN76477_EXTERNAL_VOLTAGE_DISCONNECT (-1.0) /* indicates that the voltage is internally computed,
|
||||
can be used in all the functions that take a
|
||||
voltage on a capacitor */
|
||||
can be used in all the functions that take a
|
||||
voltage on a capacitor */
|
||||
void one_shot_cap_w(double data);
|
||||
void one_shot_cap_voltage_w(double data);
|
||||
void slf_cap_w(double data);
|
||||
@ -131,7 +131,7 @@ protected:
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||
|
||||
|
||||
private:
|
||||
/* chip's external interface */
|
||||
UINT32 m_enable;
|
||||
@ -167,7 +167,7 @@ private:
|
||||
double m_amplitude_res;
|
||||
double m_feedback_res;
|
||||
double m_pitch_voltage;
|
||||
|
||||
|
||||
// internal state
|
||||
double m_one_shot_cap_voltage; /* voltage on the one-shot cap */
|
||||
UINT32 m_one_shot_running_ff; /* 1 = one-shot running, 0 = stopped */
|
||||
@ -191,9 +191,9 @@ private:
|
||||
/* others */
|
||||
sound_stream *m_channel; /* returned by stream_create() */
|
||||
int m_our_sample_rate; /* from machine.sample_rate() */
|
||||
|
||||
|
||||
wav_file *m_file; /* handle of the wave file to produce */
|
||||
|
||||
|
||||
double compute_one_shot_cap_charging_rate();
|
||||
double compute_one_shot_cap_discharging_rate();
|
||||
double compute_slf_cap_charging_rate();
|
||||
@ -206,7 +206,7 @@ private:
|
||||
double compute_attack_decay_cap_charging_rate();
|
||||
double compute_attack_decay_cap_discharging_rate();
|
||||
double compute_center_to_peak_voltage_out();
|
||||
|
||||
|
||||
void log_enable_line();
|
||||
void log_mixer_mode();
|
||||
void log_envelope_mode();
|
||||
@ -223,16 +223,16 @@ private:
|
||||
void log_decay_time();
|
||||
void log_voltage_out();
|
||||
void log_complete_state();
|
||||
|
||||
|
||||
void open_wav_file();
|
||||
void close_wav_file();
|
||||
void add_wav_data(INT16 data_l, INT16 data_r);
|
||||
|
||||
|
||||
void intialize_noise();
|
||||
inline UINT32 generate_next_real_noise_bit();
|
||||
|
||||
|
||||
void state_save_register();
|
||||
|
||||
|
||||
void _SN76477_enable_w(UINT32 data);
|
||||
void _SN76477_vco_w(UINT32 data);
|
||||
void _SN76477_mixer_a_w(UINT32 data);
|
||||
|
@ -83,7 +83,7 @@ private:
|
||||
void speaker_postload();
|
||||
|
||||
// DC blocker state
|
||||
double m_prevx, m_prevy;
|
||||
double m_prevx, m_prevy;
|
||||
};
|
||||
|
||||
extern const device_type SPEAKER_SOUND;
|
||||
|
@ -13,9 +13,9 @@ class wave_device : public device_t,
|
||||
{
|
||||
public:
|
||||
wave_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
|
||||
static void static_set_cassette_tag(device_t &device, const char *cassette_tag);
|
||||
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
|
@ -163,7 +163,7 @@ void ymz770_device::sound_stream_update(sound_stream &stream, stream_sample_t **
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// process channels
|
||||
INT32 mix = 0;
|
||||
|
||||
@ -174,11 +174,11 @@ void ymz770_device::sound_stream_update(sound_stream &stream, stream_sample_t **
|
||||
// force finish current block
|
||||
mix += (m_channels[ch].output_data[m_channels[ch].output_ptr++]*m_channels[ch].volume);
|
||||
m_channels[ch].output_remaining--;
|
||||
|
||||
|
||||
if (m_channels[ch].output_remaining == 0 && !m_channels[ch].is_playing)
|
||||
m_channels[ch].decoder->clear();
|
||||
}
|
||||
|
||||
|
||||
else if (m_channels[ch].is_playing)
|
||||
{
|
||||
retry:
|
||||
@ -254,11 +254,11 @@ void ymz770_device::internal_reg_write(UINT8 reg, UINT8 data)
|
||||
m_mute = data & 1;
|
||||
m_doen = data >> 1 & 1;
|
||||
break;
|
||||
|
||||
|
||||
case 0x01:
|
||||
m_vlma = data;
|
||||
break;
|
||||
|
||||
|
||||
case 0x02:
|
||||
m_bsl = data & 7;
|
||||
m_cpl = data >> 4 & 7;
|
||||
@ -308,7 +308,7 @@ void ymz770_device::internal_reg_write(UINT8 reg, UINT8 data)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sequencer registers
|
||||
else
|
||||
{
|
||||
|
@ -114,27 +114,27 @@ void fixedfreq_device::device_start()
|
||||
//m_vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vga_device::vblank_timer_cb),this));
|
||||
recompute_parameters(false);
|
||||
|
||||
save_item(NAME(m_vid));
|
||||
save_item(NAME(m_last_x));
|
||||
save_item(NAME(m_last_y));
|
||||
save_item(NAME(m_last_time));
|
||||
save_item(NAME(m_line_time));
|
||||
save_item(NAME(m_last_hsync_time));
|
||||
save_item(NAME(m_last_vsync_time));
|
||||
save_item(NAME(m_refresh));
|
||||
save_item(NAME(m_clock_period));
|
||||
//save_item(NAME(m_bitmap[0]));
|
||||
//save_item(NAME(m_bitmap[1]));
|
||||
save_item(NAME(m_cur_bm));
|
||||
save_item(NAME(m_vid));
|
||||
save_item(NAME(m_last_x));
|
||||
save_item(NAME(m_last_y));
|
||||
save_item(NAME(m_last_time));
|
||||
save_item(NAME(m_line_time));
|
||||
save_item(NAME(m_last_hsync_time));
|
||||
save_item(NAME(m_last_vsync_time));
|
||||
save_item(NAME(m_refresh));
|
||||
save_item(NAME(m_clock_period));
|
||||
//save_item(NAME(m_bitmap[0]));
|
||||
//save_item(NAME(m_bitmap[1]));
|
||||
save_item(NAME(m_cur_bm));
|
||||
|
||||
/* sync separator */
|
||||
save_item(NAME(m_vint));
|
||||
save_item(NAME(m_int_trig));
|
||||
save_item(NAME(m_mult));
|
||||
/* sync separator */
|
||||
save_item(NAME(m_vint));
|
||||
save_item(NAME(m_int_trig));
|
||||
save_item(NAME(m_mult));
|
||||
|
||||
save_item(NAME(m_sig_vsync));
|
||||
save_item(NAME(m_sig_composite));
|
||||
save_item(NAME(m_sig_field));
|
||||
save_item(NAME(m_sig_vsync));
|
||||
save_item(NAME(m_sig_composite));
|
||||
save_item(NAME(m_sig_field));
|
||||
|
||||
|
||||
|
||||
@ -210,7 +210,7 @@ int fixedfreq_device::sync_separator(attotime time, double newval)
|
||||
int ret = 0;
|
||||
|
||||
m_vint += ((double) last_comp - m_vint) * (1.0 - exp(-time.as_double() * m_mult));
|
||||
m_sig_composite = (newval < m_sync_threshold) ? 1 : 0 ;
|
||||
m_sig_composite = (newval < m_sync_threshold) ? 1 : 0 ;
|
||||
|
||||
m_sig_vsync = (m_vint > m_int_trig) ? 1 : 0;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user