aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-11-08 19:28:35 +0100
committerTristan Gingold <tgingold@free.fr>2019-11-11 20:24:52 +0100
commit539dfe3acefd1c4042779c8bb47e1b851ebaa3c6 (patch)
tree90b3f985cb4f615167ffd38bf70408d5f3b16179 /src
parent507e691dd68da7f8e2aa093b4caa565c044cdead (diff)
downloadghdl-539dfe3acefd1c4042779c8bb47e1b851ebaa3c6.tar.gz
ghdl-539dfe3acefd1c4042779c8bb47e1b851ebaa3c6.tar.bz2
ghdl-539dfe3acefd1c4042779c8bb47e1b851ebaa3c6.zip
netlists: add 2 flags per instance, including a mark flag.
Diffstat (limited to 'src')
-rw-r--r--src/synth/netlists.adb18
-rw-r--r--src/synth/netlists.ads21
2 files changed, 33 insertions, 6 deletions
diff --git a/src/synth/netlists.adb b/src/synth/netlists.adb
index 91bbd94e3..5ff0dfec6 100644
--- a/src/synth/netlists.adb
+++ b/src/synth/netlists.adb
@@ -405,6 +405,8 @@ package body Netlists is
Next_Instance => No_Instance,
Prev_Instance => No_Instance,
Klass => M,
+ Flag_Mark => False,
+ Flag2 => False,
Name => Name,
First_Param => Params,
First_Input => Inputs,
@@ -757,6 +759,20 @@ package body Netlists is
end case;
end Get_Param_Desc;
+ function Get_Mark_Flag (Inst : Instance) return Boolean
+ is
+ pragma Assert (Is_Valid (Inst));
+ begin
+ return Instances_Table.Table (Inst).Flag_Mark;
+ end Get_Mark_Flag;
+
+ procedure Set_Mark_Flag (Inst : Instance; Flag : Boolean)
+ is
+ pragma Assert (Is_Valid (Inst));
+ begin
+ Instances_Table.Table (Inst).Flag_Mark := Flag;
+ end Set_Mark_Flag;
+
function Get_Param_Idx (Inst : Instance; Param : Param_Idx) return Param_Idx
is
pragma Assert (Is_Valid (Inst));
@@ -906,6 +922,8 @@ begin
Next_Instance => No_Instance,
Prev_Instance => No_Instance,
Klass => No_Module,
+ Flag_Mark => False,
+ Flag2 => False,
Name => No_Sname,
First_Param => No_Param_Idx,
First_Input => No_Input,
diff --git a/src/synth/netlists.ads b/src/synth/netlists.ads
index b1f562a3a..80140c92c 100644
--- a/src/synth/netlists.ads
+++ b/src/synth/netlists.ads
@@ -256,6 +256,11 @@ package Netlists is
function Get_Param_Uns32 (Inst : Instance; Param : Param_Idx) return Uns32;
procedure Set_Param_Uns32 (Inst : Instance; Param : Param_Idx; Val : Uns32);
+ -- Each instance has a mark flag available for any algorithm.
+ -- Please leave this flag clean for the next user.
+ function Get_Mark_Flag (Inst : Instance) return Boolean;
+ procedure Set_Mark_Flag (Inst : Instance; Flag : Boolean);
+
-- Input
function Get_Input_Parent (I : Input) return Instance;
function Get_Port_Idx (I : Input) return Port_Idx;
@@ -306,6 +311,12 @@ private
type Param_Desc_Idx is new Uns32;
No_Param_Desc_Idx : constant Param_Desc_Idx := 0;
+ type Input is new Uns32;
+ No_Input : constant Input := 0;
+
+ type Net is new Uns32;
+ No_Net : constant Net := 0;
+
type Module_Record is record
Parent : Module;
Name : Sname;
@@ -350,11 +361,15 @@ private
-- For a self-instance, Klass is equal to Parent, and Name is No_Sname.
Klass : Module;
Name : Sname;
+ Flag_Mark : Boolean;
+ Flag2 : Boolean;
First_Param : Param_Idx;
First_Input : Input;
First_Output : Net;
end record;
+ pragma Pack (Instance_Record);
+ for Instance_Record'Size use 8*32;
procedure Set_Next_Instance (Inst : Instance; Next : Instance);
procedure Set_Prev_Instance (Inst : Instance; Prev : Instance);
@@ -375,18 +390,12 @@ private
-- Remove and free the unconnected instance INST.
procedure Remove_Instance (Inst : Instance);
- type Input is new Uns32;
- No_Input : constant Input := 0;
-
type Input_Record is record
Parent : Instance;
Driver : Net;
Next_Sink : Input;
end record;
- type Net is new Uns32;
- No_Net : constant Net := 0;
-
function Is_Valid (N : Net) return Boolean;
type Net_Record is record