summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Gingold2014-05-07 05:24:15 +0200
committerTristan Gingold2014-05-07 05:24:15 +0200
commit8d138e0ceff0e77014a4459971bb5bed34aa796b (patch)
tree520825336e8c12a60e915ac0511ddbae43688fe0
parent77d6e8dba756da993707baa2deac4b235bb78992 (diff)
downloadghdl-8d138e0ceff0e77014a4459971bb5bed34aa796b.tar.gz
ghdl-8d138e0ceff0e77014a4459971bb5bed34aa796b.tar.bz2
ghdl-8d138e0ceff0e77014a4459971bb5bed34aa796b.zip
evaluation: Handl FP literals in Get_Physical_Value.
-rw-r--r--evaluation.adb11
1 files changed, 6 insertions, 5 deletions
diff --git a/evaluation.adb b/evaluation.adb
index eb0231e..0840500 100644
--- a/evaluation.adb
+++ b/evaluation.adb
@@ -33,6 +33,11 @@ package body Evaluation is
when Iir_Kind_Physical_Int_Literal =>
return Get_Value (Expr)
* Get_Value (Get_Physical_Unit_Value (Get_Unit_Name (Expr)));
+ when Iir_Kind_Physical_Fp_Literal =>
+ return Iir_Int64
+ (Get_Fp_Value (Expr)
+ * Iir_Fp64 (Get_Value (Get_Physical_Unit_Value
+ (Get_Unit_Name (Expr)))));
when Iir_Kind_Unit_Declaration =>
return Get_Value (Get_Physical_Unit_Value (Expr));
when others =>
@@ -1678,11 +1683,7 @@ package body Evaluation is
return Build_Physical (Get_Physical_Value (Expr), Expr);
end if;
when Iir_Kind_Physical_Fp_Literal =>
- return Build_Physical
- (Iir_Int64 (Get_Fp_Value (Expr)
- * Iir_Fp64 (Get_Value (Get_Physical_Unit_Value
- (Get_Unit_Name (Expr))))),
- Expr);
+ return Build_Physical (Get_Physical_Value (Expr), Expr);
when Iir_Kind_Constant_Declaration =>
Val := Get_Default_Value (Expr);
Res := Build_Constant (Val, Expr);