diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-07-04 18:21:21 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-07-04 18:21:21 +0200 |
commit | 7dbd4e08569c9a7284ccbd67a8189a6cfdcc4cc9 (patch) | |
tree | e4856841e0f3e2d3d258ecd940fddf3d051c0a1c | |
parent | 7b3d3e5871bd7b3bb304d3ed63e16ac7143b0128 (diff) | |
download | ghdl-7dbd4e08569c9a7284ccbd67a8189a6cfdcc4cc9.tar.gz ghdl-7dbd4e08569c9a7284ccbd67a8189a6cfdcc4cc9.tar.bz2 ghdl-7dbd4e08569c9a7284ccbd67a8189a6cfdcc4cc9.zip |
netlists: allow to build idff without a connected D.
-rw-r--r-- | src/synth/netlists-builders.adb | 8 | ||||
-rw-r--r-- | src/synth/netlists-builders.ads | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb index ebf9964e8..6836a8d71 100644 --- a/src/synth/netlists-builders.adb +++ b/src/synth/netlists-builders.adb @@ -780,9 +780,9 @@ package body Netlists.Builders is D : Net; Init : Net) return Net is - Wd : constant Width := Get_Width (D); + Wd : constant Width := Get_Width (Init); pragma Assert (Wd /= No_Width); - pragma Assert (Get_Width (Init) = Wd); + pragma Assert (D = No_Net or else Get_Width (D) = Wd); pragma Assert (Get_Width (Clk) = 1); Inst : Instance; O : Net; @@ -791,7 +791,9 @@ package body Netlists.Builders is O := Get_Output (Inst, 0); Set_Width (O, Wd); Connect (Get_Input (Inst, 0), Clk); - Connect (Get_Input (Inst, 1), D); + if D /= No_Net then + Connect (Get_Input (Inst, 1), D); + end if; Connect (Get_Input (Inst, 2), Init); return O; end Build_Idff; diff --git a/src/synth/netlists-builders.ads b/src/synth/netlists-builders.ads index 4c444bf05..e34baa8ad 100644 --- a/src/synth/netlists-builders.ads +++ b/src/synth/netlists-builders.ads @@ -101,6 +101,7 @@ package Netlists.Builders is Clk : Net; D : Net) return Net; -- A flip-flop with an initial value (only for fpga) + -- The width is derived from INIT and D can be No_Net. function Build_Idff (Ctxt : Context_Acc; Clk : Net; D : Net; |