aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/netlists.ads
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-03-31 07:34:25 +0200
committerTristan Gingold <tgingold@free.fr>2020-03-31 18:29:05 +0200
commitd8afbddcf37ea68a19b6edfa4820ef3bdd0c5076 (patch)
treeb51452cd7023564f5500c8b61a26c568dead732f /src/synth/netlists.ads
parent5aa87ef99e4f5ba046d215ac6d99a645ce7a0e1d (diff)
downloadghdl-d8afbddcf37ea68a19b6edfa4820ef3bdd0c5076.tar.gz
ghdl-d8afbddcf37ea68a19b6edfa4820ef3bdd0c5076.tar.bz2
ghdl-d8afbddcf37ea68a19b6edfa4820ef3bdd0c5076.zip
synth: preliminary work to export module parameters.
Diffstat (limited to 'src/synth/netlists.ads')
-rw-r--r--src/synth/netlists.ads37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/synth/netlists.ads b/src/synth/netlists.ads
index fb02cca17..23f369596 100644
--- a/src/synth/netlists.ads
+++ b/src/synth/netlists.ads
@@ -143,7 +143,8 @@ package Netlists is
-- First id for user.
Id_User_None : constant Module_Id := 128;
- Id_User_First : constant Module_Id := Id_User_None + 1;
+ Id_User_Parameters : constant Module_Id := 129;
+ Id_User_First : constant Module_Id := Id_User_Parameters + 1;
-- Port index. Starts at 0.
type Port_Nbr is new Uns32;
@@ -171,11 +172,22 @@ package Netlists is
type Param_Type is
(Param_Invalid,
- Param_Uns32
-- An unsigned 32 bit value.
+ Param_Uns32,
+
+ -- A Generic value (with a hint of the type). This is a bit/logic
+ -- vector.
+ Param_Pval_Vector,
+ Param_Pval_String,
+ Param_Pval_Integer,
+ Param_Pval_Real,
+ Param_Pval_Time_Ps
);
pragma Convention (C, Param_Type);
+ subtype Param_Types_Pval is
+ Param_Type range Param_Pval_Vector .. Param_Pval_Time_Ps;
+
type Param_Desc is record
-- Name of the parameter
Name : Sname;
@@ -186,6 +198,10 @@ package Netlists is
type Param_Desc_Array is array (Param_Idx range <>) of Param_Desc;
+ -- Parameter value.
+ type Pval is private;
+ No_Pval : constant Pval;
+
-- Subprograms for modules.
function New_Design (Name : Sname) return Module;
function New_User_Module (Parent : Module;
@@ -263,6 +279,9 @@ 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);
+ function Get_Param_Pval (Inst : Instance; Param : Param_Idx) return Pval;
+ procedure Set_Param_Pval (Inst : Instance; Param : Param_Idx; Val : Pval);
+
-- 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;
@@ -291,6 +310,16 @@ package Netlists is
-- Reconnect all sinks of OLD to N.
procedure Redirect_Inputs (Old : Net; N : Net);
+ -- For Pval.
+ -- Create a 4-state Pval. LEN is the number of bits (cannot be 0).
+ function Create_Pval4 (Len : Uns32) return Pval;
+ -- Create a 2-state Pval. The value cannot have X or Z.
+ function Create_Pval2 (Len : Uns32) return Pval;
+ function Get_Pval_Length (P : Pval) return Uns32;
+
+ -- OFF is the word offset, from 0 to (len - 1) / 32.
+ function Read_Pval (P : Pval; Off : Uns32) return Logic_32;
+ procedure Write_Pval (P : Pval; Off : Uns32; Val : Logic_32);
private
type Sname is new Uns32 range 0 .. 2**30 - 1;
No_Sname : constant Sname := 0;
@@ -410,4 +439,8 @@ private
First_Sink : Input;
W : Width;
end record;
+
+ type Pval is new Uns32;
+ No_Pval : constant Pval := 0;
+
end Netlists;