aboutsummaryrefslogtreecommitdiffstats
path: root/src/ortho/oread/tests/conv.on
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-12-08 05:31:45 +0100
committerTristan Gingold <tgingold@free.fr>2016-12-08 05:31:45 +0100
commite7f223da0ad86e2e00074302256aa43b43a83e9c (patch)
tree1c3eee24d7413e0b962f21d975a771ea4d46ce9b /src/ortho/oread/tests/conv.on
parent7b556be5180c421a13e93e24393f3ab77df8f864 (diff)
downloadghdl-e7f223da0ad86e2e00074302256aa43b43a83e9c.tar.gz
ghdl-e7f223da0ad86e2e00074302256aa43b43a83e9c.tar.bz2
ghdl-e7f223da0ad86e2e00074302256aa43b43a83e9c.zip
Add tests for oread (some are old)
Diffstat (limited to 'src/ortho/oread/tests/conv.on')
-rw-r--r--src/ortho/oread/tests/conv.on40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/ortho/oread/tests/conv.on b/src/ortho/oread/tests/conv.on
new file mode 100644
index 000000000..1b07fc5fe
--- /dev/null
+++ b/src/ortho/oread/tests/conv.on
@@ -0,0 +1,40 @@
+TYPE float64 IS FLOAT;
+TYPE int32 IS SIGNED (32);
+TYPE int64 IS SIGNED (64);
+
+PUBLIC FUNCTION to_int32 (a : float64) RETURN int32
+DECLARE
+BEGIN
+ RETURN int32'conv(a);
+END;
+
+PUBLIC FUNCTION fp_to_int32 (a : float64) RETURN int64
+DECLARE
+BEGIN
+ RETURN int64'conv(a);
+END;
+
+PUBLIC FUNCTION to_fp64 (a : int32) RETURN float64
+DECLARE
+BEGIN
+ RETURN float64'conv(a);
+END;
+
+PUBLIC FUNCTION conv2 (a : int32) RETURN int32
+DECLARE
+BEGIN
+ RETURN to_int32 (to_fp64 (a));
+END;
+
+PUBLIC FUNCTION to_int64 (a : int32) RETURN int64
+DECLARE
+BEGIN
+ RETURN int64'conv(a);
+END;
+
+-- Test spill
+PUBLIC FUNCTION spill1 (a : int32) RETURN int64
+DECLARE
+BEGIN
+ RETURN int64'conv(a) +# to_int64 (a);
+END;