int main() { int i = 0; float t, input, IC, lower_sat_limit, upper_sat_limit, output; int hold, run, reset_on_init; printf("M = [...\n"); for (i = 0; i < 64; i++) { t = 0.3 * i; input = sigen(t); hold = 0; run = 1; reset_on_init = 1; IC = 0.0; lower_sat_limit = -2.0; upper_sat_limit = 2.0; output = reintichs(input, hold, run, IC, lower_sat_limit, upper_sat_limit, reset_on_init); //float Time, u1, u2, u3, u4, u5, u6, y1; //float time, input, run, ic, hold, ul, ll, out; printf("%5.2f, %6.2f, %02d, %4.2f, %02d, %4.2f, %4.2f, %5.4f; ...\n", t, input, run, IC, hold, upper_sat_limit, lower_sat_limit, output); } printf("];\n"); return 0; }
int tool_app_t::execute() { tool_app_t opts; /* make SIGFPE actually deliver signals on supoorted platforms */ plib::fpsignalenabler::global_enable(true); plib::fpsignalenabler sigen(plib::FP_ALL & ~plib::FP_INEXACT & ~plib::FP_UNDERFLOW); if (opt_help()) { pout(usage()); return 0; } if (opt_version()) { pout( "nltool (netlist) " PSTRINGIFY(NLTOOL_VERSION) "\n" "Copyright (C) 2019 Couriersud\n" "License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n\n" "Written by Couriersud.\n"); if (opt_verb()) { std::vector<std::pair<pstring, pstring>> defs; netlist::netlist_state_t::compile_defines(defs); pout("\nCompile defines:\n"); for (auto &x : defs) pout("{1:-30} = {2}\n", x.first, x.second); } return 0; } m_options = opt_defines(); m_options.emplace_back("NLTOOL_VERSION=" PSTRINGIFY(NLTOOL_VERSION)); try { pstring cmd = opt_cmd.as_string(); if (cmd == "listdevices") listdevices(); else if (cmd == "run") run(); else if (cmd == "validate") validate(); else if (cmd == "static") static_compile(); else if (cmd == "header") create_header(); else if (cmd == "docheader") create_docheader(); else if (cmd == "convert") convert(); else { perr("Unknown command {}\n", cmd.c_str()); //FIXME: usage_short perr(usage()); return 1; } } catch (netlist::nl_exception &e) { perr("Netlist exception caught: {}\n", e.text()); return 2; } catch (plib::pexception &e) { perr("plib exception caught: {}\n", e.text()); return 2; } return 0; }
int tool_app_t::execute() { tool_app_t opts; /* make SIGFPE actually deliver signals on supoorted platforms */ plib::fpsignalenabler::global_enable(true); plib::fpsignalenabler sigen(plib::FP_ALL & ~plib::FP_INEXACT & ~plib::FP_UNDERFLOW); //perr("{}", "WARNING: This is Work In Progress! - It may fail anytime\n"); //perr("Update dispatching using method {}\n", pmf_verbose[NL_PMF_TYPE]); //printf("test2 %f\n", std::exp(-14362.38064713)); if (opt_help()) { pout(usage()); return 0; } if (opt_version()) { pout( "nltool (netlist) 0.1\n" "Copyright (C) 2017 Couriersud\n" "License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n\n" "Written by Couriersud.\n"); return 0; } try { pstring cmd = opt_cmd(); if (cmd == "listdevices") listdevices(); else if (cmd == "run") run(); else if (cmd == "static") static_compile(); else if (cmd == "header") create_header(); else if (cmd == "docheader") create_docheader(); else if (cmd == "convert") { pstring contents; plib::postringstream ostrm; if (opt_file() == "-") { plib::pstdin f; ostrm.write(f); } else { plib::pifilestream f(opt_file()); ostrm.write(f); } contents = ostrm.str(); pstring result; if (opt_type().equals("spice")) { nl_convert_spice_t c; c.convert(contents); result = c.result(); } else if (opt_type().equals("eagle")) { nl_convert_eagle_t c; c.convert(contents); result = c.result(); } else if (opt_type().equals("rinf")) { nl_convert_rinf_t c; c.convert(contents); result = c.result(); } /* present result */ pout.write(result); } else { perr("Unknown command {}\n", cmd.c_str()); //FIXME: usage_short perr(usage()); return 1; } } catch (netlist::nl_exception &e) { perr("Netlist exception caught: {}\n", e.text()); } catch (plib::pexception &e) { perr("plib exception caught: {}\n", e.text()); } #if 0 #define str(x) # x #define strx(x) str(x) #define ttt strx(__cplusplus) printf("%s\n", ttt); #endif return 0; }