diff --git a/vunit/vhdl/verification_components/src/avalon_sink.vhd b/vunit/vhdl/verification_components/src/avalon_sink.vhd index 099d111f1..a2c2a99a5 100644 --- a/vunit/vhdl/verification_components/src/avalon_sink.vhd +++ b/vunit/vhdl/verification_components/src/avalon_sink.vhd @@ -13,7 +13,7 @@ use ieee.std_logic_1164.all; context work.vunit_context; context work.com_context; -use work.stream_slave_pkg.all; +use work.stream_pkg.all; use work.avalon_stream_pkg.all; library osvvm; @@ -39,6 +39,7 @@ begin variable msg_type : msg_type_t; variable rnd : RandomPType; variable avalon_stream_transaction : avalon_stream_transaction_t(data(data'range)); + variable stream_transaction : stream_transaction_t(data(data'range)); begin receive(net, sink.p_actor, msg); msg_type := message_type(msg); @@ -67,7 +68,9 @@ begin end if; push_avalon_stream_transaction(reply_msg, avalon_stream_transaction); else - push_std_ulogic_vector(reply_msg, data); + stream_transaction.data := data; + stream_transaction.last := false; + push_stream_transaction(reply_msg, stream_transaction); end if; reply(net, msg, reply_msg); ready <= '0'; diff --git a/vunit/vhdl/verification_components/src/avalon_source.vhd b/vunit/vhdl/verification_components/src/avalon_source.vhd index 3e63c4f15..1e81776e8 100644 --- a/vunit/vhdl/verification_components/src/avalon_source.vhd +++ b/vunit/vhdl/verification_components/src/avalon_source.vhd @@ -10,7 +10,7 @@ use ieee.std_logic_1164.all; context work.vunit_context; context work.com_context; -use work.stream_master_pkg.all; +use work.stream_pkg.all; use work.avalon_stream_pkg.all; use work.queue_pkg.all; use work.sync_pkg.all; diff --git a/vunit/vhdl/verification_components/src/avalon_stream_pkg.vhd b/vunit/vhdl/verification_components/src/avalon_stream_pkg.vhd index d676c5fba..432427c5c 100644 --- a/vunit/vhdl/verification_components/src/avalon_stream_pkg.vhd +++ b/vunit/vhdl/verification_components/src/avalon_stream_pkg.vhd @@ -8,8 +8,7 @@ library ieee; use ieee.std_logic_1164.all; use work.logger_pkg.all; -use work.stream_master_pkg.all; -use work.stream_slave_pkg.all; +use work.stream_pkg.all; context work.com_context; context work.data_types_context; diff --git a/vunit/vhdl/verification_components/src/axi_stream_master.vhd b/vunit/vhdl/verification_components/src/axi_stream_master.vhd index 228d223c5..0b0fdc443 100644 --- a/vunit/vhdl/verification_components/src/axi_stream_master.vhd +++ b/vunit/vhdl/verification_components/src/axi_stream_master.vhd @@ -9,7 +9,7 @@ use ieee.std_logic_1164.all; context work.vunit_context; context work.com_context; -use work.stream_master_pkg.all; +use work.stream_pkg.all; use work.axi_stream_pkg.all; use work.queue_pkg.all; use work.sync_pkg.all; diff --git a/vunit/vhdl/verification_components/src/axi_stream_pkg.vhd b/vunit/vhdl/verification_components/src/axi_stream_pkg.vhd index d03f8ca0b..5758aa3ec 100644 --- a/vunit/vhdl/verification_components/src/axi_stream_pkg.vhd +++ b/vunit/vhdl/verification_components/src/axi_stream_pkg.vhd @@ -10,8 +10,7 @@ use ieee.std_logic_1164.all; use work.logger_pkg.all; use work.checker_pkg.all; use work.check_pkg.all; -use work.stream_master_pkg.all; -use work.stream_slave_pkg.all; +use work.stream_pkg.all; use work.sync_pkg.all; context work.vunit_context; context work.com_context; diff --git a/vunit/vhdl/verification_components/src/axi_stream_slave.vhd b/vunit/vhdl/verification_components/src/axi_stream_slave.vhd index 69a33a7ff..5151dd0c0 100644 --- a/vunit/vhdl/verification_components/src/axi_stream_slave.vhd +++ b/vunit/vhdl/verification_components/src/axi_stream_slave.vhd @@ -9,7 +9,7 @@ use ieee.std_logic_1164.all; context work.vunit_context; context work.com_context; -use work.stream_slave_pkg.all; +use work.stream_pkg.all; use work.axi_stream_pkg.all; use work.sync_pkg.all; use work.string_ptr_pkg.all; diff --git a/vunit/vhdl/verification_components/src/stream_master_pkg-body.vhd b/vunit/vhdl/verification_components/src/stream_master_pkg-body.vhd deleted file mode 100644 index 5de0f2eca..000000000 --- a/vunit/vhdl/verification_components/src/stream_master_pkg-body.vhd +++ /dev/null @@ -1,31 +0,0 @@ --- This Source Code Form is subject to the terms of the Mozilla Public --- License, v. 2.0. If a copy of the MPL was not distributed with this file, --- You can obtain one at http://mozilla.org/MPL/2.0/. --- --- Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com - -library ieee; -use ieee.std_logic_1164.all; - -context work.vunit_context; -context work.com_context; - -package body stream_master_pkg is - impure function new_stream_master return stream_master_t is - begin - return (p_actor => new_actor); - end; - - procedure push_stream(signal net : inout network_t; - stream : stream_master_t; - data : std_logic_vector; - last : boolean := false) is - variable msg : msg_t := new_msg(stream_push_msg); - constant normalized_data : std_logic_vector(data'length-1 downto 0) := data; - begin - push_std_ulogic_vector(msg, normalized_data); - push_boolean(msg, last); - send(net, stream.p_actor, msg); - end; - -end package body; diff --git a/vunit/vhdl/verification_components/src/stream_master_pkg.vhd b/vunit/vhdl/verification_components/src/stream_master_pkg.vhd deleted file mode 100644 index 9a5d6c15e..000000000 --- a/vunit/vhdl/verification_components/src/stream_master_pkg.vhd +++ /dev/null @@ -1,32 +0,0 @@ --- This Source Code Form is subject to the terms of the Mozilla Public --- License, v. 2.0. If a copy of the MPL was not distributed with this file, --- You can obtain one at http://mozilla.org/MPL/2.0/. --- --- Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com - --- Stream master verification component interface - -library ieee; -use ieee.std_logic_1164.all; - -context work.vunit_context; -context work.com_context; - -package stream_master_pkg is - -- Stream master handle - type stream_master_t is record - p_actor : actor_t; - end record; - - -- Create a new stream master object - impure function new_stream_master return stream_master_t; - - -- Push a data value to the stream - procedure push_stream(signal net : inout network_t; - stream : stream_master_t; - data : std_logic_vector; - last : boolean := false); - - -- Message type definitions used by VC implementing stream master VCI - constant stream_push_msg : msg_type_t := new_msg_type("stream push"); -end package; diff --git a/vunit/vhdl/verification_components/src/stream_pkg-body.vhd b/vunit/vhdl/verification_components/src/stream_pkg-body.vhd new file mode 100644 index 000000000..265e03fd2 --- /dev/null +++ b/vunit/vhdl/verification_components/src/stream_pkg-body.vhd @@ -0,0 +1,337 @@ +-- This Source Code Form is subject to the terms of the Mozilla Public +-- License, v. 2.0. If a copy of the MPL was not distributed with this file, +-- You can obtain one at http://mozilla.org/MPL/2.0/. +-- +-- Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com + +-- Stream master & slave verification component interfaces + +library ieee; +use ieee.std_logic_1164.all; + +context work.vunit_context; +context work.com_context; +use work.sync_pkg.all; + +package body stream_pkg is + + impure function new_stream_master + return stream_master_t + is + begin + return (p_actor => new_actor); + end; + + impure function new_stream_slave + return stream_slave_t + is + begin + return (p_actor => new_actor); + end; + + function new_stream_transaction ( + data : std_logic_vector; + last : boolean := false) + return stream_transaction_t + is + variable transaction : stream_transaction_t(data(data'range)); + begin + transaction.data := data; + transaction.last := last; + return transaction; + end; + + procedure push ( + msg : msg_t; + transaction : stream_transaction_t) + is + begin + push_std_ulogic_vector(msg, transaction.data); + push_boolean(msg, transaction.last); + end; + + impure function pop ( + msg : msg_t) + return stream_transaction_t + is + begin + return (data => pop_std_ulogic_vector(msg), + last => pop_boolean(msg)); + end; + + procedure push_stream ( + signal net : inout network_t; + constant stream : in stream_master_t; + constant transaction : in stream_transaction_t) + is + variable msg : msg_t := new_msg(stream_push_msg); + begin + push_stream_transaction(msg, transaction); + send(net, stream.p_actor, msg); + end; + + procedure push_stream ( + signal net : inout network_t; + constant stream : in stream_master_t; + constant data : in std_logic_vector; + constant last : in boolean := false) + is + variable transaction : stream_transaction_t(data(data'range)); + begin + transaction.data := data; + transaction.last := last; + push_stream(net, stream, transaction); + end; + + procedure pop_stream ( + signal net : inout network_t; + constant stream : in stream_slave_t; + variable transaction : out stream_transaction_t) + is + variable reference : stream_reference_t; + begin + pop_stream(net, stream, reference); + await_pop_stream_reply(net, reference, transaction); + end; + + procedure pop_stream ( + signal net : inout network_t; + constant stream : in stream_slave_t; + variable data : out std_logic_vector; + variable last : out boolean) + is + variable reference : stream_reference_t; + begin + pop_stream(net, stream, reference); + await_pop_stream_reply(net, reference, data, last); + end; + + procedure pop_stream ( + signal net : inout network_t; + constant stream : in stream_slave_t; + variable data : out std_logic_vector) + is + variable reference : stream_reference_t; + begin + pop_stream(net, stream, reference); + await_pop_stream_reply(net, reference, data); + end; + + procedure pop_stream ( + signal net : inout network_t; + constant stream : in stream_slave_t; + variable reference : inout stream_reference_t) + is + begin + reference := new_msg(stream_pop_msg); + send(net, stream.p_actor, reference); + end; + + procedure await_pop_stream_reply ( + signal net : inout network_t; + variable reference : inout stream_reference_t; + variable transaction : out stream_transaction_t) + is + variable reply_msg : msg_t; + begin + receive_reply(net, reference, reply_msg); + transaction := pop_stream_transaction(reply_msg); + delete(reference); + delete(reply_msg); + end; + + procedure await_pop_stream_reply ( + signal net : inout network_t; + variable reference : inout stream_reference_t; + variable data : out std_logic_vector; + variable last : out boolean) + is + variable transaction : stream_transaction_t(data(data'range)); + begin + await_pop_stream_reply(net, reference, transaction); + data := transaction.data; + last := transaction.last; + end; + + procedure await_pop_stream_reply ( + signal net : inout network_t; + variable reference : inout stream_reference_t; + variable data : out std_logic_vector) + is + variable transaction : stream_transaction_t(data(data'range)); + begin + await_pop_stream_reply(net, reference, transaction); + data := transaction.data; + end; + + procedure check_stream ( + signal net : inout network_t; + constant stream : in stream_slave_t; + constant expected : in stream_transaction_t; + constant msg : in string := "") + is + variable got : stream_transaction_t(data(expected.data'range)); + begin + pop_stream(net, stream, got); + check_equal(got.data, expected.data, msg); + check_equal(got.last, expected.last, msg); + end; + + procedure check_stream ( + signal net : inout network_t; + constant stream : in stream_slave_t; + constant expected_data : in std_logic_vector; + constant expected_last : in boolean := false; + constant msg : in string := "") + is + variable expected : stream_transaction_t(data(expected_data'range)); + begin + expected.data := expected_data; + expected.last := expected_last; + check_stream(net, stream, expected, msg); + end; + + procedure wait_until_idle ( + signal net : inout network_t; + constant stream : in stream_master_t) + is + begin + wait_until_idle(net, stream.p_actor); + end procedure; + + procedure wait_until_idle ( + signal net : inout network_t; + constant stream : in stream_slave_t) + is + begin + wait_until_idle(net, stream.p_actor); + end procedure; + + procedure wait_for_time ( + signal net : inout network_t; + constant stream : in stream_master_t; + constant delay : in delay_length) + is + begin + wait_for_time(net, stream.p_actor, delay); + end procedure; + + procedure wait_for_time ( + signal net : inout network_t; + constant stream : in stream_slave_t; + constant delay : in delay_length) + is + begin + wait_for_time(net, stream.p_actor, delay); + end procedure; + + procedure receive ( + signal net : inout network_t; + constant stream : in stream_master_t; + variable msg : out msg_t) + is + begin + receive(net, stream.p_actor, msg); + end procedure; + + procedure receive ( + signal net : inout network_t; + constant stream : in stream_slave_t; + variable msg : out msg_t) + is + begin + receive(net, stream.p_actor, msg); + end procedure; + + procedure receive_stream ( + signal net : inout network_t; + constant stream : in stream_master_t; + variable transaction : out stream_transaction_t) + is + variable msg : msg_t; + variable msg_type : msg_type_t; + begin + loop + receive(net, stream, msg); + msg_type := message_type(msg); + handle_sync_message(net, msg_type, msg); + if msg_type = stream_push_msg then + transaction := pop_stream_transaction(msg); + delete(msg); + exit; + else + unexpected_msg_type(msg_type); + end if; + end loop; + end; + + procedure receive_stream ( + signal net : inout network_t; + constant stream : in stream_master_t; + variable data : out std_ulogic_vector; + variable last : out boolean) + is + variable transaction : stream_transaction_t(data(data'range)); + begin + receive_stream(net, stream, transaction); + data := transaction.data; + last := transaction.last; + end; + + procedure receive_stream ( + signal net : inout network_t; + constant stream : in stream_master_t; + variable data : out std_ulogic_vector) + is + variable transaction : stream_transaction_t(data(data'range)); + begin + receive_stream(net, stream, transaction); + data := transaction.data; + end; + + procedure receive_stream ( + signal net : inout network_t; + constant stream : in stream_slave_t; + variable msg : out msg_t) + is + variable msg_type : msg_type_t; + begin + loop + receive(net, stream, msg); + msg_type := message_type(msg); + handle_sync_message(net, msg_type, msg); + if msg_type = stream_pop_msg then + exit; + else + unexpected_msg_type(msg_type); + end if; + end loop; + end; + + procedure reply_stream ( + signal net : inout network_t; + variable msg : inout msg_t; + constant transaction : in stream_transaction_t) + is + variable reply_msg : msg_t; + begin + push_stream_transaction(msg, transaction); + reply(net, msg, reply_msg); + delete(reply_msg); + end; + + procedure reply_stream ( + signal net : inout network_t; + variable msg : inout msg_t; + constant data : in std_ulogic_vector; + constant last : in boolean := false) + is + variable transaction : stream_transaction_t(data(data'range)); + begin + transaction.data := data; + transaction.last := last; + reply_stream(net, msg, transaction); + end; + +end package body; + diff --git a/vunit/vhdl/verification_components/src/stream_pkg.vhd b/vunit/vhdl/verification_components/src/stream_pkg.vhd new file mode 100644 index 000000000..efceb3e98 --- /dev/null +++ b/vunit/vhdl/verification_components/src/stream_pkg.vhd @@ -0,0 +1,200 @@ +-- This Source Code Form is subject to the terms of the Mozilla Public +-- License, v. 2.0. If a copy of the MPL was not distributed with this file, +-- You can obtain one at http://mozilla.org/MPL/2.0/. +-- +-- Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com + +-- Stream master & slave verification component interfaces + +library ieee; +use ieee.std_logic_1164.all; + +context work.vunit_context; +context work.com_context; + +package stream_pkg is + + -- Stream master handle + type stream_master_t is record + p_actor : actor_t; + end record; + + -- Stream slave handle + type stream_slave_t is record + p_actor : actor_t; + end record; + + -- Create a new stream master object + impure function new_stream_master + return stream_master_t; + + -- Create a new stream slave object + impure function new_stream_slave + return stream_slave_t; + + -- Encapsulate a stream transaction + type stream_transaction_t is record + data : std_ulogic_vector; + last : boolean; + end record; + + -- Create a new stream transaction + function new_stream_transaction ( + data : std_logic_vector; + last : boolean := false) + return stream_transaction_t; + + -- Push a stream transaction into a message + procedure push ( + msg : msg_t; + transaction : stream_transaction_t); + + -- Pop a stream transaction from a message + impure function pop ( + msg : msg_t) + return stream_transaction_t; + + -- Aliases for breaking type ambiguity + alias push_stream_transaction is push[msg_t, stream_transaction_t]; + alias pop_stream_transaction is pop[msg_t return stream_transaction_t]; + + -- Message type definitions used by VC implementing stream VCI + constant stream_push_msg : msg_type_t := new_msg_type("stream push"); + constant stream_pop_msg : msg_type_t := new_msg_type("stream pop"); + + -- Reference to future stream result + alias stream_reference_t is msg_t; + + -- Push a data value to the stream + procedure push_stream ( + signal net : inout network_t; + constant stream : in stream_master_t; + constant transaction : in stream_transaction_t); + + procedure push_stream( + signal net : inout network_t; + constant stream : in stream_master_t; + constant data : in std_logic_vector; + constant last : in boolean := false); + + -- Blocking: pop a value from the stream + procedure pop_stream ( + signal net : inout network_t; + constant stream : in stream_slave_t; + variable transaction : out stream_transaction_t); + + procedure pop_stream ( + signal net : inout network_t; + constant stream : in stream_slave_t; + variable data : out std_logic_vector; + variable last : out boolean); + + procedure pop_stream ( + signal net : inout network_t; + constant stream : in stream_slave_t; + variable data : out std_logic_vector); + + -- Non-blocking: pop a value from the stream to be read in the future + procedure pop_stream ( + signal net : inout network_t; + constant stream : in stream_slave_t; + variable reference : inout stream_reference_t); + + -- Blocking: Wait for reply to non-blocking pop + procedure await_pop_stream_reply ( + signal net : inout network_t; + variable reference : inout stream_reference_t; + variable transaction : out stream_transaction_t); + + procedure await_pop_stream_reply ( + signal net : inout network_t; + variable reference : inout stream_reference_t; + variable data : out std_logic_vector; + variable last : out boolean); + + procedure await_pop_stream_reply ( + signal net : inout network_t; + variable reference : inout stream_reference_t; + variable data : out std_logic_vector); + + -- Blocking: read stream and check result against expected value + procedure check_stream ( + signal net : inout network_t; + constant stream : in stream_slave_t; + constant expected : in stream_transaction_t; + constant msg : in string := ""); + + procedure check_stream ( + signal net : inout network_t; + constant stream : in stream_slave_t; + constant expected_data : in std_logic_vector; + constant expected_last : in boolean := false; + constant msg : in string := ""); + + -- Overload sync functions + procedure wait_until_idle ( + signal net : inout network_t; + constant stream : in stream_master_t); + + procedure wait_until_idle ( + signal net : inout network_t; + constant stream : in stream_slave_t); + + procedure wait_for_time ( + signal net : inout network_t; + constant stream : in stream_master_t; + constant delay : in delay_length); + + procedure wait_for_time ( + signal net : inout network_t; + constant stream : in stream_slave_t; + constant delay : in delay_length); + + -- Overload com funtions + procedure receive ( + signal net : inout network_t; + constant stream : in stream_master_t; + variable msg : out msg_t); + + procedure receive ( + signal net : inout network_t; + constant stream : in stream_slave_t; + variable msg : out msg_t); + + -- Receive a value pushed to a stream while also handling sync messages + procedure receive_stream ( + signal net : inout network_t; + constant stream : in stream_master_t; + variable transaction : out stream_transaction_t); + + procedure receive_stream ( + signal net : inout network_t; + constant stream : in stream_master_t; + variable data : out std_ulogic_vector; + variable last : out boolean); + + procedure receive_stream ( + signal net : inout network_t; + constant stream : in stream_master_t; + variable data : out std_ulogic_vector); + + -- Receive a stream pop request while also handling sync messages + procedure receive_stream ( + signal net : inout network_t; + constant stream : in stream_slave_t; + variable msg : out msg_t); + + -- Reply to a stream pop request + procedure reply_stream ( + signal net : inout network_t; + variable msg : inout msg_t; + constant transaction : in stream_transaction_t); + + procedure reply_stream ( + signal net : inout network_t; + variable msg : inout msg_t; + constant data : in std_ulogic_vector; + constant last : in boolean := false); + +end package; + diff --git a/vunit/vhdl/verification_components/src/stream_slave_pkg-body.vhd b/vunit/vhdl/verification_components/src/stream_slave_pkg-body.vhd deleted file mode 100644 index 10f0862ad..000000000 --- a/vunit/vhdl/verification_components/src/stream_slave_pkg-body.vhd +++ /dev/null @@ -1,76 +0,0 @@ --- This Source Code Form is subject to the terms of the Mozilla Public --- License, v. 2.0. If a copy of the MPL was not distributed with this file, --- You can obtain one at http://mozilla.org/MPL/2.0/. --- --- Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com - -package body stream_slave_pkg is - impure function new_stream_slave return stream_slave_t is - begin - return (p_actor => new_actor); - end; - - procedure pop_stream(signal net : inout network_t; - stream : stream_slave_t; - variable reference : inout stream_reference_t) is - begin - reference := new_msg(stream_pop_msg); - send(net, stream.p_actor, reference); - end; - - procedure await_pop_stream_reply(signal net : inout network_t; - variable reference : inout stream_reference_t; - variable data : out std_logic_vector; - variable last : out boolean) is - variable reply_msg : msg_t; - begin - receive_reply(net, reference, reply_msg); - data := pop_std_ulogic_vector(reply_msg); - last := pop_boolean(reply_msg); - delete(reference); - delete(reply_msg); - end; - - procedure await_pop_stream_reply(signal net : inout network_t; - variable reference : inout stream_reference_t; - variable data : out std_logic_vector) is - variable reply_msg : msg_t; - begin - receive_reply(net, reference, reply_msg); - data := pop_std_ulogic_vector(reply_msg); - delete(reference); - delete(reply_msg); - end; - - procedure pop_stream(signal net : inout network_t; - stream : stream_slave_t; - variable data : out std_logic_vector; - variable last : out boolean) is - variable reference : stream_reference_t; - begin - pop_stream(net, stream, reference); - await_pop_stream_reply(net, reference, data, last); - end; - - procedure pop_stream(signal net : inout network_t; - stream : stream_slave_t; - variable data : out std_logic_vector) is - variable reference : stream_reference_t; - begin - pop_stream(net, stream, reference); - await_pop_stream_reply(net, reference, data); - end; - - procedure check_stream(signal net : inout network_t; - stream : stream_slave_t; - expected : std_logic_vector; - last : boolean := false; - msg : string := "") is - variable got_data : std_logic_vector(expected'range); - variable got_last : boolean; - begin - pop_stream(net, stream, got_data, got_last); - check_equal(got_data, expected, msg); - check_equal(got_last, last, msg); - end procedure; -end package body; diff --git a/vunit/vhdl/verification_components/src/stream_slave_pkg.vhd b/vunit/vhdl/verification_components/src/stream_slave_pkg.vhd deleted file mode 100644 index 66f001fcb..000000000 --- a/vunit/vhdl/verification_components/src/stream_slave_pkg.vhd +++ /dev/null @@ -1,61 +0,0 @@ --- This Source Code Form is subject to the terms of the Mozilla Public --- License, v. 2.0. If a copy of the MPL was not distributed with this file, --- You can obtain one at http://mozilla.org/MPL/2.0/. --- --- Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com - --- Stream slave verification component interface - -library ieee; -use ieee.std_logic_1164.all; - -context work.vunit_context; -context work.com_context; - -package stream_slave_pkg is - -- Stream slave handle - type stream_slave_t is record - p_actor : actor_t; - end record; - - -- Create a new stream slave object - impure function new_stream_slave return stream_slave_t; - - -- Reference to future stream result - alias stream_reference_t is msg_t; - - -- Blocking: pop a value from the stream - procedure pop_stream(signal net : inout network_t; - stream : stream_slave_t; - variable data : out std_logic_vector; - variable last : out boolean); - - procedure pop_stream(signal net : inout network_t; - stream : stream_slave_t; - variable data : out std_logic_vector); - - -- Non-blocking: pop a value from the stream to be read in the future - procedure pop_stream(signal net : inout network_t; - stream : stream_slave_t; - variable reference : inout stream_reference_t); - - -- Blocking: Wait for reply to non-blocking pop - procedure await_pop_stream_reply(signal net : inout network_t; - variable reference : inout stream_reference_t; - variable data : out std_logic_vector; - variable last : out boolean); - - procedure await_pop_stream_reply(signal net : inout network_t; - variable reference : inout stream_reference_t; - variable data : out std_logic_vector); - - -- Blocking: read stream and check result against expected value - procedure check_stream(signal net : inout network_t; - stream : stream_slave_t; - expected : std_logic_vector; - last : boolean := false; - msg : string := ""); - - -- Message type definitions used by VC implementing stream slave VCI - constant stream_pop_msg : msg_type_t := new_msg_type("stream pop"); -end package; diff --git a/vunit/vhdl/verification_components/src/uart_master.vhd b/vunit/vhdl/verification_components/src/uart_master.vhd index ef9da5e09..c9b01acda 100644 --- a/vunit/vhdl/verification_components/src/uart_master.vhd +++ b/vunit/vhdl/verification_components/src/uart_master.vhd @@ -10,7 +10,7 @@ use ieee.std_logic_1164.all; library vunit_lib; context vunit_lib.vunit_context; context vunit_lib.com_context; -use vunit_lib.stream_master_pkg.all; +use vunit_lib.stream_pkg.all; use vunit_lib.uart_pkg.all; use vunit_lib.queue_pkg.all; use vunit_lib.sync_pkg.all; @@ -30,6 +30,7 @@ begin signal tx : out std_logic; baud_rate : integer) is constant time_per_bit : time := (10**9 / baud_rate) * 1 ns; + variable normalized_data : std_logic_vector(data'length - 1 downto 0) := data; procedure send_bit(value : std_logic) is begin @@ -38,10 +39,10 @@ begin end procedure; begin - debug("Sending " & to_string(data)); + debug("Sending " & to_string(normalized_data)); send_bit(not uart.p_idle_state); - for i in 0 to data'length-1 loop - send_bit(data(i)); + for i in 0 to normalized_data'length - 1 loop + send_bit(normalized_data(i)); end loop; send_bit(uart.p_idle_state); end procedure; diff --git a/vunit/vhdl/verification_components/src/uart_pkg.vhd b/vunit/vhdl/verification_components/src/uart_pkg.vhd index 3cb944115..485b7b2c8 100644 --- a/vunit/vhdl/verification_components/src/uart_pkg.vhd +++ b/vunit/vhdl/verification_components/src/uart_pkg.vhd @@ -8,8 +8,7 @@ library ieee; use ieee.std_logic_1164.all; context work.com_context; -use work.stream_master_pkg.all; -use work.stream_slave_pkg.all; +use work.stream_pkg.all; use work.sync_pkg.all; use work.integer_vector_ptr_pkg.all; use work.queue_pkg.all; diff --git a/vunit/vhdl/verification_components/src/uart_slave.vhd b/vunit/vhdl/verification_components/src/uart_slave.vhd index 062c61fbf..aea87796f 100644 --- a/vunit/vhdl/verification_components/src/uart_slave.vhd +++ b/vunit/vhdl/verification_components/src/uart_slave.vhd @@ -10,7 +10,7 @@ use ieee.std_logic_1164.all; library vunit_lib; context vunit_lib.vunit_context; context vunit_lib.com_context; -use vunit_lib.stream_slave_pkg.all; +use vunit_lib.stream_pkg.all; use vunit_lib.uart_pkg.all; use vunit_lib.queue_pkg.all; diff --git a/vunit/vhdl/verification_components/src/vc_context.vhd b/vunit/vhdl/verification_components/src/vc_context.vhd index 3ea436584..118ca7ce5 100644 --- a/vunit/vhdl/verification_components/src/vc_context.vhd +++ b/vunit/vhdl/verification_components/src/vc_context.vhd @@ -15,8 +15,7 @@ context vc_context is use vunit_lib.axi_stream_pkg.all; use vunit_lib.memory_pkg.all; use vunit_lib.memory_utils_pkg.all; - use vunit_lib.stream_master_pkg.all; - use vunit_lib.stream_slave_pkg.all; + use vunit_lib.stream_pkg.all; use vunit_lib.sync_pkg.all; use vunit_lib.uart_pkg.all; use vunit_lib.wishbone_pkg.all; diff --git a/vunit/vhdl/verification_components/test/tb_avalon_stream.vhd b/vunit/vhdl/verification_components/test/tb_avalon_stream.vhd index 66878c864..9aa260aaf 100644 --- a/vunit/vhdl/verification_components/test/tb_avalon_stream.vhd +++ b/vunit/vhdl/verification_components/test/tb_avalon_stream.vhd @@ -13,8 +13,7 @@ context work.vunit_context; context work.com_context; context work.data_types_context; use work.avalon_stream_pkg.all; -use work.stream_master_pkg.all; -use work.stream_slave_pkg.all; +use work.stream_pkg.all; entity tb_avalon_stream is generic (runner_cfg : string); diff --git a/vunit/vhdl/verification_components/test/tb_avalon_stream_pkg.vhd b/vunit/vhdl/verification_components/test/tb_avalon_stream_pkg.vhd index 382e45ae8..284d01da1 100644 --- a/vunit/vhdl/verification_components/test/tb_avalon_stream_pkg.vhd +++ b/vunit/vhdl/verification_components/test/tb_avalon_stream_pkg.vhd @@ -13,8 +13,7 @@ context work.vunit_context; context work.com_context; context work.data_types_context; use work.avalon_stream_pkg.all; -use work.stream_master_pkg.all; -use work.stream_slave_pkg.all; +use work.stream_pkg.all; entity tb_avalon_stream_pkg is generic (runner_cfg : string); diff --git a/vunit/vhdl/verification_components/test/tb_axi_stream.vhd b/vunit/vhdl/verification_components/test/tb_axi_stream.vhd index a52de31d0..e998dd1ee 100644 --- a/vunit/vhdl/verification_components/test/tb_axi_stream.vhd +++ b/vunit/vhdl/verification_components/test/tb_axi_stream.vhd @@ -12,8 +12,7 @@ context work.vunit_context; context work.com_context; context work.data_types_context; use work.axi_stream_pkg.all; -use work.stream_master_pkg.all; -use work.stream_slave_pkg.all; +use work.stream_pkg.all; use work.sync_pkg.all; entity tb_axi_stream is diff --git a/vunit/vhdl/verification_components/test/tb_axi_stream_protocol_checker.vhd b/vunit/vhdl/verification_components/test/tb_axi_stream_protocol_checker.vhd index bfd3fe8c7..79626df03 100644 --- a/vunit/vhdl/verification_components/test/tb_axi_stream_protocol_checker.vhd +++ b/vunit/vhdl/verification_components/test/tb_axi_stream_protocol_checker.vhd @@ -12,8 +12,7 @@ context work.vunit_context; context work.com_context; context work.data_types_context; use work.axi_stream_pkg.all; -use work.stream_master_pkg.all; -use work.stream_slave_pkg.all; +use work.stream_pkg.all; use work.runner_pkg.all; entity tb_axi_stream_protocol_checker is diff --git a/vunit/vhdl/verification_components/test/tb_stream_pkg.vhd b/vunit/vhdl/verification_components/test/tb_stream_pkg.vhd new file mode 100644 index 000000000..ec1842485 --- /dev/null +++ b/vunit/vhdl/verification_components/test/tb_stream_pkg.vhd @@ -0,0 +1,38 @@ +-- This Source Code Form is subject to the terms of the Mozilla Public +-- License, v. 2.0. If a copy of the MPL was not distributed with this file, +-- You can obtain one at http://mozilla.org/MPL/2.0/. +-- +-- Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com + +library ieee; +use ieee.std_logic_1164.all; + +context work.vunit_context; +context work.com_context; +use work.stream_pkg.all; + +entity tb_stream_pkg is + generic(runner_cfg : string); +end entity; + +architecture tb of tb_stream_pkg is + +begin + + process + begin + test_runner_setup(runner, runner_cfg); + + while test_suite loop + if run("empty") then + + end if; + end loop; + + test_runner_cleanup(runner); + end process; + + test_runner_watchdog(runner, 10 ms); + +end architecture; + diff --git a/vunit/vhdl/verification_components/test/tb_uart.vhd b/vunit/vhdl/verification_components/test/tb_uart.vhd index ca3f3a389..81d9c1432 100644 --- a/vunit/vhdl/verification_components/test/tb_uart.vhd +++ b/vunit/vhdl/verification_components/test/tb_uart.vhd @@ -13,8 +13,7 @@ context work.com_context; context work.data_types_context; use work.uart_pkg.all; use work.sync_pkg.all; -use work.stream_master_pkg.all; -use work.stream_slave_pkg.all; +use work.stream_pkg.all; entity tb_uart is generic (runner_cfg : string);