Netlist: logs now write to individual log files

This commit is contained in:
Couriersud 2013-12-01 19:26:34 +00:00
parent 7069a5828c
commit b7d1e61757
6 changed files with 64 additions and 20 deletions

2
.gitattributes vendored
View File

@ -2140,6 +2140,8 @@ src/emu/netlist/devices/nld_7486.c svneol=native#text/plain
src/emu/netlist/devices/nld_7486.h svneol=native#text/plain
src/emu/netlist/devices/nld_NE555.c svneol=native#text/plain
src/emu/netlist/devices/nld_NE555.h svneol=native#text/plain
src/emu/netlist/devices/nld_log.c svneol=native#text/plain
src/emu/netlist/devices/nld_log.h svneol=native#text/plain
src/emu/netlist/devices/nld_signal.h svneol=native#text/plain
src/emu/netlist/devices/nld_system.c svneol=native#text/plain
src/emu/netlist/devices/nld_system.h svneol=native#text/plain

View File

@ -68,17 +68,6 @@ NETLIB_UPDATE(analog_input)
{
}
NETLIB_START(log)
{
register_input("I", m_I);
}
NETLIB_UPDATE(log)
{
printf("%s: %f %f\n", name().cstr(), netlist().time().as_double(), INPANALOG(m_I));
}
NETLIB_START(nicMultiSwitch)
{
static const char *sIN[8] = { "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8" };

View File

@ -68,6 +68,8 @@
#include "nld_NE555.h"
#include "nld_log.h"
// this is a bad hack
#define USE_OLD7493 (0)
@ -87,7 +89,7 @@
NET_CONNECT(_name, i1, _i1) \
NET_CONNECT(_name, i2, _i2)
#define NETDEV_DELAY_RISE(_name, _CLK, _D) \
NET_REGISTER_DEV(delay_lh, _name) \
NET_REGISTER_DEV(delay_lh, _name) \
NET_CONNECT(_name, CLK, _CLK) \
NET_CONNECT(_name, D, _D)
#define NETDEV_RSFF(_name, _S, _R) \
@ -95,9 +97,6 @@
NET_CONNECT(_name, S, _S) \
NET_CONNECT(_name, R, _R)
#define NETDEV_LOG(_name, _I) \
NET_REGISTER_DEV(log, _name) \
NET_CONNECT(_name, I, _I)
// ----------------------------------------------------------------------------------------
@ -203,11 +202,6 @@ NETLIB_DEVICE(analog_input,
netlist_analog_output_t m_Q;
);
NETLIB_DEVICE(log,
netlist_analog_input_t m_I;
);
// ----------------------------------------------------------------------------------------
// Special devices ...
// ----------------------------------------------------------------------------------------

View File

@ -0,0 +1,24 @@
/*
* nld_log.c
*
*/
#include "nld_log.h"
NETLIB_START(log)
{
register_input("I", m_I);
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));
}
NETLIB_NAME(log)::~NETLIB_NAME(log)()
{
fclose(m_file);
}

View File

@ -0,0 +1,34 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
/*
* nld_log.h
*
* Devices supporting analysis and logging
*
* nld_log:
*
* +---------+
* | ++ |
* I | | ==> Log to file "netlist_" + name() + ".log"
* | |
* +---------+
*
*/
#ifndef NLD_LOG_H_
#define NLD_LOG_H_
#include "../nl_base.h"
#define NETDEV_LOG(_name, _I) \
NET_REGISTER_DEV(log, _name) \
NET_CONNECT(_name, I, _I)
NETLIB_DEVICE(log,
~NETLIB_NAME(log)();
netlist_analog_input_t m_I;
private:
FILE *m_file;
);
#endif /* NLD_LOG_H_ */

View File

@ -29,4 +29,5 @@ NETLISTOBJS+= \
$(NETLISTOBJ)/devices/nld_7474.o \
$(NETLISTOBJ)/devices/nld_7486.o \
$(NETLISTOBJ)/devices/nld_NE555.o \
$(NETLISTOBJ)/devices/nld_log.o \