diff options
author | 2019-04-06 14:11:06 +0200 | |
---|---|---|
committer | 2019-04-07 19:09:48 +0200 | |
commit | 58e6383ada73e3d9bb2330248c77d99f4063896d (patch) | |
tree | 69ea6066ac01e90cffba02ebf7e3775dfeaaaf87 /src/lib/netlist/plib/pfunction.cpp | |
parent | 140dc2237eed85e3451ab95a4bcdae84ee8600c5 (diff) |
netlist: MB3614 again, function controlled VARCLOCK and other
improvements.
- fix MB3614 parameter
- Added VARCLOCK which derives step size from function
- optimized function handling in CS and VS
- fixed a bug in ppreprocessor
- add trunc to pfunction
- added opamp_amplification_curve to derive characteristic
amplification curve
Diffstat (limited to 'src/lib/netlist/plib/pfunction.cpp')
-rw-r--r-- | src/lib/netlist/plib/pfunction.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/netlist/plib/pfunction.cpp b/src/lib/netlist/plib/pfunction.cpp index 6a2179e0e6f..6b15d7f8229 100644 --- a/src/lib/netlist/plib/pfunction.cpp +++ b/src/lib/netlist/plib/pfunction.cpp @@ -52,6 +52,8 @@ void pfunction::compile_postfix(const std::vector<pstring> &inputs, { rc.m_cmd = SIN; stk -= 0; } else if (cmd == "cos") { rc.m_cmd = COS; stk -= 0; } + else if (cmd == "trunc") + { rc.m_cmd = TRUNC; stk -= 0; } else if (cmd == "rand") { rc.m_cmd = RAND; stk += 1; } else @@ -72,16 +74,16 @@ void pfunction::compile_postfix(const std::vector<pstring> &inputs, bool err; rc.m_param = plib::pstonum_ne<decltype(rc.m_param)>(cmd, err); if (err) - throw plib::pexception(plib::pfmt("nld_function: unknown/misformatted token <{1}> in <{2}>")(cmd)(expr)); + throw plib::pexception(plib::pfmt("pfunction: unknown/misformatted token <{1}> in <{2}>")(cmd)(expr)); stk += 1; } } if (stk < 1) - throw plib::pexception(plib::pfmt("nld_function: stack underflow on token <{1}> in <{2}>")(cmd)(expr)); + throw plib::pexception(plib::pfmt("pfunction: stack underflow on token <{1}> in <{2}>")(cmd)(expr)); m_precompiled.push_back(rc); } if (stk != 1) - throw plib::pexception(plib::pfmt("nld_function: stack count different to one on <{2}>")(expr)); + throw plib::pexception(plib::pfmt("pfunction: stack count different to one on <{2}>")(expr)); } static int get_prio(const pstring &v) @@ -103,7 +105,7 @@ static int get_prio(const pstring &v) static pstring pop_check(std::stack<pstring> &stk, const pstring &expr) { if (stk.size() == 0) - throw plib::pexception(plib::pfmt("nld_function: stack underflow during infix parsing of: <{1}>")(expr)); + throw plib::pexception(plib::pfmt("pfunction: stack underflow during infix parsing of: <{1}>")(expr)); pstring res = stk.top(); stk.pop(); return res; @@ -201,6 +203,7 @@ double pfunction::evaluate(const std::vector<double> &values) OP(POW, 1, std::pow(ST2, ST1)) OP(SIN, 0, std::sin(ST2)) OP(COS, 0, std::cos(ST2)) + OP(TRUNC, 0, std::trunc(ST2)) case RAND: stack[ptr++] = lfsr_random(); break; |