diff options
author | Tristan Gingold | 2016-01-27 05:58:56 +0100 |
---|---|---|
committer | Tristan Gingold | 2016-01-27 18:49:25 +0100 |
commit | ed5fdc7c5fee59ad06d3eed78c7505fc22009f95 (patch) | |
tree | f991c69675cc2b0dc7f1735c5692f51bceecd827 | |
parent | bbdcad893c34119c56812b9936fbc5e2dcc62f5c (diff) | |
download | ghdl-master.tar.gz ghdl-master.tar.bz2 ghdl-master.zip |
-rw-r--r-- | src/vhdl/simulate/debugger.adb | 3 | ||||
-rw-r--r-- | src/vhdl/simulate/elaboration.adb | 3 | ||||
-rw-r--r-- | src/vhdl/simulate/execution.adb | 30 | ||||
-rw-r--r-- | src/vhdl/simulate/iir_values.adb | 49 | ||||
-rw-r--r-- | src/vhdl/simulate/iir_values.ads | 10 | ||||
-rw-r--r-- | src/vhdl/simulate/simulation.adb | 42 |
6 files changed, 57 insertions, 80 deletions
diff --git a/src/vhdl/simulate/debugger.adb b/src/vhdl/simulate/debugger.adb index e690aed..a08f87f 100644 --- a/src/vhdl/simulate/debugger.adb +++ b/src/vhdl/simulate/debugger.adb @@ -376,7 +376,8 @@ package body Debugger is when Iir_Value_File | Iir_Value_Protected | Iir_Value_Quantity - | Iir_Value_Terminal => + | Iir_Value_Terminal + | Iir_Value_Environment => raise Internal_Error; end case; end Disp_Signal; diff --git a/src/vhdl/simulate/elaboration.adb b/src/vhdl/simulate/elaboration.adb index 739bf02..1ad2e02 100644 --- a/src/vhdl/simulate/elaboration.adb +++ b/src/vhdl/simulate/elaboration.adb @@ -95,7 +95,8 @@ package body Elaboration is | Iir_Value_Access | Iir_Value_Protected | Iir_Value_Quantity - | Iir_Value_Terminal => + | Iir_Value_Terminal + | Iir_Value_Environment => raise Internal_Error; end case; return Res; diff --git a/src/vhdl/simulate/execution.adb b/src/vhdl/simulate/execution.adb index c58e039..b299d64 100644 --- a/src/vhdl/simulate/execution.adb +++ b/src/vhdl/simulate/execution.adb @@ -2207,7 +2207,7 @@ package body Execution is case Get_Kind (Target_Type) is when Iir_Kind_Integer_Type_Definition | Iir_Kind_Integer_Subtype_Definition => - case Res.Kind is + case Iir_Value_Numerics (Res.Kind) is when Iir_Value_I64 => null; when Iir_Value_F64 => @@ -2217,40 +2217,14 @@ package body Execution is Error_Msg_Constraint (Conv); end if; Res := Create_I64_Value (Ghdl_I64 (Res.F64)); - when Iir_Value_B1 - | Iir_Value_E32 - | Iir_Value_Range - | Iir_Value_Array - | Iir_Value_Signal - | Iir_Value_Record - | Iir_Value_Access - | Iir_Value_File - | Iir_Value_Protected - | Iir_Value_Quantity - | Iir_Value_Terminal => - -- These values are not of abstract numeric type. - raise Internal_Error; end case; when Iir_Kind_Floating_Type_Definition | Iir_Kind_Floating_Subtype_Definition => - case Res.Kind is + case Iir_Value_Numerics (Res.Kind) is when Iir_Value_F64 => null; when Iir_Value_I64 => Res := Create_F64_Value (Ghdl_F64 (Res.I64)); - when Iir_Value_B1 - | Iir_Value_E32 - | Iir_Value_Range - | Iir_Value_Array - | Iir_Value_Signal - | Iir_Value_Record - | Iir_Value_Access - | Iir_Value_File - | Iir_Value_Protected - | Iir_Value_Quantity - | Iir_Value_Terminal => - -- These values are not of abstract numeric type. - raise Internal_Error; end case; when Iir_Kind_Enumeration_Type_Definition | Iir_Kind_Enumeration_Subtype_Definition => diff --git a/src/vhdl/simulate/iir_values.adb b/src/vhdl/simulate/iir_values.adb index c79ac8f..ab9ad52 100644 --- a/src/vhdl/simulate/iir_values.adb +++ b/src/vhdl/simulate/iir_values.adb @@ -84,7 +84,8 @@ package body Iir_Values is when Iir_Value_Signal | Iir_Value_Protected | Iir_Value_Quantity - | Iir_Value_Terminal => + | Iir_Value_Terminal + | Iir_Value_Environment => raise Internal_Error; end case; end Is_Equal; @@ -182,7 +183,8 @@ package body Iir_Values is | Iir_Value_File | Iir_Value_Protected | Iir_Value_Quantity - | Iir_Value_Terminal => + | Iir_Value_Terminal + | Iir_Value_Environment => raise Internal_Error; end case; end Compare_Value; @@ -222,7 +224,8 @@ package body Iir_Values is | Iir_Value_Signal | Iir_Value_Protected | Iir_Value_Quantity - | Iir_Value_Terminal => + | Iir_Value_Terminal + | Iir_Value_Environment => raise Internal_Error; end case; end Increment; @@ -267,7 +270,8 @@ package body Iir_Values is Dest.Sig := Src.Sig; when Iir_Value_Range | Iir_Value_Quantity - | Iir_Value_Terminal => + | Iir_Value_Terminal + | Iir_Value_Environment => raise Internal_Error; end case; end Store; @@ -299,11 +303,7 @@ package body Iir_Values is Check_Bounds (Dest.Val_Record.V (I), Src.Val_Record.V (I), Loc); end loop; when Iir_Value_Access - | Iir_Value_File - | Iir_Value_Range - | Iir_Value_Protected - | Iir_Value_Quantity - | Iir_Value_Terminal => + | Iir_Value_File => if Src.Kind /= Dest.Kind then raise Internal_Error; end if; @@ -313,6 +313,12 @@ package body Iir_Values is | Iir_Value_F64 | Iir_Value_Signal => return; + when Iir_Value_Range + | Iir_Value_Protected + | Iir_Value_Quantity + | Iir_Value_Terminal + | Iir_Value_Environment => + raise Internal_Error; end case; end Check_Bounds; @@ -461,7 +467,7 @@ package body Iir_Values is High := Left; end case; - case (Low.Kind) is + case Iir_Value_Scalars (Low.Kind) is when Iir_Value_B1 => if High.B1 >= Low.B1 then Len := Ghdl_B1'Pos (High.B1) - Ghdl_B1'Pos (Low.B1) + 1; @@ -500,16 +506,6 @@ package body Iir_Values is end; when Iir_Value_F64 => Len := 0; - when Iir_Value_Array - | Iir_Value_Record - | Iir_Value_Access - | Iir_Value_File - | Iir_Value_Range - | Iir_Value_Signal - | Iir_Value_Protected - | Iir_Value_Quantity - | Iir_Value_Terminal => - raise Internal_Error; end case; return Create_Range_Value (Left, Right, Dir, Len); end Create_Range_Value; @@ -644,7 +640,8 @@ package body Iir_Values is return Create_Signal_Value (Src.Sig); when Iir_Value_Quantity - | Iir_Value_Terminal => + | Iir_Value_Terminal + | Iir_Value_Environment => raise Internal_Error; end case; end Copy; @@ -743,7 +740,8 @@ package body Iir_Values is | Iir_Value_Range | Iir_Value_Protected | Iir_Value_Terminal - | Iir_Value_Quantity => + | Iir_Value_Quantity + | Iir_Value_Environment => raise Internal_Error; end case; end Get_Nbr_Of_Scalars; @@ -863,6 +861,8 @@ package body Iir_Values is Put_Line ("quantity"); when Iir_Value_Terminal => Put_Line ("terminal"); + when Iir_Value_Environment => + Put_Line ("environment"); end case; end Disp_Value_Tab; @@ -880,7 +880,8 @@ package body Iir_Values is | Iir_Value_File | Iir_Value_Protected | Iir_Value_Quantity - | Iir_Value_Terminal => + | Iir_Value_Terminal + | Iir_Value_Environment => return False; when Iir_Value_Range => return Is_Indirect (Value.Left) @@ -1065,6 +1066,8 @@ package body Iir_Values is Put ("[signal]"); when Iir_Value_Protected => Put ("[protected]"); + when Iir_Value_Environment => + Put ("[environment]"); end case; end Disp_Iir_Value; end Iir_Values; diff --git a/src/vhdl/simulate/iir_values.ads b/src/vhdl/simulate/iir_values.ads index 67a431c..92f8cef 100644 --- a/src/vhdl/simulate/iir_values.ads +++ b/src/vhdl/simulate/iir_values.ads @@ -111,17 +111,23 @@ package Iir_Values is Iir_Value_Protected, Iir_Value_Signal, Iir_Value_Terminal, - Iir_Value_Quantity); + Iir_Value_Quantity, + Iir_Value_Environment); type Protected_Index_Type is new Natural; type Quantity_Index_Type is new Natural; type Terminal_Index_Type is new Natural; + type Environment_Index_Type is new Natural; -- Scalar values. Only these ones can be signals. subtype Iir_Value_Scalars is Iir_Value_Kind range Iir_Value_B1 .. Iir_Value_F64; + -- Abstrace numeric types. + subtype Iir_Value_Numerics is + Iir_Value_Kind range Iir_Value_I64 .. Iir_Value_F64; + type Iir_Value_Literal (Kind: Iir_Value_Kind); type Iir_Value_Literal_Acc is access Iir_Value_Literal; @@ -172,6 +178,8 @@ package Iir_Values is Quantity : Quantity_Index_Type; when Iir_Value_Terminal => Terminal : Terminal_Index_Type; + when Iir_Value_Environment => + Environment : Environment_Index_Type; when Iir_Value_Range => Dir: Iir_Direction; Length : Iir_Index32; diff --git a/src/vhdl/simulate/simulation.adb b/src/vhdl/simulate/simulation.adb index df4e6b0..7238bf9 100644 --- a/src/vhdl/simulate/simulation.adb +++ b/src/vhdl/simulate/simulation.adb @@ -470,7 +470,8 @@ package body Simulation is | Iir_Value_Access | Iir_Value_Protected | Iir_Value_Quantity - | Iir_Value_Terminal => + | Iir_Value_Terminal + | Iir_Value_Environment => raise Internal_Error; end case; end Assign_Value_To_Signal; @@ -1095,29 +1096,16 @@ package body Simulation is end loop; return; when Iir_Value_Signal => - case Port.Kind is - when Iir_Value_Signal => - -- Here, SIG and PORT are simple signals (not composite). - -- PORT is a source for SIG. - case Mode is - when Connect_Source => - Grt.Signals.Ghdl_Signal_Add_Source - (Sig.Sig, Port.Sig); - when Connect_Effective => - Grt.Signals.Ghdl_Signal_Effective_Value - (Port.Sig, Sig.Sig); - end case; - when Iir_Value_Access - | Iir_Value_File - | Iir_Value_Range - | Iir_Value_Scalars -- FIXME: by value - | Iir_Value_Record - | Iir_Value_Array - | Iir_Value_Protected - | Iir_Value_Quantity - | Iir_Value_Terminal => - -- These cannot be driving value for a signal. - raise Internal_Error; + pragma Assert (Port.Kind = Iir_Value_Signal); + -- Here, SIG and PORT are simple signals (not composite). + -- PORT is a source for SIG. + case Mode is + when Connect_Source => + Grt.Signals.Ghdl_Signal_Add_Source + (Sig.Sig, Port.Sig); + when Connect_Effective => + Grt.Signals.Ghdl_Signal_Effective_Value + (Port.Sig, Sig.Sig); end case; when Iir_Value_E32 => if Mode = Connect_Source then @@ -1246,7 +1234,8 @@ package body Simulation is | Iir_Value_Protected | Iir_Value_Terminal | Iir_Value_Quantity - | Iir_Value_File => + | Iir_Value_File + | Iir_Value_Environment => raise Internal_Error; end case; end Create_Shadow_Signal; @@ -1562,7 +1551,8 @@ package body Simulation is | Iir_Value_Access | Iir_Value_Protected | Iir_Value_Quantity - | Iir_Value_Terminal => + | Iir_Value_Terminal + | Iir_Value_Environment => raise Internal_Error; end case; end Create_Signal; |