aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authortmeissner <programming@goodcleanfun.de>2020-06-06 17:45:51 +0200
committertgingold <tgingold@users.noreply.github.com>2020-06-07 06:17:12 +0200
commitb85e83cd189e4e915ecd1a4ff00d1b81b919c215 (patch)
tree596eeed70dda1d0a526fa60f4610576104c9f24a /src/vhdl
parentd440dae86de77d0743d21dfd8889dfa73d0dc48d (diff)
downloadghdl-b85e83cd189e4e915ecd1a4ff00d1b81b919c215.tar.gz
ghdl-b85e83cd189e4e915ecd1a4ff00d1b81b919c215.tar.bz2
ghdl-b85e83cd189e4e915ecd1a4ff00d1b81b919c215.zip
Synthesis of PSL built-in fell() function.
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/vhdl-prints.adb17
-rw-r--r--src/vhdl/vhdl-sem_expr.adb6
-rw-r--r--src/vhdl/vhdl-sem_psl.adb35
-rw-r--r--src/vhdl/vhdl-sem_psl.ads1
4 files changed, 58 insertions, 1 deletions
diff --git a/src/vhdl/vhdl-prints.adb b/src/vhdl/vhdl-prints.adb
index 60da5bef2..fb4a55eb8 100644
--- a/src/vhdl/vhdl-prints.adb
+++ b/src/vhdl/vhdl-prints.adb
@@ -2318,6 +2318,21 @@ package body Vhdl.Prints is
Disp_Token (Ctxt, Tok_Right_Paren);
end Disp_Psl_Rose;
+ procedure Disp_Psl_Fell (Ctxt : in out Ctxt_Class; Call : Iir)
+ is
+ Expr : Iir;
+ begin
+ Disp_Token (Ctxt, Tok_Fell);
+ Disp_Token (Ctxt, Tok_Left_Paren);
+ Print (Ctxt, Get_Expression (Call));
+ Expr := Get_Clock_Expression (Call);
+ if Expr /= Null_Iir then
+ Disp_Token (Ctxt, Tok_Comma);
+ Print (Ctxt, Expr);
+ end if;
+ Disp_Token (Ctxt, Tok_Right_Paren);
+ end Disp_Psl_Fell;
+
procedure Disp_Psl_Declaration (Ctxt : in out Ctxt_Class; Stmt : Iir)
is
Decl : constant PSL_Node := Get_Psl_Declaration (Stmt);
@@ -4785,6 +4800,8 @@ package body Vhdl.Prints is
Disp_Psl_Stable (Ctxt, Expr);
when Iir_Kind_Psl_Rose =>
Disp_Psl_Rose (Ctxt, Expr);
+ when Iir_Kind_Psl_Fell =>
+ Disp_Psl_Fell (Ctxt, Expr);
when Iir_Kinds_Type_And_Subtype_Definition =>
Disp_Type (Ctxt, Expr);
diff --git a/src/vhdl/vhdl-sem_expr.adb b/src/vhdl/vhdl-sem_expr.adb
index 491d9873c..dbbbe412a 100644
--- a/src/vhdl/vhdl-sem_expr.adb
+++ b/src/vhdl/vhdl-sem_expr.adb
@@ -417,7 +417,8 @@ package body Vhdl.Sem_Expr is
return Expr;
when Iir_Kind_Psl_Endpoint_Declaration
| Iir_Kind_Psl_Stable
- | Iir_Kind_Psl_Rose =>
+ | Iir_Kind_Psl_Rose
+ | Iir_Kind_Psl_Fell =>
return Expr;
when Iir_Kind_Simple_Name
| Iir_Kind_Parenthesis_Name
@@ -4836,6 +4837,9 @@ package body Vhdl.Sem_Expr is
when Iir_Kind_Psl_Rose =>
return Sem_Psl.Sem_Rose_Builtin (Expr);
+ when Iir_Kind_Psl_Fell =>
+ return Sem_Psl.Sem_Fell_Builtin (Expr);
+
when Iir_Kind_Error =>
-- Always ok.
-- Use the error as a type.
diff --git a/src/vhdl/vhdl-sem_psl.adb b/src/vhdl/vhdl-sem_psl.adb
index d34d36918..290e13836 100644
--- a/src/vhdl/vhdl-sem_psl.adb
+++ b/src/vhdl/vhdl-sem_psl.adb
@@ -193,6 +193,41 @@ package body Vhdl.Sem_Psl is
return Call;
end Sem_Rose_Builtin;
+ function Sem_Fell_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 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 fell builtin");
+ else
+ Set_Default_Clock (Call, Current_Psl_Default_Clock);
+ end if;
+ end if;
+ end if;
+
+ return Call;
+ end Sem_Fell_Builtin;
+
-- Convert VHDL and/or/not nodes to PSL nodes.
function Convert_Bool (Expr : Iir) return PSL_Node
is
diff --git a/src/vhdl/vhdl-sem_psl.ads b/src/vhdl/vhdl-sem_psl.ads
index 28f67ed06..76088be99 100644
--- a/src/vhdl/vhdl-sem_psl.ads
+++ b/src/vhdl/vhdl-sem_psl.ads
@@ -25,6 +25,7 @@ package Vhdl.Sem_Psl is
function Sem_Prev_Builtin (Call : Iir; Atype : Iir) return Iir;
function Sem_Stable_Builtin (Call : Iir) return Iir;
function Sem_Rose_Builtin (Call : Iir) return Iir;
+ function Sem_Fell_Builtin (Call : Iir) return Iir;
procedure Sem_Psl_Declaration (Stmt : Iir);
procedure Sem_Psl_Endpoint_Declaration (Stmt : Iir);