diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-06-01 08:05:20 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-06-01 08:05:20 +0200 |
commit | b5131047ec5988893c40428d8cb9823f4c914bc4 (patch) | |
tree | 716ca821933edbe11ee71d3c248711a63e6aa91d /testsuite/gna/issue1346/wb_rst_pkg.vhd | |
parent | eaae9cb33f67aa6cf230e345724511b4b4d5c9cf (diff) | |
download | ghdl-b5131047ec5988893c40428d8cb9823f4c914bc4.tar.gz ghdl-b5131047ec5988893c40428d8cb9823f4c914bc4.tar.bz2 ghdl-b5131047ec5988893c40428d8cb9823f4c914bc4.zip |
testsuite/gna: add test from #1346
Diffstat (limited to 'testsuite/gna/issue1346/wb_rst_pkg.vhd')
-rw-r--r-- | testsuite/gna/issue1346/wb_rst_pkg.vhd | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/testsuite/gna/issue1346/wb_rst_pkg.vhd b/testsuite/gna/issue1346/wb_rst_pkg.vhd new file mode 100644 index 000000000..499841a05 --- /dev/null +++ b/testsuite/gna/issue1346/wb_rst_pkg.vhd @@ -0,0 +1,109 @@ +library ieee;
+ use ieee.std_logic_1164.all;
+ use ieee.numeric_std.all;
+
+library work;
+ use work.wb_pkg.all;
+
+package wb_rst_pkg is
+
+ pure function get_wb_rst( wb_i : wb_M2S_t)
+ return wb_M2S_t;
+
+ pure function get_wb_rst( wb_i : wb_S2M_t)
+ return wb_S2M_t;
+
+ procedure set_wb_rst( wb_o : out wb_M2S_t);
+ procedure set_wb_rst( wb_o : out wb_S2M_t);
+
+end wb_rst_pkg;
+--#############################################################################
+--#############################################################################
+package body wb_rst_pkg is
+
+ pure function get_wb_rst( wb_i : wb_M2S_t)
+ return wb_M2S_t
+ is
+ variable wb_v
+ : wb_M2S_t
+ ( tgc( wb_i.tgc'length - 1 downto 0)
+ , tga( wb_i.tga'length - 1 downto 0)
+ , adr( wb_i.adr'length - 1 downto 0)
+ , sel( wb_i.sel'length - 1 downto 0)
+ , tgd( wb_i.tgd'length - 1 downto 0)
+ , dat( wb_i.dat'length - 1 downto 0)
+ );
+
+ begin
+
+ wb_v.tgc := get_uvect( wb_i.tgc'length, 'X' );
+ wb_v.loc := wb_no_c;
+ wb_v.cyc := wb_no_c;
+ wb_v.stb := wb_no_c;
+ wb_v.we := 'X';
+ wb_v.tga := get_uvect( wb_i.tga'length, 'X' );
+ wb_v.adr := get_uvect( wb_i.adr'length, 'X' );
+ wb_v.bte := get_uvect( wb_i.bte'length, 'X' );
+ wb_v.sel := get_uvect( wb_i.sel'length, 'X' );
+ wb_v.tgd := get_uvect( wb_i.tgd'length, 'X' );
+ wb_v.dat := get_uvect( wb_i.dat'length, 'X' );
+
+ return wb_v;
+ end function;
+
+ pure function get_wb_rst( wb_i : wb_S2M_t)
+ return wb_S2M_t
+ is
+ variable wb_v
+ : wb_S2M_t
+ ( tgd( wb_i.tgd'length - 1 downto 0)
+ , dat( wb_i.dat'length - 1 downto 0)
+ );
+
+ begin
+
+ wb_v.tgd := get_uvect( wb_i.tgd'length, 'X' );
+ wb_v.dat := get_uvect( wb_i.dat'length, 'X' );
+ wb_v.stl := wb_no_c;
+ wb_v.ack := wb_no_c;
+ wb_v.err := wb_no_c;
+ wb_v.rty := wb_no_c;
+
+ return wb_v;
+ end function;
+
+ procedure set_wb_rst( wb_o : out wb_M2S_t)
+ is
+ variable wb_v
+ : wb_M2S_t
+ ( tgc( wb_o.tgc'length - 1 downto 0)
+ , tga( wb_o.tga'length - 1 downto 0)
+ , adr( wb_o.adr'length - 1 downto 0)
+ , sel( wb_o.sel'length - 1 downto 0)
+ , tgd( wb_o.tgd'length - 1 downto 0)
+ , dat( wb_o.dat'length - 1 downto 0)
+ );
+
+ begin
+ wb_v := get_wb_rst( wb_v );
+ wb_o := wb_v;
+ end procedure;
+
+ procedure set_wb_rst( wb_o : out wb_S2M_t)
+ is
+ variable wb_v
+ : wb_S2M_t
+ ( tgd( wb_o.tgd'length - 1 downto 0)
+ , dat( wb_o.dat'length - 1 downto 0)
+ );
+ begin
+ wb_v := get_wb_rst( wb_v );
+ wb_o := wb_v;
+ end procedure;
+
+end package body wb_rst_pkg;
+--#############################################################################
+--#############################################################################
+--#############################################################################
+--#############################################################################
+--#############################################################################
|