netlist: maintenance. (nw)

- switch to VS 2019 community and fix standalone build.
- more migration to C++ comment style.
- add some more doxygen markup.
This commit is contained in:
couriersud 2019-11-08 12:56:05 +01:00
parent ffe5c0772c
commit bbbd1c0e8e
16 changed files with 238 additions and 202 deletions

View File

@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
/*
* nld_bjt.c
*
*/
#include "netlist/solver/nld_solver.h"
#include "netlist/nl_setup.h"

View File

@ -261,8 +261,9 @@ tidy_db: compile_commands_prefix $(ALL_TIDY_FILES) compile_commands_postfix
# -Wno-missing-variable-declarations : Device factory code, on purpose
mingw:
$(MAKE) CEXTRAFLAGS="-DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN" \
LDEXTRAFLAGS="-Wl,--subsystem,console -municode" LIBS= MD=@mkdir.exe SHELL=sh.exe
$(MAKE) CEXTRAFLAGS="-DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501 \
-DWIN32_LEAN_AND_MEAN" LDEXTRAFLAGS="-Wl,--subsystem,console \
-municode" LIBS= MD=@mkdir.exe SHELL=sh.exe DOXYGEN=doxygen.exe $(PARAMS)
#
# FIXME: Unicode
@ -275,6 +276,9 @@ doc: nltool
./nltool -c docheader > ../documentation/devsyn.dox.h
$(DOXYGEN) doxygen.conf
docw:
$(DOXYGEN) doxygen.conf
#-------------------------------------------------
# depends
#-------------------------------------------------

View File

@ -21,28 +21,28 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{A374399B-B87F-4E0F-9525-6C099600705F}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@ -100,13 +100,15 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)..\..\</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)..;$(SolutionDir)..\..</AdditionalIncludeDirectories>
<Optimization>Full</Optimization>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalOptions>/bigobj</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\analog\nld_bjt.cpp" />
<ClCompile Include="..\analog\nld_mosfet.cpp" />
<ClCompile Include="..\analog\nld_opamps.cpp" />
<ClCompile Include="..\analog\nld_switches.cpp" />
<ClCompile Include="..\analog\nlid_fourterm.cpp" />
@ -114,6 +116,8 @@
<ClCompile Include="..\devices\net_lib.cpp" />
<ClCompile Include="..\devices\nld_2102A.cpp" />
<ClCompile Include="..\devices\nld_2716.cpp" />
<ClCompile Include="..\devices\nld_7497.cpp" />
<ClCompile Include="..\devices\nld_schmitt.cpp" />
<ClCompile Include="..\devices\nld_tms4800.cpp" />
<ClCompile Include="..\devices\nld_4020.cpp" />
<ClCompile Include="..\devices\nld_4066.cpp" />
@ -169,18 +173,15 @@
<ClCompile Include="..\nl_factory.cpp" />
<ClCompile Include="..\nl_parser.cpp" />
<ClCompile Include="..\nl_setup.cpp" />
<ClCompile Include="..\plib\palloc.cpp" />
<ClCompile Include="..\plib\pchrono.cpp" />
<ClCompile Include="..\plib\pdynlib.cpp" />
<ClCompile Include="..\plib\pexception.cpp" />
<ClCompile Include="..\plib\pfmtlog.cpp" />
<ClCompile Include="..\plib\pfunction.cpp" />
<ClCompile Include="..\plib\pmain.cpp" />
<ClCompile Include="..\plib\poptions.cpp" />
<ClCompile Include="..\plib\pparser.cpp" />
<ClCompile Include="..\plib\pstate.cpp" />
<ClCompile Include="..\plib\pstream.cpp" />
<ClCompile Include="..\plib\ppreprocessor.cpp" />
<ClCompile Include="..\plib\pstring.cpp" />
<ClCompile Include="..\plib\ptokenizer.cpp" />
<ClCompile Include="..\plib\putil.cpp" />
<ClCompile Include="..\solver\nld_matrix_solver.cpp" />
<ClCompile Include="..\solver\nld_solver.cpp" />
@ -189,6 +190,8 @@
<ItemGroup>
<ClInclude Include="..\analog\nld_bjt.h" />
<ClInclude Include="..\analog\nld_fourterm.h" />
<ClInclude Include="..\analog\nld_generic_models.h" />
<ClInclude Include="..\analog\nld_mosfet.h" />
<ClInclude Include="..\analog\nld_opamps.h" />
<ClInclude Include="..\analog\nld_switches.h" />
<ClInclude Include="..\analog\nld_twoterm.h" />
@ -197,6 +200,8 @@
<ClInclude Include="..\devices\net_lib.h" />
<ClInclude Include="..\devices\nld_2102A.h" />
<ClInclude Include="..\devices\nld_2716.h" />
<ClInclude Include="..\devices\nld_7497.h" />
<ClInclude Include="..\devices\nld_schmitt.h" />
<ClInclude Include="..\devices\nld_tms4800.h" />
<ClInclude Include="..\devices\nld_4020.h" />
<ClInclude Include="..\devices\nld_4066.h" />
@ -253,7 +258,6 @@
<ClInclude Include="..\macro\nlm_opamp.h" />
<ClInclude Include="..\macro\nlm_other.h" />
<ClInclude Include="..\macro\nlm_ttl74xx.h" />
<ClInclude Include="..\netlist_types.h" />
<ClInclude Include="..\nl_base.h" />
<ClInclude Include="..\nl_config.h" />
<ClInclude Include="..\nl_dice_compat.h" />
@ -262,8 +266,10 @@
<ClInclude Include="..\nl_lists.h" />
<ClInclude Include="..\nl_parser.h" />
<ClInclude Include="..\nl_setup.h" />
<ClInclude Include="..\nl_time.h" />
<ClInclude Include="..\plib\gmres.h" />
<ClInclude Include="..\plib\mat_cr.h" />
<ClInclude Include="..\plib\palloc.h" />
<ClInclude Include="..\plib\parray.h" />
<ClInclude Include="..\plib\pchrono.h" />
<ClInclude Include="..\plib\pconfig.h" />
<ClInclude Include="..\plib\pdynlib.h" />
@ -272,15 +278,24 @@
<ClInclude Include="..\plib\pfunction.h" />
<ClInclude Include="..\plib\plists.h" />
<ClInclude Include="..\plib\pmain.h" />
<ClInclude Include="..\plib\pmath.h" />
<ClInclude Include="..\plib\pmatrix2d.h" />
<ClInclude Include="..\plib\pmempool.h" />
<ClInclude Include="..\plib\pomp.h" />
<ClInclude Include="..\plib\poptions.h" />
<ClInclude Include="..\plib\pparser.h" />
<ClInclude Include="..\plib\ppmf.h" />
<ClInclude Include="..\plib\ppreprocessor.h" />
<ClInclude Include="..\plib\pstate.h" />
<ClInclude Include="..\plib\pstonum.h" />
<ClInclude Include="..\plib\pstream.h" />
<ClInclude Include="..\plib\pstring.h" />
<ClInclude Include="..\plib\pstrutil.h" />
<ClInclude Include="..\plib\ptime.h" />
<ClInclude Include="..\plib\ptokenizer.h" />
<ClInclude Include="..\plib\ptypes.h" />
<ClInclude Include="..\plib\putil.h" />
<ClInclude Include="..\solver\mat_cr.h" />
<ClInclude Include="..\plib\vector_ops.h" />
<ClInclude Include="..\solver\nld_matrix_solver.h" />
<ClInclude Include="..\solver\nld_ms_direct.h" />
<ClInclude Include="..\solver\nld_ms_direct1.h" />

View File

@ -30,9 +30,6 @@
<ClCompile Include="..\plib\pfunction.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\plib\pstream.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\plib\pmain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -48,21 +45,9 @@
<ClCompile Include="..\plib\pexception.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\plib\pstate.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\plib\pparser.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\plib\putil.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\plib\palloc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\plib\pchrono.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\plib\pdynlib.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -252,6 +237,21 @@
<ClCompile Include="..\devices\nld_74164.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\plib\ppreprocessor.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\plib\ptokenizer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\devices\nld_7497.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\devices\nld_schmitt.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\analog\nld_mosfet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\nl_errstr.h">
@ -260,18 +260,12 @@
<ClInclude Include="..\nl_dice_compat.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\nl_time.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\nl_base.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\nl_parser.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\netlist_types.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\nl_factory.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -389,9 +383,6 @@
<ClInclude Include="..\solver\nld_ms_direct.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\solver\mat_cr.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\solver\nld_ms_direct_lu.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -578,5 +569,56 @@
<ClInclude Include="..\devices\nld_74164.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\plib\gmres.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\plib\mat_cr.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\plib\parray.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\plib\pmath.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\plib\pmatrix2d.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\plib\pmempool.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\plib\pomp.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\plib\ppreprocessor.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\plib\pstonum.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\plib\pstrutil.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\plib\ptime.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\plib\ptokenizer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\plib\vector_ops.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\devices\nld_7497.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\devices\nld_schmitt.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\analog\nld_generic_models.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\analog\nld_mosfet.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -22,32 +22,32 @@
<ProjectGuid>{9204EC28-A29B-4A36-9E47-2C46041D67D3}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>nltool</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@ -144,7 +144,10 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\prg\nltool.cpp" />
<ClCompile Include="..\prg\nltool.cpp">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\;$(SolutionDir)..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">/bigobj</AdditionalOptions>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="netlistlib.vcxproj">

View File

@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
/*
* nlbase.c
*
*/
#include "solver/nld_matrix_solver.h"
#include "solver/nld_solver.h"
@ -339,10 +335,9 @@ namespace netlist
dev.second->update_param();
// Step all devices once !
/*
* INFO: The order here affects power up of e.g. breakout. However, such
* variations are explicitly stated in the breakout manual.
*/
//
// INFO: The order here affects power up of e.g. breakout. However, such
// variations are explicitly stated in the breakout manual.
auto *netlist_params = get_single_device<devices::NETLIB_NAME(netlistparams)>("parameter");
@ -401,7 +396,7 @@ namespace netlist
}
#if 1
/* the above may screw up m_active and the list */
// the above may screw up m_active and the list
rebuild_lists();
#endif
}
@ -442,8 +437,8 @@ namespace netlist
const auto clang_workaround_unreachable_code = NL_USE_QUEUE_STATS;
if (clang_workaround_unreachable_code)
{
/* Only one serialization should be counted in total time */
/* But two are contained in m_stat_mainloop */
// Only one serialization should be counted in total time
// But two are contained in m_stat_mainloop
plib::pperftime_t<true> overhead;
plib::pperftime_t<true> test;
{
@ -602,9 +597,8 @@ namespace netlist
state().setup().register_link_fqn(name() + "." + t1, name() + "." + t2);
}
/* FIXME: this is only used by solver code since matrix solvers are started in
* post_start.
*/
// FIXME: this is only used by solver code since matrix solvers are started in
// post_start.
void device_t::connect_post_start(detail::core_terminal_t &t1, detail::core_terminal_t &t2)
{
if (!state().setup().connect(t1, t2))
@ -651,7 +645,7 @@ namespace netlist
void detail::net_t::rebuild_list()
{
/* rebuild m_list */
// rebuild m_list
m_list_active.clear();
for (auto & term : m_core_terms)
@ -676,7 +670,7 @@ namespace netlist
if (p != nullptr)
p->m_cur_Analog = nlconst::zero();
/* rebuild m_list and reset terminals to active or analog out state */
// rebuild m_list and reset terminals to active or analog out state
m_list_active.clear();
for (core_terminal_t *ct : m_core_terms)

View File

@ -4,6 +4,7 @@
#ifndef NLBASE_H_
#define NLBASE_H_
///
/// \file nl_base.h
///
@ -320,7 +321,6 @@ namespace netlist
/// ...
/// state_var<unsigned> m_var;
/// }
template <typename T>
struct state_var
{

View File

@ -209,4 +209,4 @@ namespace netlist
#endif
} // namespace netlist
#endif /* NLCONFIG_H_ */
#endif // NLCONFIG_H_

View File

@ -1,10 +1,9 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
/*!
*
* \file nl_errstr.h
*
*/
///
/// \file nl_errstr.h
///
#ifndef NL_ERRSTR_H_
#define NL_ERRSTR_H_
@ -151,4 +150,4 @@ namespace netlist
} // namespace netlist
#endif /* NL_ERRSTR_H_ */
#endif // NL_ERRSTR_H_

View File

@ -1,12 +1,9 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
/***************************************************************************
nl_factory.c
Discrete netlist implementation.
****************************************************************************/
//
// nl_factory.cpp
//
#include "nl_factory.h"
#include "nl_base.h"

View File

@ -1,10 +1,9 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
/*
* nl_factory.h
*
*
*/
///
/// \file nl_factory.h
///
#ifndef NLFACTORY_H_
#define NLFACTORY_H_
@ -68,10 +67,10 @@ namespace factory {
const pstring &sourcefile() const { return m_sourcefile; }
private:
pstring m_name; /* device name */
pstring m_classname; /* device class name */
pstring m_def_param; /* default parameter */
pstring m_sourcefile; /* source file */
pstring m_name; ///< device name
pstring m_classname; ///< device class name
pstring m_def_param; ///< default parameter
pstring m_sourcefile; ///< source file
};
template <class C>
@ -161,4 +160,4 @@ namespace factory {
} // namespace devices
} // namespace netlist
#endif /* NLFACTORY_H_ */
#endif // NLFACTORY_H_

View File

@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
/*
* nl_parser.c
*
*/
#include "nl_parser.h"
#include "nl_base.h"

View File

@ -1,9 +1,9 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
/*
* nl_parser.c
*
*/
///
/// \file nl_parser.c
///
#ifndef NL_PARSER_H_
#define NL_PARSER_H_
@ -42,9 +42,6 @@ namespace netlist
void net_local_source();
void net_truthtable_start(const pstring &nlname);
/* for debugging messages */
//netlist_state_t &netlist() { return m_setup.netlist(); }
void verror(const pstring &msg) override;
private:
@ -77,4 +74,4 @@ namespace netlist
} // namespace netlist
#endif /* NL_PARSER_H_ */
#endif // NL_PARSER_H_

View File

@ -1,9 +1,5 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
/*
* nlsetup.c
*
*/
#include "plib/palloc.h"
#include "analog/nld_twoterm.h"
@ -63,7 +59,7 @@ namespace netlist
}
else
{
/* make sure we parse macro library entries */
// make sure we parse macro library entries
f->macro_actions(*this, name);
pstring key = build_fqn(name);
if (device_exists(key))
@ -331,7 +327,7 @@ pstring setup_t::resolve_alias(const pstring &name) const
pstring temp = name;
pstring ret;
/* FIXME: Detect endless loop */
// FIXME: Detect endless loop
do {
ret = temp;
auto p = m_alias.find(ret);
@ -347,7 +343,7 @@ pstring setup_t::de_alias(const pstring &alias) const
pstring temp = alias;
pstring ret;
/* FIXME: Detect endless loop */
// FIXME: Detect endless loop
do {
ret = temp;
temp = "";
@ -406,10 +402,10 @@ detail::core_terminal_t *setup_t::find_terminal(const pstring &terminal_in, bool
{
const pstring &tname = resolve_alias(terminal_in);
auto ret = m_terminals.find(tname);
/* look for default */
// look for default
if (ret == m_terminals.end())
{
/* look for ".Q" std output */
// look for ".Q" std output
ret = m_terminals.find(tname + ".Q");
}
@ -430,10 +426,10 @@ detail::core_terminal_t *setup_t::find_terminal(const pstring &terminal_in,
{
const pstring &tname = resolve_alias(terminal_in);
auto ret = m_terminals.find(tname);
/* look for default */
// look for default
if (ret == m_terminals.end() && atype == detail::terminal_type::OUTPUT)
{
/* look for ".Q" std output */
// look for ".Q" std output
ret = m_terminals.find(tname + ".Q");
}
if (ret == m_terminals.end() && required)
@ -489,7 +485,7 @@ devices::nld_base_proxy *setup_t::get_d_a_proxy(detail::core_terminal_t &out)
auto new_proxy =
out_cast.logic_family()->create_d_a_proxy(m_nlstate, x, &out_cast);
m_proxy_cnt++;
/* connect all existing terminals to new net */
// connect all existing terminals to new net
for (auto & p : out.net().core_terms())
{
@ -534,7 +530,7 @@ devices::nld_base_proxy *setup_t::get_a_d_proxy(detail::core_terminal_t &inp)
auto ret = new_proxy.get();
/* connect all existing terminals to new net */
// connect all existing terminals to new net
if (inp.has_net())
{
@ -639,7 +635,7 @@ void setup_t::connect_terminal_output(terminal_t &in, detail::core_terminal_t &o
if (out.is_analog())
{
log().debug("connect_terminal_output: {1} {2}\n", in.name(), out.name());
/* no proxy needed, just merge existing terminal net */
// no proxy needed, just merge existing terminal net
if (in.has_net())
merge_nets(out.net(), in.net());
else
@ -794,10 +790,10 @@ void setup_t::resolve_inputs()
{
log().verbose("Resolving inputs ...");
/* Netlist can directly connect input to input.
* We therefore first park connecting inputs and retry
* after all other terminals were connected.
*/
// Netlist can directly connect input to input.
// We therefore first park connecting inputs and retry
// after all other terminals were connected.
unsigned tries = m_netlist_params->m_max_link_loops();
while (m_links.size() > 0 && tries > 0)
{
@ -1113,7 +1109,7 @@ void setup_t::prepare_to_run()
{
register_dynamic_log_devices();
/* make sure the solver and parameters are started first! */
// make sure the solver and parameters are started first!
for (auto & e : m_device_factory)
{
@ -1129,12 +1125,12 @@ void setup_t::prepare_to_run()
auto solver = m_nlstate.get_single_device<devices::NETLIB_NAME(solver)>("solver");
m_netlist_params = m_nlstate.get_single_device<devices::NETLIB_NAME(netlistparams)>("parameter");
/* set default model parameters */
// set default model parameters
m_models.register_model(plib::pfmt("NMOS_DEFAULT _(CAPMOD={1})")(m_netlist_params->m_mos_capmodel()));
m_models.register_model(plib::pfmt("PMOS_DEFAULT _(CAPMOD={1})")(m_netlist_params->m_mos_capmodel()));
/* create devices */
// create devices
log().debug("Creating devices ...\n");
for (auto & e : m_device_factory)
@ -1190,7 +1186,7 @@ void setup_t::prepare_to_run()
d.second->set_hint_deactivate(false);
}
/* resolve inputs */
// resolve inputs
resolve_inputs();
log().verbose("looking for two terms connected to rail nets ...");

View File

@ -38,7 +38,7 @@
#define DIPPINS(pin1, ...) \
setup.register_dippins_arr( # pin1 ", " # __VA_ARGS__);
/* to be used to reference new library truthtable devices */
// to be used to reference new library truthtable devices
#define NET_REGISTER_DEV(type, name) \
setup.register_dev(# type, # name);
@ -80,7 +80,6 @@ void NETLIST_NAME(name)(netlist::nlparse_t &setup) \
#define SUBMODEL(model, name) \
setup.namespace_push(# name); \
setup.include(# model); \
/*NETLIST_NAME(model)(setup);*/ \
setup.namespace_pop();
#define OPTIMIZE_FRONTIER(attach, r_in, r_out) \
@ -208,7 +207,7 @@ namespace netlist
{
public:
void register_model(const pstring &model_in);
/* model / family related */
// model / family related
pstring value_str(const pstring &model, const pstring &entity);
@ -265,7 +264,7 @@ namespace netlist
void register_lib_entry(const pstring &name, const pstring &sourcefile);
void register_frontier(const pstring &attach, const nl_fptype r_IN, const nl_fptype r_OUT);
/* register a source */
// register a source
void register_source(plib::unique_ptr<plib::psource_t> &&src)
{
m_sources.add_source(std::move(src));
@ -273,25 +272,25 @@ namespace netlist
void tt_factory_create(tt_desc &desc, const pstring &sourcefile);
/* handle namespace */
// handle namespace
void namespace_push(const pstring &aname);
void namespace_pop();
/* include other files */
// include other files
void include(const pstring &netlist_name);
pstring build_fqn(const pstring &obj_name) const;
void register_alias_nofqn(const pstring &alias, const pstring &out);
/* also called from devices for latebinding connected terminals */
// also called from devices for latebinding connected terminals
void register_link_fqn(const pstring &sin, const pstring &sout);
/* used from netlist.cpp (mame) */
// used from netlist.cpp (mame)
bool device_exists(const pstring &name) const;
/* FIXME: used by source_t - need a different approach at some time */
// FIXME: used by source_t - need a different approach at some time
bool parse_stream(plib::psource_t::stream_ptr &&istrm, const pstring &name);
void add_include(plib::unique_ptr<plib::psource_t> &&inc)
@ -312,13 +311,13 @@ namespace netlist
log_type &log() { return m_log; }
const log_type &log() const { return m_log; }
/* FIXME: sources may need access to the netlist parent type
* since they may be created in a context in which they don't
* have access to their environment.
* Example is the MAME memregion source.
* We thus need a better approach to creating netlists in a context
* other than static procedures.
*/
// FIXME: sources may need access to the netlist parent type
// since they may be created in a context in which they don't
// have access to their environment.
// Example is the MAME memregion source.
// We thus need a better approach to creating netlists in a context
// other than static procedures.
setup_t &setup() { return m_setup; }
const setup_t &setup() const { return m_setup; }
@ -336,7 +335,7 @@ namespace netlist
factory::list_t m_factory;
/* need to preserve order of device creation ... */
// need to preserve order of device creation ...
std::vector<std::pair<pstring, factory::element_t *>> m_device_factory;
@ -377,7 +376,7 @@ namespace netlist
param_t *find_param(const pstring &param_in, bool required = true) const;
/* get family */
// get family
const logic_family_desc_t *family_from_model(const pstring &model);
void register_dynamic_log_devices();
@ -388,38 +387,44 @@ namespace netlist
factory::list_t &factory() { return m_factory; }
const factory::list_t &factory() const { return m_factory; }
/* helper - also used by nltool */
// helper - also used by nltool
pstring resolve_alias(const pstring &name) const;
pstring de_alias(const pstring &alias) const;
/* needed by nltool */
// needed by nltool
std::vector<pstring> get_terminals_for_device_name(const pstring &devname) const;
log_type &log();
const log_type &log() const;
/* needed by proxy */
// needed by proxy
detail::core_terminal_t *find_terminal(const pstring &outname_in, const detail::terminal_type atype, bool required = true) const;
detail::core_terminal_t *find_terminal(const pstring &terminal_in, bool required = true) const;
/* core net handling */
// core net handling
void delete_empty_nets();
/* run preparation */
// run preparation
void prepare_to_run();
/* validation */
/* The extended validation mode is not intended for running.
* The intention is to identify power pins which are not properly
* connected. The downside is that this mode creates a netlist which
* is different (and not able to run).
*
* Extended validation is supported by nltool validate option.
*/
/// \brief set extended validation mode.
///
/// The extended validation mode is not intended for running.
/// The intention is to identify power pins which are not properly
/// connected. The downside is that this mode creates a netlist which
/// is different (and not able to run).
///
/// Extended validation is supported by nltool validate option.
///
/// \param val Boolean value enabling/disabling extended validation mode
void set_extended_validation(bool val) { m_validation = val; }
/// \brief State of extended validation mode.
///
/// \returns boolean value indicating if extended validation mode is
/// turned on.
bool is_extended_validation() const { return m_validation; }
private:
@ -525,4 +530,4 @@ namespace netlist
} // namespace netlist
#endif /* NLSETUP_H_ */
#endif // NLSETUP_H_

View File

@ -1,14 +1,13 @@
// license:GPL-2.0+
// copyright-holders:Couriersud
/*!
*
* \file nltypes.h
*
*/
/* \note never change the name to nl_types.h. This creates a conflict
* with nl_types.h file provided by libc++ (clang, macosx)
*/
///
/// \file nltypes.h
///
/// \note never change the name to nl_types.h. This creates a conflict
/// with nl_types.h file provided by libc++ (clang, macosx)
///
#ifndef NLTYPES_H_
#define NLTYPES_H_
@ -26,41 +25,36 @@
namespace netlist
{
/*! @brief plib::constants struct specialized for nl_fptype
*
*/
/// @brief plib::constants struct specialized for nl_fptype.
///
struct nlconst : public plib::constants<nl_fptype>
{
};
/*! @brief netlist_sig_t is the type used for logic signals.
*
* This may be any of bool, uint8_t, uint16_t, uin32_t and uint64_t.
* The choice has little to no impact on performance.
*/
/// @brief netlist_sig_t is the type used for logic signals.
///
/// This may be any of bool, uint8_t, uint16_t, uin32_t and uint64_t.
/// The choice has little to no impact on performance.
///
using netlist_sig_t = std::uint32_t;
/* FIXME: belongs into nl_base.h to nlstate */
/**
* @brief Interface definition for netlist callbacks into calling code
*
* A class inheriting from netlist_callbacks_t has to be passed to the netlist_t
* constructor. Netlist does processing during construction and thus needs
* the object passed completely constructed.
*
*/
/// @brief Interface definition for netlist callbacks into calling code
///
/// A class inheriting from netlist_callbacks_t has to be passed to the netlist_t
/// constructor. Netlist does processing during construction and thus needs
/// the object passed completely constructed.
///
class callbacks_t
{
public:
callbacks_t() = default;
/* what is done before this is passed as a unique_ptr to netlist
* we should not limit.
*/
virtual ~callbacks_t() = default;
COPYASSIGNMOVE(callbacks_t, default)
/* logging callback */
/// \brief logging callback.
///
virtual void vlog(const plib::plog_level &l, const pstring &ls) const noexcept = 0;
};
@ -71,11 +65,10 @@ namespace netlist
// Types needed by various includes
//============================================================
/*! The memory pool for netlist objects
*
* \note This is not the right location yet.
*
*/
/// \brief The memory pool for netlist objects
///
/// \note This is not the right location yet.
///
#if (NL_USE_MEMPOOL)
using nlmempool = plib::mempool;
@ -83,15 +76,14 @@ namespace netlist
using nlmempool = plib::aligned_arena;
#endif
/*! Owned pointer type for pooled allocations.
*
*/
/// \brief Owned pointer type for pooled allocations.
///
template <typename T>
using owned_pool_ptr = nlmempool::owned_pool_ptr<T>;
/*! Unique pointer type for pooled allocations.
*
*/
/// \brief Unique pointer type for pooled allocations.
///
template <typename T>
using unique_pool_ptr = nlmempool::unique_pool_ptr<T>;
@ -103,11 +95,12 @@ namespace netlist
namespace detail {
/*! Enum specifying the type of object */
/// \brief Enum specifying the type of object
///
enum class terminal_type {
TERMINAL = 0, /*!< object is an analog terminal */
INPUT = 1, /*!< object is an input */
OUTPUT = 2, /*!< object is an output */
TERMINAL = 0, ///< object is an analog terminal
INPUT = 1, ///< object is an input
OUTPUT = 2, ///< object is an output
};
} // namespace detail
@ -138,4 +131,4 @@ namespace plib {
}
} // namespace plib
#endif /* NLTYPES_H_ */
#endif // NLTYPES_H_