aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-sem_psl.adb
diff options
context:
space:
mode:
authortmeissner <programming@goodcleanfun.de>2020-06-05 13:47:04 +0200
committertgingold <tgingold@users.noreply.github.com>2020-06-06 07:51:38 +0200
commite44cd87182452ce6220b028c62caa1bdbb9c55e3 (patch)
tree5b321c4f3df1ac98254c806617dcad5880a669c7 /src/vhdl/vhdl-sem_psl.adb
parent2b31399a2db58e5480fcd51569f6353609b4219a (diff)
downloadghdl-e44cd87182452ce6220b028c62caa1bdbb9c55e3.tar.gz
ghdl-e44cd87182452ce6220b028c62caa1bdbb9c55e3.tar.bz2
ghdl-e44cd87182452ce6220b028c62caa1bdbb9c55e3.zip
Synthesis of PSL stable() function.
Diffstat (limited to 'src/vhdl/vhdl-sem_psl.adb')
-rw-r--r--src/vhdl/vhdl-sem_psl.adb35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/vhdl/vhdl-sem_psl.adb b/src/vhdl/vhdl-sem_psl.adb
index c4ebf345e..3d36070a3 100644
--- a/src/vhdl/vhdl-sem_psl.adb
+++ b/src/vhdl/vhdl-sem_psl.adb
@@ -123,6 +123,41 @@ package body Vhdl.Sem_Psl is
return Call;
end Sem_Prev_Builtin;
+ function Sem_Stable_Builtin (Call : Iir) return Iir
+ is
+ use Vhdl.Sem_Expr;
+ use Vhdl.Std_Package;
+ Expr : Iir;
+ Clock : Iir;
+ First : Boolean;
+ begin
+ Expr := Get_Expression (Call);
+ First := Is_Expr_Not_Analyzed (Expr);
+ Expr := Sem_Expression (Expr, Null_Iir);
+ if Expr /= Null_Iir then
+ Set_Expression (Call, Expr);
+ Set_Type (Call, Vhdl.Std_Package.Boolean_Type_Definition);
+ Set_Expr_Staticness (Call, None);
+ end if;
+
+ if First then
+ -- Analyze count and clock only once.
+ Clock := Get_Clock_Expression (Call);
+ if Clock /= Null_Iir then
+ Clock := Sem_Expression_Wildcard (Clock, Wildcard_Psl_Bit_Type);
+ Set_Clock_Expression (Call, Clock);
+ else
+ if Current_Psl_Default_Clock = Null_Iir then
+ Error_Msg_Sem (+Call, "no clock for PSL stable builtin");
+ else
+ Set_Default_Clock (Call, Current_Psl_Default_Clock);
+ end if;
+ end if;
+ end if;
+
+ return Call;
+ end Sem_Stable_Builtin;
+
-- Convert VHDL and/or/not nodes to PSL nodes.
function Convert_Bool (Expr : Iir) return PSL_Node
is