aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2023-01-31 18:48:52 +0100
committerTristan Gingold <tgingold@free.fr>2023-01-31 20:26:53 +0100
commitcfab39c22b2ab2cf26bbeb3af2e68c22fb220ef3 (patch)
treee3630f9319db0f19b2bb70da9afc674cdaf77635 /src
parent00053acee65234c5d96c329e573f219d031c6aca (diff)
downloadghdl-cfab39c22b2ab2cf26bbeb3af2e68c22fb220ef3.tar.gz
ghdl-cfab39c22b2ab2cf26bbeb3af2e68c22fb220ef3.tar.bz2
ghdl-cfab39c22b2ab2cf26bbeb3af2e68c22fb220ef3.zip
PSL: optimize True for goto_repeat
Diffstat (limited to 'src')
-rw-r--r--src/psl/psl-rewrites.adb22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/psl/psl-rewrites.adb b/src/psl/psl-rewrites.adb
index 7130507a2..13f555c68 100644
--- a/src/psl/psl-rewrites.adb
+++ b/src/psl/psl-rewrites.adb
@@ -111,7 +111,9 @@ package body PSL.Rewrites is
return N;
when N_HDL_Expr =>
return Get_HDL_Hash (N);
- when N_HDL_Bool =>
+ when N_HDL_Bool
+ | N_True
+ | N_False =>
return N;
when others =>
Error_Kind ("rewrite_boolean", N);
@@ -198,8 +200,13 @@ package body PSL.Rewrites is
is
Res : Node;
begin
- -- b[->] --> {(~b)[*];b}
- Res := Build_Concat (Build_Star (Build_Bool_Not (B)), B);
+ if B /= True_Node then
+ -- b[->] --> {(~b)[*];b}
+ Res := Build_Concat (Build_Star (Build_Bool_Not (B)), B);
+ else
+ -- TRUE[->] --> TRUE
+ Res := True_Node;
+ end if;
if Lo = Null_Node then
return Res;
@@ -213,8 +220,13 @@ package body PSL.Rewrites is
is
Res : Node;
begin
- -- b[->] --> {(~b)[*];b}
- Res := Build_Concat (Build_Star (Build_Bool_Not (B)), B);
+ if B /= True_Node then
+ -- b[->] --> {(~b)[*];b}
+ Res := Build_Concat (Build_Star (Build_Bool_Not (B)), B);
+ else
+ -- TRUE[->] --> TRUE
+ Res := True_Node;
+ end if;
-- b[->l:h] --> {b[->]}[*l:h]
return Rewrite_Star_Repeat_Seq (Res, Lo, Hi);