aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-07-04 18:22:49 +0200
committerTristan Gingold <tgingold@free.fr>2019-07-04 18:22:49 +0200
commit747a45a1a891b82d3701ac52e7d10a130455f3db (patch)
tree4f6eb5c29a498cddd545497bd055900ae391c272
parent3ba26e2631c3a8d5b668c25f4b9f043f0b0eaa0c (diff)
downloadghdl-747a45a1a891b82d3701ac52e7d10a130455f3db.tar.gz
ghdl-747a45a1a891b82d3701ac52e7d10a130455f3db.tar.bz2
ghdl-747a45a1a891b82d3701ac52e7d10a130455f3db.zip
ghdlsynth.h: follow convention, add comments.
-rw-r--r--src/synth/ghdlsynth.h29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/synth/ghdlsynth.h b/src/synth/ghdlsynth.h
index f2a7f095c..21173efb8 100644
--- a/src/synth/ghdlsynth.h
+++ b/src/synth/ghdlsynth.h
@@ -19,8 +19,9 @@
namespace GhdlSynth {
// Use struct wrappers for type safety.
+ // Convention: W for wrapped, D for direct, B for boolean.
#define GHDLSYNTH_ADA_PREFIX(N) netlists__##N
-#define GHDLSYNTH_ADA_WRAPPER_WD(NAME, RESTYPE, ARGTYPE) \
+#define GHDLSYNTH_ADA_WRAPPER_WW(NAME, RESTYPE, ARGTYPE) \
extern "C" unsigned int GHDLSYNTH_ADA_PREFIX(NAME) (unsigned int); \
inline RESTYPE NAME(ARGTYPE arg) { \
RESTYPE res; \
@@ -67,8 +68,8 @@ namespace GhdlSynth {
GHDLSYNTH_ADA_WRAPPER_DW(get_sname_kind, Sname_Kind, Sname);
inline bool is_valid(Sname l) { return l.id != 0; }
- GHDLSYNTH_ADA_WRAPPER_WD(get_sname_prefix, Sname, Sname);
- GHDLSYNTH_ADA_WRAPPER_WD(get_sname_suffix, Name_Id, Sname);
+ GHDLSYNTH_ADA_WRAPPER_WW(get_sname_prefix, Sname, Sname);
+ GHDLSYNTH_ADA_WRAPPER_WW(get_sname_suffix, Name_Id, Sname);
GHDLSYNTH_ADA_WRAPPER_DW(get_sname_version, unsigned int, Sname);
@@ -80,9 +81,9 @@ namespace GhdlSynth {
struct Module { unsigned int id; };
inline bool is_valid(Module m) { return m.id != 0; }
- GHDLSYNTH_ADA_WRAPPER_WD(get_module_name, Sname, Module);
- GHDLSYNTH_ADA_WRAPPER_WD(get_first_sub_module, Module, Module);
- GHDLSYNTH_ADA_WRAPPER_WD(get_next_sub_module, Module, Module);
+ GHDLSYNTH_ADA_WRAPPER_WW(get_module_name, Sname, Module);
+ GHDLSYNTH_ADA_WRAPPER_WW(get_first_sub_module, Module, Module);
+ GHDLSYNTH_ADA_WRAPPER_WW(get_next_sub_module, Module, Module);
GHDLSYNTH_ADA_WRAPPER_DW(get_id, Module_Id, Module);
GHDLSYNTH_ADA_WRAPPER_DW(get_nbr_outputs, unsigned int, Module);
GHDLSYNTH_ADA_WRAPPER_DW(get_nbr_inputs, unsigned int, Module);
@@ -92,18 +93,18 @@ namespace GhdlSynth {
struct Instance { unsigned int id; };
inline bool is_valid(Instance inst) { return inst.id != 0; }
- GHDLSYNTH_ADA_WRAPPER_WD(get_self_instance, Instance, Module);
- GHDLSYNTH_ADA_WRAPPER_WD(get_first_instance, Instance, Module);
- GHDLSYNTH_ADA_WRAPPER_WD(get_next_instance, Instance, Instance);
- GHDLSYNTH_ADA_WRAPPER_WD(get_instance_name, Sname, Instance);
- GHDLSYNTH_ADA_WRAPPER_WD(get_module, Module, Instance);
- GHDLSYNTH_ADA_WRAPPER_WD(get_net_parent, Instance, Net);
+ GHDLSYNTH_ADA_WRAPPER_WW(get_self_instance, Instance, Module);
+ GHDLSYNTH_ADA_WRAPPER_WW(get_first_instance, Instance, Module);
+ GHDLSYNTH_ADA_WRAPPER_WW(get_next_instance, Instance, Instance);
+ GHDLSYNTH_ADA_WRAPPER_WW(get_instance_name, Sname, Instance);
+ GHDLSYNTH_ADA_WRAPPER_WW(get_module, Module, Instance);
+ GHDLSYNTH_ADA_WRAPPER_WW(get_net_parent, Instance, Net);
GHDLSYNTH_ADA_WRAPPER_DWD(get_param_uns32, unsigned int, Instance, Port_Idx);
struct Input { unsigned int id; };
GHDLSYNTH_ADA_WRAPPER_WWD(get_input, Input, Instance, Port_Idx);
GHDLSYNTH_ADA_WRAPPER_WWD(get_output, Net, Instance, Port_Idx);
- GHDLSYNTH_ADA_WRAPPER_WD(get_driver, Net, Input);
+ GHDLSYNTH_ADA_WRAPPER_WW(get_driver, Net, Input);
// Utils
#undef GHDLSYNTH_ADA_PREFIX
@@ -113,6 +114,8 @@ namespace GhdlSynth {
GHDLSYNTH_ADA_WRAPPER_WWD(get_output_name, Sname, Module, Port_Idx);
GHDLSYNTH_ADA_WRAPPER_BW(has_one_connection, Net);
+ GHDLSYNTH_ADA_WRAPPER_WWD(get_input_net, Net, Instance, Port_Idx);
+
extern "C" unsigned int libghdlsynth__synth(int argc, const char **argv);
inline Module ghdl_synth(int argc, const char **argv) {
Module res;