aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-09-11 06:22:06 +0200
committerTristan Gingold <tgingold@free.fr>2019-09-11 06:37:28 +0200
commit99344d16bac958ce9abbeaa78f5efd82c7ea612a (patch)
treec23623b9b5913b181d72575760f23ae5b09d02a1
parent02a18caa38f94acef649f02669ec06047ff00709 (diff)
downloadghdl-99344d16bac958ce9abbeaa78f5efd82c7ea612a.tar.gz
ghdl-99344d16bac958ce9abbeaa78f5efd82c7ea612a.tar.bz2
ghdl-99344d16bac958ce9abbeaa78f5efd82c7ea612a.zip
synth: add const_x gate.
-rw-r--r--src/synth/netlists-builders.adb18
-rw-r--r--src/synth/netlists-builders.ads3
-rw-r--r--src/synth/netlists-disp_vhdl.adb6
-rw-r--r--src/synth/netlists-gates.ads1
4 files changed, 27 insertions, 1 deletions
diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb
index 82c69f1e4..740a0d867 100644
--- a/src/synth/netlists-builders.adb
+++ b/src/synth/netlists-builders.adb
@@ -168,6 +168,13 @@ package body Netlists.Builders is
Set_Port_Desc (Res, Port_Desc_Array'(1 .. 0 => <>), Outputs);
Res := New_User_Module
+ (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("const_X")),
+ Id_Const_X, 0, 1, 0);
+ Ctxt.M_Const_X := Res;
+ Outputs := (0 => Create_Output ("o"));
+ Set_Port_Desc (Res, Port_Desc_Array'(1 .. 0 => <>), Outputs);
+
+ Res := New_User_Module
(Ctxt.Design, New_Sname_Artificial (Get_Identifier ("const_bit")),
Id_Const_Bit, 0, 1, 0);
Ctxt.M_Const_Bit := Res;
@@ -560,6 +567,17 @@ package body Netlists.Builders is
return O;
end Build_Compare;
+ function Build_Const_X (Ctxt : Context_Acc; W : Width) return Net
+ is
+ Inst : Instance;
+ O : Net;
+ begin
+ Inst := New_Internal_Instance (Ctxt, Ctxt.M_Const_X);
+ O := Get_Output (Inst, 0);
+ Set_Width (O, W);
+ return O;
+ end Build_Const_X;
+
function Build_Const_Z (Ctxt : Context_Acc; W : Width) return Net
is
pragma Assert (W > 0);
diff --git a/src/synth/netlists-builders.ads b/src/synth/netlists-builders.ads
index ac98e12a3..aeeaaa53d 100644
--- a/src/synth/netlists-builders.ads
+++ b/src/synth/netlists-builders.ads
@@ -49,6 +49,8 @@ package Netlists.Builders is
Id : Reduce_Module_Id;
Op : Net) return Net;
+ function Build_Const_X (Ctxt : Context_Acc;
+ W : Width) return Net;
function Build_Const_Z (Ctxt : Context_Acc;
W : Width) return Net;
@@ -165,6 +167,7 @@ private
M_Const_UB32 : Module;
M_Const_SB32 : Module;
M_Const_UL32 : Module;
+ M_Const_X : Module;
M_Const_Z : Module;
M_Const_Bit : Module;
M_Const_Log : Module;
diff --git a/src/synth/netlists-disp_vhdl.adb b/src/synth/netlists-disp_vhdl.adb
index 6685d71ae..ee9bf13f0 100644
--- a/src/synth/netlists-disp_vhdl.adb
+++ b/src/synth/netlists-disp_vhdl.adb
@@ -499,6 +499,9 @@ package body Netlists.Disp_Vhdl is
when Id_Const_Z =>
Disp_Template ("(\n0 downto 0 => 'Z')",
Inst, (0 => Get_Width (O) - 1));
+ when Id_Const_X =>
+ Disp_Template ("(\n0 downto 0 => 'X')",
+ Inst, (0 => Get_Width (O) - 1));
when Id_Const_Bit =>
Disp_Const_Bit (Inst);
when Id_Const_Log =>
@@ -605,7 +608,8 @@ package body Netlists.Disp_Vhdl is
end;
when Id_Const_UB32
| Id_Const_UL32
- | Id_Const_Z =>
+ | Id_Const_Z
+ | Id_Const_X =>
Disp_Template (" \o0 <= ", Inst);
Disp_Constant_Inline (Inst);
Put_Line (";");
diff --git a/src/synth/netlists-gates.ads b/src/synth/netlists-gates.ads
index 162ef0a6f..72b29266f 100644
--- a/src/synth/netlists-gates.ads
+++ b/src/synth/netlists-gates.ads
@@ -144,6 +144,7 @@ package Netlists.Gates is
Id_Const_UL32 : constant Module_Id := 70;
Id_Const_UB64 : constant Module_Id := 66;
Id_Const_UL64 : constant Module_Id := 67;
+ Id_Const_X : constant Module_Id := 71;
Id_Const_Z : constant Module_Id := 72;
Id_Const_0 : constant Module_Id := 73;