diff options
author | Martin Doerfelt <martin.d@andix.de> | 2019-08-28 22:46:17 +0200 |
---|---|---|
committer | Martin Doerfelt <martin.d@andix.de> | 2019-08-30 18:10:35 +0200 |
commit | 942bf6281dd3e78688790e0f7196867ef5bda15d (patch) | |
tree | 56339df758e6187c53a2308d83962a32e701df96 /src | |
parent | 70bca998891387e66b3cf522b3d66b8e873de08d (diff) | |
download | ghdl-942bf6281dd3e78688790e0f7196867ef5bda15d.tar.gz ghdl-942bf6281dd3e78688790e0f7196867ef5bda15d.tar.bz2 ghdl-942bf6281dd3e78688790e0f7196867ef5bda15d.zip |
synth: added division of physical type
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/synth-expr.adb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index 7bdad0672..6fdd413a5 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -1323,6 +1323,15 @@ package body Synth.Expr is else return Synth_Compare (Id_Ne); end if; + when Iir_Predefined_Physical_Physical_Div => + if Is_Const (Left) and then Is_Const (Right) then + return Create_Value_Discrete + (Left.Scal / Right.Scal, + Get_Value_Type (Syn_Inst, Get_Type (Expr))); + else + Error_Msg_Synth (+Expr, "non-constant division not supported"); + return null; + end if; when others => Error_Msg_Synth (+Expr, "synth_dyadic_operation: unhandled " @@ -2269,7 +2278,8 @@ package body Synth.Expr is when Iir_Kind_Floating_Point_Literal => return Create_Value_Float (Get_Fp_Value (Expr), Get_Value_Type (Syn_Inst, Expr_Type)); - when Iir_Kind_Physical_Int_Literal => + when Iir_Kind_Physical_Int_Literal + | Iir_Kind_Physical_Fp_Literal => return Create_Value_Discrete (Get_Physical_Value (Expr), Get_Value_Type (Syn_Inst, Expr_Type)); |