diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-07-25 05:16:09 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-07-25 05:16:09 +0200 |
commit | 54cf60d44d1110b127f6a81ee789eef4740630a1 (patch) | |
tree | fe159529cf9dfb1bbb1e06b619e89fc76cc6c6d8 /src | |
parent | 4fb0f50bc59eac444acb171040964dc73d3d105f (diff) | |
download | ghdl-54cf60d44d1110b127f6a81ee789eef4740630a1.tar.gz ghdl-54cf60d44d1110b127f6a81ee789eef4740630a1.tar.bz2 ghdl-54cf60d44d1110b127f6a81ee789eef4740630a1.zip |
synth/elab-vhdl_values: add Value_Terminal
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/elab-vhdl_debug.adb | 2 | ||||
-rw-r--r-- | src/synth/elab-vhdl_values-debug.adb | 4 | ||||
-rw-r--r-- | src/synth/elab-vhdl_values.adb | 24 | ||||
-rw-r--r-- | src/synth/elab-vhdl_values.ads | 8 | ||||
-rw-r--r-- | src/synth/synth-vhdl_context.adb | 3 | ||||
-rw-r--r-- | src/synth/synth-vhdl_insts.adb | 1 |
6 files changed, 38 insertions, 4 deletions
diff --git a/src/synth/elab-vhdl_debug.adb b/src/synth/elab-vhdl_debug.adb index 23b098b69..87b45f799 100644 --- a/src/synth/elab-vhdl_debug.adb +++ b/src/synth/elab-vhdl_debug.adb @@ -231,6 +231,8 @@ package body Elab.Vhdl_Debug is Put ("file"); when Value_Quantity => Put ("quantity"); + when Value_Terminal => + Put ("terminal"); when Value_Const => Put ("const: "); Disp_Memtyp (Get_Memtyp (Vt), Vtype); diff --git a/src/synth/elab-vhdl_values-debug.adb b/src/synth/elab-vhdl_values-debug.adb index 0466bcde2..0d9e4923f 100644 --- a/src/synth/elab-vhdl_values-debug.adb +++ b/src/synth/elab-vhdl_values-debug.adb @@ -309,6 +309,10 @@ package body Elab.Vhdl_Values.Debug is Put ("quantity "); Put_Uns32 (Uns32 (V.Val.Q)); New_Line; + when Value_Terminal => + Put ("terminal "); + Put_Uns32 (Uns32 (V.Val.T)); + New_Line; when Value_Alias => Put ("an alias: "); Debug_Typ1 (V.Typ); diff --git a/src/synth/elab-vhdl_values.adb b/src/synth/elab-vhdl_values.adb index 12953b869..a571d6b62 100644 --- a/src/synth/elab-vhdl_values.adb +++ b/src/synth/elab-vhdl_values.adb @@ -34,7 +34,8 @@ package body Elab.Vhdl_Values is | Value_Wire | Value_Signal | Value_Dyn_Alias - | Value_Quantity => + | Value_Quantity + | Value_Terminal => return False; when Value_File => return True; @@ -200,6 +201,21 @@ package body Elab.Vhdl_Values is return (Vtype, Create_Value_Quantity (Q)); end Create_Value_Quantity; + function Create_Value_Terminal (T : Terminal_Index_Type) return Value_Acc + is + subtype Value_Type_Terminal is Value_Type (Value_Terminal); + function Alloc is new Areapools.Alloc_On_Pool_Addr (Value_Type_Terminal); + begin + return To_Value_Acc (Alloc (Current_Pool, + (Kind => Value_Terminal, T => T))); + end Create_Value_Terminal; + + function Create_Value_Terminal (Vtype : Type_Acc; T : Terminal_Index_Type) + return Valtyp is + begin + return (Vtype, Create_Value_Terminal (T)); + end Create_Value_Terminal; + function Create_Value_Alias (Obj : Valtyp; Off : Value_Offsets; Typ : Type_Acc) return Valtyp is @@ -286,7 +302,8 @@ package body Elab.Vhdl_Values is Res := (Src.Typ, Create_Value_Wire (Src.Val.N)); when Value_File => Res := Create_Value_File (Src.Typ, Src.Val.File); - when Value_Quantity => + when Value_Quantity + | Value_Terminal => raise Internal_Error; when Value_Signal => raise Internal_Error; @@ -512,7 +529,8 @@ package body Elab.Vhdl_Values is when Value_Const => return Get_Memtyp ((V.Typ, V.Val.C_Val)); when Value_File - | Value_Quantity => + | Value_Quantity + | Value_Terminal => raise Internal_Error; end case; end Get_Memtyp; diff --git a/src/synth/elab-vhdl_values.ads b/src/synth/elab-vhdl_values.ads index 0ffdf2381..15cdfeb20 100644 --- a/src/synth/elab-vhdl_values.ads +++ b/src/synth/elab-vhdl_values.ads @@ -49,6 +49,7 @@ package Elab.Vhdl_Values is Value_File, Value_Quantity, + Value_Terminal, -- A constant. This is a named value. One purpose is to avoid to -- create many times the same net for the same value. @@ -77,6 +78,9 @@ package Elab.Vhdl_Values is type Quantity_Index_Type is new Uns32; No_Quantity_Index : constant Quantity_Index_Type := 0; + type Terminal_Index_Type is new Uns32; + No_Terminal_Index : constant Terminal_Index_Type := 0; + type Value_Type (Kind : Value_Kind) is record case Kind is when Value_Net @@ -91,6 +95,8 @@ package Elab.Vhdl_Values is File : File_Index; when Value_Quantity => Q : Quantity_Index_Type; + when Value_Terminal => + T : Terminal_Index_Type; when Value_Const => C_Val : Value_Acc; C_Loc : Node; @@ -156,6 +162,8 @@ package Elab.Vhdl_Values is function Create_Value_Quantity (Vtype : Type_Acc; Q : Quantity_Index_Type) return Valtyp; + function Create_Value_Terminal (Vtype : Type_Acc; T : Terminal_Index_Type) + return Valtyp; function Create_Value_Alias (Obj : Valtyp; Off : Value_Offsets; Typ : Type_Acc) return Valtyp; diff --git a/src/synth/synth-vhdl_context.adb b/src/synth/synth-vhdl_context.adb index 6e498afdf..90e618e1e 100644 --- a/src/synth/synth-vhdl_context.adb +++ b/src/synth/synth-vhdl_context.adb @@ -448,7 +448,8 @@ package body Synth.Vhdl_Context is | Value_Signal | Value_Dyn_Alias => return False; - when Value_Quantity => + when Value_Quantity + | Value_Terminal => return False; when Value_Wire => declare diff --git a/src/synth/synth-vhdl_insts.adb b/src/synth/synth-vhdl_insts.adb index 92ea9def3..75fb5f00d 100644 --- a/src/synth/synth-vhdl_insts.adb +++ b/src/synth/synth-vhdl_insts.adb @@ -229,6 +229,7 @@ package body Synth.Vhdl_Insts is | Value_Signal | Value_File | Value_Quantity + | Value_Terminal | Value_Dyn_Alias => raise Internal_Error; end case; |