summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/nl_parser.h
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2020-05-11 18:56:10 +0200
committer couriersud <couriersud@gmx.org>2020-05-12 18:52:44 +0200
commitfaac9a2d2c8afb28ed1a7f816c6a30e7266f1319 (patch)
tree72b4c4e5ab10130c644c8f0ee61f3a7ba64870a3 /src/lib/netlist/nl_parser.h
parent015178aae41e6ddcf64e98749ce5b242e706f1ca (diff)
netlist: Extended functionality and code cleanup. [Couriersud]
- working macro level parameters - simplified code significantly - fixed a number of hidden issue - dead code removal It is now possible to define netlist level parameters using: static NETLIST_START(chip) DEFPARAM(parameter, 123) RES(R1, $(@.parameter)) .... NETLIST_END() NETLIST_START(main) chip(X1) PARAM(X1.parameter, 1000) ... NETLIST_END() This will pass on 1000 to R1 as a parameter. "@." will resolve to the current namespace. In this case it is X1, thus "X1.parameter. This is during parsing. During evalution, i.e. device creation, $(X1.parameter) is evaluated to 1000. This also means, that global parameters are possible and accessible ... DEFPARAM(P, 234) ... RES(R1, $(P)) or going forward RES(R1, 1000) CAP(C1, 1.0 / $(R1.R)) This opens up the path to more possibilities ... static NETLIST_START(DM9456_DIP) DEFPARAM(MODEL, "74XX") DM9456_GATE(X1) DM9456_GATE(X2) PARAM(X1.MODEL, $(@.MODEL)) PARAM(X2.MODEL, $(@.MODEL)) ... NETLIST_END() NETLIST_START(main) DM9456_DIP(X1) PARAM(X1.MODEL, "LS74XX") ... NETLIST_END() The code also has been prepared to allow something along the lines of LIBENTRY_MODEL(DM74LS00_DIP, DM7400_DIP, "LS74XX") to define a LS version on top of an DM7400_DIP bare TTL implementation. This however will need more efforts to existing devices to honour some timing adjustment in the model definition. It will already honour different output specifications between LS series and bare TTL if connected to analog components.
Diffstat (limited to 'src/lib/netlist/nl_parser.h')
-rw-r--r--src/lib/netlist/nl_parser.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/netlist/nl_parser.h b/src/lib/netlist/nl_parser.h
index 524f2cfeed8..4f7bc012d43 100644
--- a/src/lib/netlist/nl_parser.h
+++ b/src/lib/netlist/nl_parser.h
@@ -30,6 +30,7 @@ namespace netlist
void net_alias();
void dippins();
void netdev_param();
+ void netdev_defparam();
void netdev_hint();
void net_c();
void frontier();
@@ -52,6 +53,7 @@ namespace netlist
token_id_t m_tok_DIPPINS;
token_id_t m_tok_FRONTIER;
token_id_t m_tok_PARAM;
+ token_id_t m_tok_DEFPARAM;
token_id_t m_tok_HINT;
token_id_t m_tok_NET_MODEL;
token_id_t m_tok_NETLIST_START;