aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-values.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-10-20 11:50:14 +0200
committerTristan Gingold <tgingold@free.fr>2019-10-20 11:50:14 +0200
commit56d1edff7fc40f745a47f6860bc2f9860d80052b (patch)
tree4741f3f3dd46f890c60878ab50147892f374bd34 /src/synth/synth-values.adb
parent663b68d2cc22967352aa43c8135a61c24d8d9503 (diff)
downloadghdl-56d1edff7fc40f745a47f6860bc2f9860d80052b.tar.gz
ghdl-56d1edff7fc40f745a47f6860bc2f9860d80052b.tar.bz2
ghdl-56d1edff7fc40f745a47f6860bc2f9860d80052b.zip
synth: add value_const.
Diffstat (limited to 'src/synth/synth-values.adb')
-rw-r--r--src/synth/synth-values.adb25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/synth/synth-values.adb b/src/synth/synth-values.adb
index 30695afa2..2bbe7dd97 100644
--- a/src/synth/synth-values.adb
+++ b/src/synth/synth-values.adb
@@ -56,6 +56,8 @@ package body Synth.Values is
return False;
when Value_Alias =>
return Is_Const (Val.A_Obj);
+ when Value_Const =>
+ return True;
when Value_Instance
| Value_Subtype =>
-- Not really a value.
@@ -79,6 +81,8 @@ package body Synth.Values is
when Value_Array
| Value_Record =>
return False;
+ when Value_Const =>
+ return True;
when Value_Instance
| Value_Subtype
| Value_Alias =>
@@ -565,6 +569,27 @@ package body Synth.Values is
Typ => Typ)));
end Create_Value_Alias;
+ function Create_Value_Const (Val : Value_Acc; Loc : Syn_Src)
+ return Value_Acc
+ is
+ subtype Value_Type_Const is Value_Type (Value_Const);
+ function Alloc is new Areapools.Alloc_On_Pool_Addr (Value_Type_Const);
+ begin
+ return To_Value_Acc (Alloc (Current_Pool,
+ (Kind => Value_Const,
+ C_Val => Val,
+ C_Loc => Loc,
+ C_Net => No_Net,
+ Typ => Val.Typ)));
+ end Create_Value_Const;
+
+ procedure Strip_Const (Val : in out Value_Acc) is
+ begin
+ if Val.Kind = Value_Const then
+ Val := Val.C_Val;
+ end if;
+ end Strip_Const;
+
function Copy (Src: in Value_Acc) return Value_Acc
is
Res: Value_Acc;