diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-01-30 06:16:48 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-01-30 06:27:04 +0100 |
commit | ce7b33d5af8fe3a4ecdc5b342142a16cce3af0ac (patch) | |
tree | db053cbd30f5b4bd87598e3635183d83f6863ceb /src/synth/synth-expr.adb | |
parent | f4e47ad72f6b7ec7b519b3ea00dcf411dd46f7b8 (diff) | |
download | ghdl-ce7b33d5af8fe3a4ecdc5b342142a16cce3af0ac.tar.gz ghdl-ce7b33d5af8fe3a4ecdc5b342142a16cce3af0ac.tar.bz2 ghdl-ce7b33d5af8fe3a4ecdc5b342142a16cce3af0ac.zip |
synth: handle some rotation and shifts. Fix #1077
Diffstat (limited to 'src/synth/synth-expr.adb')
-rw-r--r-- | src/synth/synth-expr.adb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index 8e334cc2a..15d0d622d 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -68,6 +68,35 @@ package body Synth.Expr is return Get_Net_Int64 (N); end Get_Static_Discrete; + function Is_Positive (V : Value_Acc) return Boolean + is + N : Net; + Inst : Instance; + begin + pragma Assert (V.Typ.Kind = Type_Discrete); + case V.Kind is + when Value_Discrete => + return V.Scal >= 0; + when Value_Const => + return V.C_Val.Scal >= 0; + when Value_Net => + N := V.N; + when Value_Wire => + N := Get_Net (V); + when others => + raise Internal_Error; + end case; + Inst := Get_Net_Parent (N); + case Get_Id (Inst) is + when Id_Uextend + | Id_Const_UB32 => + return True; + when others => + -- Be conservative. + return False; + end case; + end Is_Positive; + procedure From_Std_Logic (Enum : Int64; Val : out Uns32; Zx : out Uns32) is begin case Enum is |