aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPepijn de Vos <pepijndevos@gmail.com>2019-07-21 12:11:35 +0200
committertgingold <tgingold@users.noreply.github.com>2019-07-21 12:11:35 +0200
commit44a19c532ebbfeb212d6e60ceb280526eb88f078 (patch)
tree545b69817428e9049883f4e3735a900d7997e9f2
parente5f5c65f8471071ca52462d81d0cadc2d5c16950 (diff)
downloadghdl-44a19c532ebbfeb212d6e60ceb280526eb88f078.tar.gz
ghdl-44a19c532ebbfeb212d6e60ceb280526eb88f078.tar.bz2
ghdl-44a19c532ebbfeb212d6e60ceb280526eb88f078.zip
add port width utility function for yosys (#876)
-rw-r--r--src/synth/ghdlsynth.h2
-rw-r--r--src/synth/ghdlsynth_gates.h3
-rw-r--r--src/synth/netlists-utils.adb10
-rw-r--r--src/synth/netlists-utils.ads3
4 files changed, 18 insertions, 0 deletions
diff --git a/src/synth/ghdlsynth.h b/src/synth/ghdlsynth.h
index 21173efb8..35d123f32 100644
--- a/src/synth/ghdlsynth.h
+++ b/src/synth/ghdlsynth.h
@@ -112,6 +112,8 @@ namespace GhdlSynth {
GHDLSYNTH_ADA_WRAPPER_DW(get_id, Module_Id, Instance);
GHDLSYNTH_ADA_WRAPPER_WWD(get_input_name, Sname, Module, Port_Idx);
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_BW(has_one_connection, Net);
GHDLSYNTH_ADA_WRAPPER_WWD(get_input_net, Net, Instance, Port_Idx);
diff --git a/src/synth/ghdlsynth_gates.h b/src/synth/ghdlsynth_gates.h
index ed5fd5a48..6a70550e4 100644
--- a/src/synth/ghdlsynth_gates.h
+++ b/src/synth/ghdlsynth_gates.h
@@ -64,4 +64,7 @@ enum Module_Id {
Id_Const_SB128 = 69,
Id_Const_UL32 = 70,
Id_Const_SL32 = 71,
+ Id_Const_Z = 72,
+ Id_Const_0 = 73,
+ Id_Concatn = 80,
};
diff --git a/src/synth/netlists-utils.adb b/src/synth/netlists-utils.adb
index f04fafb2d..43546e02a 100644
--- a/src/synth/netlists-utils.adb
+++ b/src/synth/netlists-utils.adb
@@ -76,6 +76,16 @@ package body Netlists.Utils is
return Get_Output_Desc (M, I).Name;
end Get_Output_Name;
+ function Get_Input_Width (M : Module; I : Port_Idx) return Width is
+ begin
+ return Get_Input_Desc (M, I).W;
+ end Get_Input_Width;
+
+ function Get_Output_Width (M : Module; I : Port_Idx) return Width is
+ begin
+ return Get_Output_Desc (M, I).W;
+ end Get_Output_Width;
+
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 4a017ec3c..bd8bd3e1c 100644
--- a/src/synth/netlists-utils.ads
+++ b/src/synth/netlists-utils.ads
@@ -31,6 +31,9 @@ package Netlists.Utils is
function Get_Input_Name (M : Module; I : Port_Idx) return Sname;
function Get_Output_Name (M : Module; I : Port_Idx) return Sname;
+ function Get_Input_Width (M : Module; I : Port_Idx) return Width;
+ function Get_Output_Width (M : Module; I : Port_Idx) return Width;
+
function Get_Input_Net (Inst : Instance; Idx : Port_Idx) return Net;
-- Return True iff ID describe a constant.