Moved nltool.c and nlwav.c into src/emu/netlist/prg.

Added src/emu/netlist/build/makefile. This allows netlist to be ripped
out of the tree and to compile it standalone. (nw)
This commit is contained in:
couriersud 2015-08-23 20:58:50 +02:00
parent f8e7f02ce0
commit 3011b4b068
13 changed files with 213 additions and 65 deletions

View File

@ -615,7 +615,7 @@ includedirs {
}
files {
MAME_DIR .. "src/tools/nltool.c",
MAME_DIR .. "src/emu/netlist/prg/nltool.c",
}
--------------------------------------------------
@ -651,7 +651,7 @@ includedirs {
}
files {
MAME_DIR .. "src/tools/nlwav.c",
MAME_DIR .. "src/emu/netlist/prg/nlwav.c",
}
--------------------------------------------------

View File

@ -0,0 +1,166 @@
###########################################################################
#
# makefile
#
# Core makefile for building MAME and derivatives
#
# Copyright (c) Nicola Salmoria and the MAME Team.
# Visit http://mamedev.org for licensing and usage restrictions.
#
###########################################################################
OBJ = obj
SRC = ..
#-fuse-ld=gold -Wpedantic -march=native -march=native
# LTO = -flto=4 -fuse-linker-plugin -flto-partition=balanced -Wodr
CDEFS = -DPSTANDALONE=1 -DPTR64=1
#-Werror
CFLAGS = $(LTO) -g -O3 -std=c++98 -march=native -msse4.2 -Wall -Wpedantic -Wsign-compare -Wextra -Wno-long-long -Wno-unused-parameter -Wno-unused-result -Wno-variadic-macros -I..
LDFLAGS = $(LTO) -g -O3 -std=c++98
#CFLAGS = $(LTO) -g -O3 -std=c++11 -Wall -Wpedantic -Wsign-compare -Wextra -Isrc
#LDFLAGS = $(LTO) -g -O3 -std=c++11
CC = @g++-5
LD = @g++-5
MD = @mkdir
RM = @rm
TARGETS = nltool nlwav
NLOBJ = $(OBJ)
POBJ = $(OBJ)/plib
OBJDIRS = $(OBJ) \
$(OBJ)/analog \
$(OBJ)/solver \
$(OBJ)/devices \
$(OBJ)/plib \
$(OBJ)/devices \
$(OBJ)/macro \
$(OBJ)/tools \
$(OBJ)/prg \
OBJS = $(POBJS) $(NLOBJS)
POBJS := \
$(POBJ)/pstring.o \
$(POBJ)/palloc.o \
$(POBJ)/pparser.o \
$(POBJ)/pstate.o \
$(POBJ)/pstream.o \
NLOBJS := \
$(NLOBJ)/nl_base.o \
$(NLOBJ)/nl_parser.o \
$(NLOBJ)/nl_setup.o \
$(NLOBJ)/nl_factory.o \
$(NLOBJ)/analog/nld_bjt.o \
$(NLOBJ)/analog/nld_fourterm.o \
$(NLOBJ)/analog/nld_switches.o \
$(NLOBJ)/analog/nld_twoterm.o \
$(NLOBJ)/analog/nld_opamps.o \
$(NLOBJ)/devices/nld_4020.o \
$(NLOBJ)/devices/nld_4066.o \
$(NLOBJ)/devices/nld_7400.o \
$(NLOBJ)/devices/nld_7402.o \
$(NLOBJ)/devices/nld_7404.o \
$(NLOBJ)/devices/nld_7408.o \
$(NLOBJ)/devices/nld_7410.o \
$(NLOBJ)/devices/nld_7411.o \
$(NLOBJ)/devices/nld_7420.o \
$(NLOBJ)/devices/nld_7425.o \
$(NLOBJ)/devices/nld_7427.o \
$(NLOBJ)/devices/nld_7430.o \
$(NLOBJ)/devices/nld_7432.o \
$(NLOBJ)/devices/nld_7437.o \
$(NLOBJ)/devices/nld_7448.o \
$(NLOBJ)/devices/nld_7450.o \
$(NLOBJ)/devices/nld_7474.o \
$(NLOBJ)/devices/nld_7483.o \
$(NLOBJ)/devices/nld_7486.o \
$(NLOBJ)/devices/nld_7490.o \
$(NLOBJ)/devices/nld_7493.o \
$(NLOBJ)/devices/nld_74107.o \
$(NLOBJ)/devices/nld_74123.o \
$(NLOBJ)/devices/nld_74153.o \
$(NLOBJ)/devices/nld_74175.o \
$(NLOBJ)/devices/nld_74192.o \
$(NLOBJ)/devices/nld_74193.o \
$(NLOBJ)/devices/nld_74279.o \
$(NLOBJ)/devices/nld_74ls629.o \
$(NLOBJ)/devices/nld_82S16.o \
$(NLOBJ)/devices/nld_9310.o \
$(NLOBJ)/devices/nld_9312.o \
$(NLOBJ)/devices/nld_9316.o \
$(NLOBJ)/devices/nld_mm5837.o \
$(NLOBJ)/devices/nld_ne555.o \
$(NLOBJ)/devices/nld_r2r_dac.o \
$(NLOBJ)/devices/nld_legacy.o \
$(NLOBJ)/devices/net_lib.o \
$(NLOBJ)/devices/nld_log.o \
$(NLOBJ)/devices/nld_system.o \
$(NLOBJ)/devices/nld_truthtable.o \
$(NLOBJ)/macro/nlm_cd4xxx.o \
$(NLOBJ)/macro/nlm_opamp.o \
$(NLOBJ)/macro/nlm_other.o \
$(NLOBJ)/macro/nlm_ttl74xx.o \
$(NLOBJ)/solver/nld_solver.o \
$(NLOBJ)/tools/nl_convert.o \
all: maketree $(TARGETS)
#-------------------------------------------------
# clean
#-------------------------------------------------
clean:
$(RM) -rf $(OBJS) $(TARGETS)
#-------------------------------------------------
# nltool
#-------------------------------------------------
nltool: $(OBJ)/prg/nltool.o $(OBJS)
@echo Linking $@...
$(LD) -o $@ $(LDFLAGS) $^ $(LIBS)
nlwav: $(OBJ)/prg/nlwav.o $(OBJS)
@echo Linking $@...
$(LD) -o $@ $(LDFLAGS) $^ $(LIBS)
#-------------------------------------------------
# directories
#-------------------------------------------------
$(sort $(OBJDIRS)):
$(MD) -p $@
maketree: $(sort $(OBJDIRS))
#-------------------------------------------------
# generic rules
#-------------------------------------------------
$(OBJ)/%.o: $(SRC)/%.c
@echo Compiling $<...
$(CC) $(CDEFS) $(CFLAGS) -c $< -o $@
$(OBJ)/%.pp: $(SRC)/%.c | $(OSPREBUILD)
@echo Compiling $<...
$(CC) $(CDEFS) $(CFLAGS) -E $< -o $@
$(OBJ)/%.s: $(SRC)/%.c | $(OSPREBUILD)
@echo Compiling $<...
$(CC) $(CDEFS) $(CFLAGS) -S $< -o $@
$(OBJ)/%.a:
@echo Archiving $@...
$(RM) $@
$(AR) $(ARFLAGS) $@ $^

View File

@ -5,6 +5,8 @@
*
*/
#include <cstdio>
#include "solver/nld_solver.h"
#include "plib/palloc.h"

View File

@ -5,9 +5,10 @@
*
*/
#include <cstdio>
#include "pconfig.h"
#include "palloc.h"
//============================================================
// Exceptions
//============================================================

View File

@ -63,9 +63,6 @@ typedef __int128_t INT128;
#if !(PSTANDALONE)
//#undef ATTR_COLD
//#define ATTR_COLD
/* use MAME */
#if (USE_DELEGATE_TYPE == DELEGATE_TYPE_INTERNAL)
#define PHAS_PMF_INTERNAL 1
@ -101,10 +98,10 @@ typedef __int128_t INT128;
/* ATTR_HOT and ATTR_COLD cause performance degration in 5.1 */
//#define ATTR_HOT
//#define ATTR_COLD
#define ATTR_HOT __attribute__((hot))
#define ATTR_HOT __attribute__((hot))
#define ATTR_COLD __attribute__((cold))
#define RESTRICT
#define RESTRICT __restrict__
#define EXPECTED(x) (x)
#define UNEXPECTED(x) (x)
#define ATTR_PRINTF(x,y) __attribute__((format(printf, x, y)))
@ -144,28 +141,6 @@ typedef int64_t INT64;
#define S64(val) val
#endif
/* MINGW has adopted the MSVC formatting for 64-bit ints as of gcc 4.4 */
#if (defined(__MINGW32__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))) || defined(_MSC_VER)
#define I64FMT "I64"
#else
#define I64FMT "ll"
#endif
#if defined(_MSC_VER) || defined(__MINGW32__)
#if (PTR64)
#define SIZETFMT "I64u"
#else
#define SIZETFMT "u"
#endif
#else
//#define SIZETFMT "zu"
#if (PTR64)
#define SIZETFMT "lu"
#else
#define SIZETFMT "u"
#endif
#endif
#endif
/*

View File

@ -566,7 +566,7 @@ public:
p = pn + onstr.len();
pn = str.find(onstr, p);
}
if (p<str.len())
if (p < (int) str.len())
{
pstring t = str.substr(p);
if (!ignore_empty || t.len() != 0)
@ -579,7 +579,7 @@ public:
pstring_list_t temp;
pstring col = "";
int i = 0;
unsigned i = 0;
while (i<str.blen())
{
int p = -1;
@ -715,6 +715,7 @@ public:
void clear()
{
#if 0
if (0)
{
unsigned cnt = 0;
@ -727,6 +728,7 @@ public:
else
printf("phashmap: No elements .. \n");
}
#endif
m_values.clear();
for (unsigned i=0; i<m_hash.size(); i++)
m_hash[i] = -1;

View File

@ -138,7 +138,7 @@ private:
pstring m_number_chars_start;
plist_t<pstring> m_tokens;
pstring m_whitespace;
char m_string;
pstring::code_t m_string;
token_id_t m_tok_comment_start;
token_id_t m_tok_comment_end;

View File

@ -21,7 +21,7 @@
class pstream
{
P_PREVENT_COPYING(pstream);
P_PREVENT_COPYING(pstream)
public:
typedef long unsigned pos_type;
@ -93,7 +93,7 @@ private:
class pistream : public pstream
{
P_PREVENT_COPYING(pistream);
P_PREVENT_COPYING(pistream)
public:
pistream(unsigned flags) : pstream(flags) {}
@ -148,7 +148,7 @@ private:
class postream : public pstream
{
P_PREVENT_COPYING(postream);
P_PREVENT_COPYING(postream)
public:
postream(unsigned flags) : pstream(flags) {}
@ -190,7 +190,7 @@ private:
class pomemstream : public postream
{
P_PREVENT_COPYING(pomemstream);
P_PREVENT_COPYING(pomemstream)
public:
pomemstream();
@ -214,7 +214,7 @@ private:
class postringstream : public postream
{
P_PREVENT_COPYING(postringstream );
P_PREVENT_COPYING(postringstream )
public:
@ -242,7 +242,7 @@ private:
class pofilestream : public postream
{
P_PREVENT_COPYING(pofilestream);
P_PREVENT_COPYING(pofilestream)
public:
pofilestream(const pstring &fname);
@ -267,7 +267,7 @@ private:
class pifilestream : public pistream
{
P_PREVENT_COPYING(pifilestream);
P_PREVENT_COPYING(pifilestream)
public:
pifilestream(const pstring &fname);
@ -292,7 +292,7 @@ private:
class pimemstream : public pistream
{
P_PREVENT_COPYING(pimemstream);
P_PREVENT_COPYING(pimemstream)
public:
pimemstream(const void *mem, const pos_type len);
@ -317,7 +317,7 @@ private:
class pistringstream : public pimemstream
{
P_PREVENT_COPYING(pistringstream);
P_PREVENT_COPYING(pistringstream)
public:
pistringstream(const pstring &str) : pimemstream(str.cstr(), str.len()), m_str(str) { }
@ -333,7 +333,7 @@ private:
class pstream_fmt_writer_t : public pfmt_writer_t<>
{
P_PREVENT_COPYING(pstream_fmt_writer_t);
P_PREVENT_COPYING(pstream_fmt_writer_t)
public:
pstream_fmt_writer_t(postream &strm) : m_strm(strm) {}

View File

@ -118,7 +118,7 @@ template<typename F>
const pstring_t<F> pstring_t<F>::substr(int start, int count) const
{
pstring_t ret;
unsigned alen = len();
int alen = (int) len();
if (start < 0)
start = 0;
if (start >= alen)
@ -148,7 +148,7 @@ const pstring_t<F> pstring_t<F>::ucase() const
{
pstring_t ret = *this;
ret.pcopy(cstr(), blen());
for (int i=0; i<ret.len(); i++)
for (unsigned i=0; i<ret.len(); i++)
ret.m_ptr->str()[i] = toupper((unsigned) ret.m_ptr->str()[i]);
return ret;
}
@ -159,11 +159,11 @@ int pstring_t<F>::find_first_not_of(const pstring_t &no) const
char *t = m_ptr->str();
unsigned nolen = no.len();
unsigned tlen = len();
for (int i=0; i < tlen; i++)
for (unsigned i=0; i < tlen; i++)
{
char *n = no.m_ptr->str();
bool f = true;
for (int j=0; j < nolen; j++)
for (unsigned j=0; j < nolen; j++)
{
if (F::code(t) == F::code(n))
f = false;
@ -183,11 +183,11 @@ int pstring_t<F>::find_last_not_of(const pstring_t &no) const
unsigned nolen = no.len();
unsigned tlen = len();
int last_found = -1;
for (int i=0; i < tlen; i++)
for (unsigned i=0; i < tlen; i++)
{
char *n = no.m_ptr->str();
bool f = true;
for (int j=0; j < nolen; j++)
for (unsigned j=0; j < nolen; j++)
{
if (F::code(t) == F::code(n))
f = false;
@ -251,7 +251,7 @@ const pstring_t<F> pstring_t<F>::rtrim(const pstring_t &ws) const
}
template<typename F>
const pstring_t<F> pstring_t<F>::rpad(const pstring_t &ws, const int cnt) const
const pstring_t<F> pstring_t<F>::rpad(const pstring_t &ws, const unsigned cnt) const
{
// FIXME: pstringbuffer ret(*this);
@ -363,7 +363,7 @@ int pstring_t<F>::find(const pstring_t &search, unsigned start) const
const char *s = search.cstr();
const unsigned startt = std::min(start, tlen);
const char *t = cstr();
for (int i=0; i<startt; i++)
for (unsigned i=0; i<startt; i++)
t += F::codelen(t);
for (int i=0; i <= (int) tlen - (int) startt - (int) slen; i++)
{
@ -392,7 +392,7 @@ int pstring_t<F>::find(const mem_t *search, unsigned start) const
const char *s = search;
const unsigned startt = std::min(start, tlen);
const char *t = cstr();
for (int i=0; i<startt; i++)
for (unsigned i=0; i<startt; i++)
t += F::codelen(t);
for (int i=0; i <= (int) tlen - (int) startt - (int) slen; i++)
{
@ -426,7 +426,7 @@ bool pstring_t<F>::endsWith(const pstring_t &arg) const
template<typename F>
bool pstring_t<F>::startsWith(const mem_t *arg) const
{
int alen = strlen(arg);
unsigned alen = strlen(arg);
if (alen > blen())
return false;
else

View File

@ -145,7 +145,7 @@ public:
const pstring_t rtrim(const pstring_t &ws = " \t\n\r") const;
const pstring_t trim(const pstring_t &ws = " \t\n\r") const { return this->ltrim(ws).rtrim(ws); }
const pstring_t rpad(const pstring_t &ws, const int cnt) const;
const pstring_t rpad(const pstring_t &ws, const unsigned cnt) const;
const pstring_t ucase() const;
@ -348,7 +348,7 @@ public:
operator pstring() const { return pstring(m_ptr); }
// concatenation operators
pstringbuffer& operator+=(const UINT8 c) { char buf[2] = { c, 0 }; pcat(buf); return *this; }
pstringbuffer& operator+=(const UINT8 c) { UINT8 buf[2] = { c, 0 }; pcat((char *) buf); return *this; }
pstringbuffer& operator+=(const pstring &string) { pcat(string); return *this; }
pstringbuffer& operator+=(const char *string) { pcat(string); return *this; }

View File

@ -11,9 +11,9 @@
#include <cstdio>
#ifdef PSTANDALONE
#if (PSTANDALONE)
#if (PSTANDALONE)
#define PSTANDALONE_PROVIDED
#endif
#endif
#endif
#include "plib/poptions.h"
@ -30,7 +30,7 @@
#include <ctime>
#define osd_ticks_t clock_t
#define osd_ticks_t clock_t
inline osd_ticks_t osd_ticks_per_second() { return CLOCKS_PER_SEC; }
@ -98,12 +98,12 @@ class tool_options_t : public poptions
public:
tool_options_t() :
poptions(),
opt_ttr ("t", "time_to_run", 1.0, "time to run the emulation (seconds)", this),
opt_ttr ("t", "time_to_run", 1.0, "time to run the emulation (seconds)", this),
opt_name("n", "name", "", "netlist in file to run; default is first one", this),
opt_logs("l", "logs", "", "colon separated list of terminals to log", this),
opt_file("f", "file", "-", "file to process (default is stdin)", this),
opt_type("y", "type", "spice", "spice:eagle", "type of file to be converted: spice,eagle", this),
opt_cmd ("c", "cmd", "run", "run|convert|listdevices", this),
opt_cmd ("c", "cmd", "run", "run|convert|listdevices", this),
opt_inp( "i", "input", "", "input file to process (default is none)", this),
opt_verb("v", "verbose", "be verbose - this produces lots of output", this),
opt_quiet("q", "quiet", "be quiet - no warnings", this),
@ -113,7 +113,7 @@ public:
poption_double opt_ttr;
poption_str opt_name;
poption_str opt_logs;
poption_str opt_file;
poption_str opt_file;
poption_str_limit opt_type;
poption_str opt_cmd;
poption_str opt_inp;
@ -211,7 +211,7 @@ public:
{
log().debug("Creating dynamic logs ...\n");
pstring_list_t ll(m_opts ? m_opts->opt_logs() : "" , ":");
for (int i=0; i < ll.size(); i++)
for (unsigned i=0; i < ll.size(); i++)
{
pstring name = "log_" + ll[i];
/*netlist_device_t *nc = */ m_setup->register_dev("LOG", name);
@ -380,7 +380,7 @@ static void listdevices()
nt.setup().start_devices();
nt.setup().resolve_inputs();
for (int i=0; i < list.size(); i++)
for (unsigned i=0; i < list.size(); i++)
{
netlist::base_factory_t *f = list.value_at(i);
pstring out = pfmt("{1} {2}(<id>")(f->classname(),"-20")(f->name());
@ -391,7 +391,7 @@ static void listdevices()
d->start_dev();
// get the list of terminals ...
for (int j=0; j < d->m_terminals.size(); j++)
for (unsigned j=0; j < d->m_terminals.size(); j++)
{
pstring inp = d->m_terminals[j];
if (inp.startsWith(d->name() + "."))

View File

@ -190,7 +190,9 @@ ATTR_HOT inline int matrix_solver_GMRES_t<m_N, _storage_N>::vsolve_non_dynamic(c
const nl_double accuracy = this->m_params.m_accuracy;
#if 1
int mr = std::min((int) iN-1,(int) sqrt(iN));
int mr = _storage_N;
if (_storage_N > 3 )
mr = (int) sqrt(iN);
mr = std::min(mr, this->m_params.m_gs_loops);
int iter = 4;
int gsl = solve_ilu_gmres(new_V, RHS, iter, mr, accuracy);