aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/netlists-builders.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-03-23 06:48:46 +0100
committerTristan Gingold <tgingold@free.fr>2020-03-23 06:48:46 +0100
commite1e293701bb457af7bffc2e18a890cf552599144 (patch)
tree7a0776b854dcac395b522da787441a95fe554534 /src/synth/netlists-builders.adb
parent0cd37c83c170b5292b5ec9800013da6b4f63c1c1 (diff)
downloadghdl-e1e293701bb457af7bffc2e18a890cf552599144.tar.gz
ghdl-e1e293701bb457af7bffc2e18a890cf552599144.tar.bz2
ghdl-e1e293701bb457af7bffc2e18a890cf552599144.zip
synth: add id_inout gate to handle inout behaviour. Fir #1166
Diffstat (limited to 'src/synth/netlists-builders.adb')
-rw-r--r--src/synth/netlists-builders.adb21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb
index 9280d619c..98647c193 100644
--- a/src/synth/netlists-builders.adb
+++ b/src/synth/netlists-builders.adb
@@ -420,6 +420,7 @@ package body Netlists.Builders is
is
Outputs : Port_Desc_Array (0 .. 0);
Inputs2 : Port_Desc_Array (0 .. 1);
+ Outputs2 : Port_Desc_Array (0 .. 1);
begin
Inputs2 := (0 => Create_Input ("i"),
1 => Create_Input ("init"));
@@ -456,6 +457,13 @@ package body Netlists.Builders is
(Ctxt.Design, New_Sname_Artificial (Get_Identifier ("nop"), No_Sname),
Id_Nop, 1, 1, 0);
Set_Ports_Desc (Ctxt.M_Nop, Inputs2 (0 .. 0), Outputs);
+
+ Ctxt.M_Inout := New_User_Module
+ (Ctxt.Design, New_Sname_Artificial (Name_Inout, No_Sname),
+ Id_Inout, 1, 2, 0);
+ Outputs2 := (0 => Outputs (0),
+ 1 => Create_Output ("oport"));
+ Set_Ports_Desc (Ctxt.M_Inout, Inputs2 (0 .. 0), Outputs2);
end Create_Objects_Module;
procedure Create_Dff_Modules (Ctxt : Context_Acc)
@@ -1254,6 +1262,19 @@ package body Netlists.Builders is
return Build_Object (Ctxt, Ctxt.M_Output, W);
end Build_Output;
+ function Build_Inout (Ctxt : Context_Acc; W : Width) return Instance
+ is
+ Inst : Instance;
+ O : Net;
+ begin
+ Inst := New_Internal_Instance (Ctxt, Ctxt.M_Inout);
+ O := Get_Output (Inst, 0);
+ Set_Width (O, W);
+ O := Get_Output (Inst, 1);
+ Set_Width (O, W);
+ return Inst;
+ end Build_Inout;
+
function Build_Ioutput (Ctxt : Context_Acc; Init : Net) return Net
is
Wd : constant Width := Get_Width (Init);