diff options
Diffstat (limited to 'src/synth')
-rw-r--r-- | src/synth/netlists.adb | 47 | ||||
-rw-r--r-- | src/synth/netlists.ads | 22 |
2 files changed, 62 insertions, 7 deletions
diff --git a/src/synth/netlists.adb b/src/synth/netlists.adb index 168289b38..717a595f3 100644 --- a/src/synth/netlists.adb +++ b/src/synth/netlists.adb @@ -25,6 +25,7 @@ with Simple_IO; with Netlists.Utils; use Netlists.Utils; with Netlists.Gates; +with Dyn_Interning; package body Netlists is @@ -131,7 +132,8 @@ package body Netlists is Last_Sub_Module => No_Module, Next_Sub_Module => No_Module, First_Instance => No_Instance, - Last_Instance => No_Instance)); + Last_Instance => No_Instance, + Attrs => null)); Res := Modules_Table.Last; Self := Create_Self_Instance (Res); pragma Unreferenced (Self); @@ -176,7 +178,8 @@ package body Netlists is Last_Sub_Module => No_Module, Next_Sub_Module => No_Module, First_Instance => No_Instance, - Last_Instance => No_Instance)); + Last_Instance => No_Instance, + Attrs => null)); Res := Modules_Table.Last; -- Append @@ -1171,6 +1174,40 @@ package body Netlists is end if; end Write_Pval; + -- Attributes + + type Attribute_Record is record + Inst : Instance; + First : Attribute; + end record; + + function Attribute_Hash (Params : Instance) return Hash_Value_Type is + begin + return Hash_Value_Type (Params); + end Attribute_Hash; + + function Attribute_Build (Params : Instance) return Attribute_Record is + begin + return Attribute_Record'(Inst => Params, + First => No_Attribute); + end Attribute_Build; + + function Attribute_Equal (Obj : Attribute_Record; Params : Instance) + return Boolean is + begin + return Obj.Inst = Params; + end Attribute_Equal; + + package Attribute_Tables is new Dyn_Interning + (Params_Type => Instance, + Object_Type => Attribute_Record, + Hash => Attribute_Hash, + Build => Attribute_Build, + Equal => Attribute_Equal); + + type Attribute_Tables_Instance is new Attribute_Tables.Instance; + -- Statistics + function Count_Free_Inputs (Head : Input) return Natural is Unused : Natural; @@ -1306,7 +1343,8 @@ begin Last_Sub_Module => No_Module, Next_Sub_Module => No_Module, First_Instance => No_Instance, - Last_Instance => No_Instance)); + Last_Instance => No_Instance, + Attrs => null)); pragma Assert (Modules_Table.Last = No_Module); Modules_Table.Append ((Parent => No_Module, @@ -1322,7 +1360,8 @@ begin Last_Sub_Module => No_Module, Next_Sub_Module => No_Module, First_Instance => No_Instance, - Last_Instance => No_Instance)); + Last_Instance => No_Instance, + Attrs => null)); pragma Assert (Modules_Table.Last = Free_Module); Instances_Table.Append ((Parent => No_Module, diff --git a/src/synth/netlists.ads b/src/synth/netlists.ads index e5560ba0a..37cd2279b 100644 --- a/src/synth/netlists.ads +++ b/src/synth/netlists.ads @@ -361,6 +361,23 @@ private type Net is new Uns32; No_Net : constant Net := 0; + type Instance is new Uns32; + No_Instance : constant Instance := 0; + + type Attribute is new Uns32; + No_Attribute : Attribute := 0; + + type Attribute_Tables_Instance; + + type Attribute_Table_Acc is access Attribute_Tables_Instance; + + type Attribute_Value is record + Name : Name_Id; + Val : Pval; + Typ : Param_Type; + Chain : Attribute; + end record; + type Module_Record is record Parent : Module; Name : Sname; @@ -383,15 +400,14 @@ private -- FIXME: use an array instead ? First_Instance : Instance; Last_Instance : Instance; + + Attrs : Attribute_Table_Acc; end record; function Get_First_Port_Desc (M : Module) return Port_Desc_Idx; function Get_First_Output (Inst : Instance) return Net; function Get_Port_Desc (Idx : Port_Desc_Idx) return Port_Desc; - type Instance is new Uns32; - No_Instance : constant Instance := 0; - function Is_Valid (I : Instance) return Boolean; type Instance_Record is record |