diff options
author | 2015-05-27 23:15:23 +0200 | |
---|---|---|
committer | 2015-05-27 23:18:45 +0200 | |
commit | 1d99211b55ffe6f8c9bf916f6e875287cba90dcd (patch) | |
tree | 20d0857e685ebc56716f7e1d33a6fab1d5fcaf40 /nl_examples | |
parent | cef370aa13953c3bcfa185c818c76812c34f13fc (diff) |
Introduced user definable truth tables:
NETLIST_START(lib)
TRUTHTABLE_START(TTL_7400A_NAND, 2, 1, 0, "+A,B")
TT_HEAD(" A , B | Q ")
TT_LINE(" 0 , X | 1 |22")
TT_LINE(" X , 0 | 1 |22")
TT_LINE(" 1 , 1 | 0 |15")
TRUTHTABLE_END()
NETLIST_END()
This enables the addition of devices without changing the netlist
source code and allows the creation of libraries. Used pong.c as a
proof of concept for the time being. [Couriersud]
Diffstat (limited to 'nl_examples')
-rw-r--r-- | nl_examples/todo.c | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/nl_examples/todo.c b/nl_examples/todo.c index 9d7765ea925..1c9815864ed 100644 --- a/nl_examples/todo.c +++ b/nl_examples/todo.c @@ -5,23 +5,6 @@ #include "netlist/devices/net_lib.h" -struct ttd -{ - nl_util::pstring_list a; -}; - -ttd * nl_register_tt(pstring name, int in, int out); - - -#define NETLIST_TT(_name, _in, _out) \ - { \ - ttd *a = setup.register_tt(# _name, _in, _out); \ - -#define TT_LINE(_x) \ - a->a.add(_x); - -#define TT_END() } - NETLIST_START(7400_TTL) NET_REGISTER_DEV(7400, s1) NET_REGISTER_DEV(7400, s2) @@ -47,12 +30,12 @@ NETLIST_START(7400_TTL) NETLIST_END() NETLIST_START(lib) - NETLIST_TT(7400, 2, 1) - TT_LINE("A,B | Q ") - TT_LINE("0,X|1|22") - TT_LINE("X,0|1|22") - TT_LINE("1,1|0|15") - TT_END() + TRUTHTABLE_START(7400A, 2, 1, 0, "+A,B") + TT_HEAD(" A , B | Q ") + TT_LINE(" 0 , X | 1 |22") + TT_LINE(" X , 0 | 1 |22") + TT_LINE(" 1 , 1 | 0 |15") + TRUTHTABLE_END() NETLIST_END() |