aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/synth/ghdlsynth.h8
-rw-r--r--src/synth/netlists-utils.adb5
-rw-r--r--src/synth/netlists-utils.ads5
3 files changed, 18 insertions, 0 deletions
diff --git a/src/synth/ghdlsynth.h b/src/synth/ghdlsynth.h
index 0537ceaf7..12ce17d54 100644
--- a/src/synth/ghdlsynth.h
+++ b/src/synth/ghdlsynth.h
@@ -55,6 +55,12 @@ namespace GhdlSynth {
return (GHDLSYNTH_ADA_PREFIX(NAME) (arg.id) & 1); \
}
+#define GHDLSYNTH_ADA_WRAPPER_BWD(NAME, ARGTYPE1, ARGTYPE2) \
+ extern "C" unsigned int GHDLSYNTH_ADA_PREFIX(NAME) (unsigned, unsigned); \
+ inline bool NAME(ARGTYPE1 arg1, ARGTYPE2 arg2) { \
+ return (GHDLSYNTH_ADA_PREFIX(NAME) (arg1.id, arg2) & 1); \
+ }
+
struct Name_Id { unsigned int id; };
extern "C" const char *name_table__get_address (unsigned int);
inline const char *get_cstr(Name_Id n) {
@@ -118,10 +124,12 @@ namespace GhdlSynth {
GHDLSYNTH_ADA_WRAPPER_WWD(get_output_name, Sname, Module, Port_Idx);
GHDLSYNTH_ADA_WRAPPER_DWD(get_input_width, Width, Module, Port_Idx);
GHDLSYNTH_ADA_WRAPPER_DWD(get_output_width, Width, Module, Port_Idx);
+ GHDLSYNTH_ADA_WRAPPER_BWD(get_inout_flag, 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 ghdlsynth__ghdl_synth(int init,
int argc, const char **argv);
inline Module ghdl_synth(int init, int argc, const char **argv) {
diff --git a/src/synth/netlists-utils.adb b/src/synth/netlists-utils.adb
index f1dd42f73..a0d69d0cf 100644
--- a/src/synth/netlists-utils.adb
+++ b/src/synth/netlists-utils.adb
@@ -98,6 +98,11 @@ package body Netlists.Utils is
return Get_Output_Desc (M, I).W;
end Get_Output_Width;
+ function Get_Inout_Flag (M : Module; I : Port_Idx) return Boolean is
+ begin
+ return Get_Output_Desc (M, I).Is_Inout;
+ end Get_Inout_Flag;
+
function Get_Input_Net (Inst : Instance; Idx : Port_Idx) return Net is
begin
return Get_Driver (Get_Input (Inst, Idx));
diff --git a/src/synth/netlists-utils.ads b/src/synth/netlists-utils.ads
index f7edc80c7..8f2898dfd 100644
--- a/src/synth/netlists-utils.ads
+++ b/src/synth/netlists-utils.ads
@@ -40,12 +40,17 @@ package Netlists.Utils is
function Get_Id (Inst : Instance) return Module_Id;
+ -- For the yosys plugin: name of a port
function Get_Input_Name (M : Module; I : Port_Idx) return Sname;
function Get_Output_Name (M : Module; I : Port_Idx) return Sname;
+ -- For the yosys plugin: width of a port
function Get_Input_Width (M : Module; I : Port_Idx) return Width;
function Get_Output_Width (M : Module; I : Port_Idx) return Width;
+ -- For the yosys plugin: true if an output is also an input.
+ function Get_Inout_Flag (M : Module; I : Port_Idx) return Boolean;
+
-- Return the net (driver) connected to input IDX of INSTANCE.
function Get_Input_Net (Inst : Instance; Idx : Port_Idx) return Net;