aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-12-28 08:49:44 +0100
committerTristan Gingold <tgingold@free.fr>2018-12-29 06:11:20 +0100
commitd26b5f5f4d879851654d1313deb41d744a8d4ebf (patch)
treeab92a8ff5271d093e5f1d24248ea537497160a06
parent8bd0c70390d97132dc3747b24d0cb51336a23342 (diff)
downloadghdl-d26b5f5f4d879851654d1313deb41d744a8d4ebf.tar.gz
ghdl-d26b5f5f4d879851654d1313deb41d744a8d4ebf.tar.bz2
ghdl-d26b5f5f4d879851654d1313deb41d744a8d4ebf.zip
openieee: WIP for vhdl 2008.
-rwxr-xr-xlibraries/openieee/build_1164.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/libraries/openieee/build_1164.py b/libraries/openieee/build_1164.py
index 393ee92cf..0eb16595f 100755
--- a/libraries/openieee/build_1164.py
+++ b/libraries/openieee/build_1164.py
@@ -172,6 +172,52 @@ def disp_vec_unary(func, typ):
return res;
end "{0}";\n""".format(func, typ))
+def disp_scal_vec_binary(func, typ):
+ "Generate scalar-vector binary function body"
+ w("""
+ function "{0}" (l : std_{1}_vector; r : std_{1})
+ return std_{1}_vector
+ is
+ subtype res_type is std_{1}_vector (1 to l'length);
+ alias la : res_type is l;
+ variable res : res_type;
+ begin
+ for I in res_type'range loop
+ res (I) := {0}_table (la (I), r);
+ end loop;
+ return res;
+ end "{0}";\n""".format(func, typ))
+
+def disp_vec_scal_binary(func, typ):
+ "Generate vector-scalar binary function body"
+ w("""
+ function "{0}" (l : std_{1}; r : std_{1}_vector)
+ return std_{1}_vector
+ is
+ subtype res_type is std_{1}_vector (1 to r'length);
+ alias ra : res_type is r;
+ variable res : res_type;
+ begin
+ for I in res_type'range loop
+ res (I) := {0}_table (l, ra (I));
+ end loop;
+ return res;
+ end "{0}";\n""".format(func, typ))
+
+def disp_vec_reduction(func, typ):
+ "Generate reduction function body"
+ init = '1' if func in ['and', 'nand'] else '0'
+ w("""
+ function "{0}" (l : std_{1}_vector) return std_{1}
+ is
+ variable res : std_{1} := '{2}';
+ begin
+ for I in l'range loop
+ res := {0}_table (l(I), res);
+ end loop;
+ return res;
+ end "{0}";\n""".format(func, typ, init))
+
def disp_all_log_funcs(version):
"Generate all function bodies for logic operators"
for f in binary_funcs:
@@ -182,6 +228,12 @@ def disp_all_log_funcs(version):
for f in binary_funcs:
disp_vec_binary(f, v)
disp_vec_unary("not", v)
+ if version >= V08:
+ for f in binary_funcs:
+ disp_scal_vec_binary(f, v)
+ disp_vec_scal_binary(f, v)
+ for f in binary_funcs:
+ disp_vec_reduction(f, v)
def disp_sv_to_bv_conv(typ):
"Generate logic vector to bit vector function body"
@@ -378,3 +430,6 @@ gen_body('std_logic_1164-body.v87', V87)
binary_funcs.append("xnor")
gen_body('std_logic_1164-body.v93', V93)
+
+vec_types = ['ulogic']
+gen_body('std_logic_1164-body.v08', V08)