From b60d0764d5fe642f69b4ebf9081cb7ced58656d1 Mon Sep 17 00:00:00 2001 From: Bradley Harden Date: Tue, 11 Jun 2019 14:03:16 -0400 Subject: [PATCH 01/10] Merge stream VCI files --- .../src/stream_pkg-body.vhd | 102 ++++++++++++++++++ .../src/stream_pkg.vhd | 80 ++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 vunit/vhdl/verification_components/src/stream_pkg-body.vhd create mode 100644 vunit/vhdl/verification_components/src/stream_pkg.vhd 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..b0205dbd5 --- /dev/null +++ b/vunit/vhdl/verification_components/src/stream_pkg-body.vhd @@ -0,0 +1,102 @@ +-- 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; + + 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_pkg.vhd b/vunit/vhdl/verification_components/src/stream_pkg.vhd new file mode 100644 index 000000000..92a507a76 --- /dev/null +++ b/vunit/vhdl/verification_components/src/stream_pkg.vhd @@ -0,0 +1,80 @@ +-- 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; + + -- 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; + + -- Message type definitions used by VC implementing stream master VCI + constant stream_push_msg : msg_type_t := new_msg_type("stream push"); + + -- Message type definitions used by VC implementing stream slave VCI + 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; + stream : stream_master_t; + data : std_logic_vector; + last : boolean := false); + + -- 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 := ""); + +end package; From 0795b2bf6d823d504aa20740e66327a9ee4d2acd Mon Sep 17 00:00:00 2001 From: Bradley Harden Date: Tue, 11 Jun 2019 14:43:27 -0400 Subject: [PATCH 02/10] Modify stream_pkg to better show history --- .../verification_components/src/stream_pkg-body.vhd | 12 ++++++------ .../vhdl/verification_components/src/stream_pkg.vhd | 4 +--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/vunit/vhdl/verification_components/src/stream_pkg-body.vhd b/vunit/vhdl/verification_components/src/stream_pkg-body.vhd index b0205dbd5..76aab1535 100644 --- a/vunit/vhdl/verification_components/src/stream_pkg-body.vhd +++ b/vunit/vhdl/verification_components/src/stream_pkg-body.vhd @@ -10,13 +10,18 @@ use ieee.std_logic_1164.all; context work.vunit_context; context work.com_context; -package body stream_master_pkg is +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; + procedure push_stream(signal net : inout network_t; stream : stream_master_t; data : std_logic_vector; @@ -29,11 +34,6 @@ package body stream_master_pkg is send(net, stream.p_actor, msg); end; - 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 diff --git a/vunit/vhdl/verification_components/src/stream_pkg.vhd b/vunit/vhdl/verification_components/src/stream_pkg.vhd index 92a507a76..9705a92a6 100644 --- a/vunit/vhdl/verification_components/src/stream_pkg.vhd +++ b/vunit/vhdl/verification_components/src/stream_pkg.vhd @@ -12,7 +12,7 @@ use ieee.std_logic_1164.all; context work.vunit_context; context work.com_context; -package stream_master_pkg is +package stream_pkg is -- Stream master handle type stream_master_t is record @@ -32,8 +32,6 @@ package stream_master_pkg is -- Message type definitions used by VC implementing stream master VCI constant stream_push_msg : msg_type_t := new_msg_type("stream push"); - - -- Message type definitions used by VC implementing stream slave VCI constant stream_pop_msg : msg_type_t := new_msg_type("stream pop"); -- Reference to future stream result From 2afaa7a62fb822a9cbb6dd62f6684191e05a3e94 Mon Sep 17 00:00:00 2001 From: Bradley Harden Date: Sun, 21 Oct 2018 18:21:22 -0400 Subject: [PATCH 03/10] Temp commit to transfer files. Bug in GHDL prevents debugging. Separate pkg and body; Add overloaded functions --- .../src/avalon_sink.vhd | 2 +- .../src/avalon_source.vhd | 2 +- .../src/avalon_stream_pkg.vhd | 4 +- .../src/axi_stream_master.vhd | 2 +- .../src/axi_stream_pkg.vhd | 4 +- .../src/axi_stream_slave.vhd | 2 +- .../src/stream_master_pkg-body.vhd | 31 --- .../src/stream_master_pkg.vhd | 32 --- .../src/stream_pkg-body.vhd | 220 ++++++++++++++++-- .../src/stream_pkg.vhd | 101 +++++++- .../src/stream_slave_pkg-body.vhd | 76 ------ .../src/stream_slave_pkg.vhd | 61 ----- .../src/uart_master.vhd | 2 +- .../verification_components/src/uart_pkg.vhd | 4 +- .../src/uart_slave.vhd | 2 +- .../src/vc_context.vhd | 3 +- .../test/tb_avalon_stream.vhd | 4 +- .../test/tb_avalon_stream_pkg.vhd | 4 +- .../test/tb_axi_stream.vhd | 4 +- .../test/tb_axi_stream_protocol_checker.vhd | 4 +- .../test/tb_stream_pkg.vhd | 32 +++ .../verification_components/test/tb_uart.vhd | 4 +- 22 files changed, 348 insertions(+), 252 deletions(-) delete mode 100644 vunit/vhdl/verification_components/src/stream_master_pkg-body.vhd delete mode 100644 vunit/vhdl/verification_components/src/stream_master_pkg.vhd delete mode 100644 vunit/vhdl/verification_components/src/stream_slave_pkg-body.vhd delete mode 100644 vunit/vhdl/verification_components/src/stream_slave_pkg.vhd create mode 100644 vunit/vhdl/verification_components/test/tb_stream_pkg.vhd diff --git a/vunit/vhdl/verification_components/src/avalon_sink.vhd b/vunit/vhdl/verification_components/src/avalon_sink.vhd index 099d111f1..75ff4034a 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; 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..c304f1a75 100644 --- a/vunit/vhdl/verification_components/src/avalon_stream_pkg.vhd +++ b/vunit/vhdl/verification_components/src/avalon_stream_pkg.vhd @@ -8,8 +8,8 @@ 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; +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..a43ff04cc 100644 --- a/vunit/vhdl/verification_components/src/axi_stream_pkg.vhd +++ b/vunit/vhdl/verification_components/src/axi_stream_pkg.vhd @@ -10,8 +10,8 @@ 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.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 index 76aab1535..9e2361fbd 100644 --- a/vunit/vhdl/verification_components/src/stream_pkg-body.vhd +++ b/vunit/vhdl/verification_components/src/stream_pkg-body.vhd @@ -2,16 +2,18 @@ -- 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 +-- Copyright (c) 2014-2018, Lars Asplund lars.anders.asplund@gmail.com + +-- Stream master & slave verification components 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); @@ -22,18 +24,37 @@ package body stream_pkg is return (p_actor => new_actor); 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; stream : stream_master_t; - data : std_logic_vector; - last : boolean := false) is + transaction : stream_transaction_t) 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); + push_stream_transaction(msg, transaction); send(net, stream.p_actor, msg); end; + procedure push_stream(signal net : inout network_t; + stream : stream_master_t; + data : std_logic_vector; + last : 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; stream : stream_slave_t; variable reference : inout stream_reference_t) is @@ -44,26 +65,42 @@ package body stream_pkg is 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 : out stream_transaction_t) 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); + 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 reply_msg : msg_t; + variable transaction : stream_transaction_t(data(data'range)); begin - receive_reply(net, reference, reply_msg); - data := pop_std_ulogic_vector(reply_msg); - delete(reference); - delete(reply_msg); + await_pop_stream_reply(net, reference, transaction); + data := transaction.data; + end; + + procedure pop_stream(signal net : inout network_t; + stream : 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; @@ -87,16 +124,153 @@ package body stream_pkg is procedure check_stream(signal net : inout network_t; stream : stream_slave_t; - expected : std_logic_vector; - last : boolean := false; + expected : stream_transaction_t; msg : string := "") is - variable got_data : std_logic_vector(expected'range); - variable got_last : boolean; + variable got : stream_transaction_t(data(expected.data'range)); begin - pop_stream(net, stream, got_data, got_last); - check_equal(got_data, expected, msg); - check_equal(got_last, last, msg); + 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; + stream : stream_slave_t; + expected_data : std_logic_vector; + expected_last : boolean := false; + msg : 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; + stream : stream_master_t) is + begin + wait_until_idle(net, stream.p_actor); end procedure; + procedure wait_until_idle(signal net : inout network_t; + stream : stream_slave_t) is + begin + wait_until_idle(net, stream.p_actor); + end procedure; + + procedure wait_for_time(signal net : inout network_t; + stream : stream_master_t; + delay : delay_length) is + begin + wait_for_time(net, stream.p_actor, delay); + end procedure; + + procedure wait_for_time(signal net : inout network_t; + stream : stream_slave_t; + delay : delay_length) is + begin + wait_for_time(net, stream.p_actor, delay); + end procedure; + + procedure receive(signal net : inout network_t; + stream : 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; + stream : 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; + stream : 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; + stream : 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; + stream : 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; + stream : 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; + transaction : 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; + data : std_ulogic_vector; + last : boolean) is + variable transaction : stream_transaction_t(data(data'range)); + begin + transaction.data := data; + transaction.last := last; + reply_stream(net, msg, transaction); + end; + + procedure reply_stream(signal net : inout network_t; + variable msg : inout msg_t; + data : std_ulogic_vector) is + variable transaction : stream_transaction_t(data(data'range)); + begin + transaction.data := data; + 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 index 9705a92a6..971370ea1 100644 --- a/vunit/vhdl/verification_components/src/stream_pkg.vhd +++ b/vunit/vhdl/verification_components/src/stream_pkg.vhd @@ -2,9 +2,9 @@ -- 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 +-- Copyright (c) 2014-2018, Lars Asplund lars.anders.asplund@gmail.com --- Stream master verification component interface +-- Stream master & slave verification component interfaces library ieee; use ieee.std_logic_1164.all; @@ -30,7 +30,23 @@ package stream_pkg is -- Create a new stream slave object impure function new_stream_slave return stream_slave_t; - -- Message type definitions used by VC implementing stream master VCI + -- Encapsulate a stream transaction + type stream_transaction_t is record + data : std_ulogic_vector; + last : boolean; + end record; + + -- 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"); @@ -38,12 +54,20 @@ package stream_pkg is alias stream_reference_t is msg_t; -- Push a data value to the stream + procedure push_stream(signal net : inout network_t; + stream : stream_master_t; + transaction : stream_transaction_t); + procedure push_stream(signal net : inout network_t; stream : stream_master_t; data : std_logic_vector; last : boolean := false); -- Blocking: pop a value from the stream + procedure pop_stream(signal net : inout network_t; + stream : stream_slave_t; + variable transaction : out stream_transaction_t); + procedure pop_stream(signal net : inout network_t; stream : stream_slave_t; variable data : out std_logic_vector; @@ -59,6 +83,10 @@ package stream_pkg is 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; @@ -71,8 +99,71 @@ package stream_pkg is -- 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; + expected : stream_transaction_t; + msg : string := ""); + + procedure check_stream(signal net : inout network_t; + stream : stream_slave_t; + expected_data : std_logic_vector; + expected_last : boolean := false; msg : string := ""); + -- Overload sync functions + procedure wait_until_idle(signal net : inout network_t; + stream : stream_master_t); + + procedure wait_until_idle(signal net : inout network_t; + stream : stream_slave_t); + + procedure wait_for_time(signal net : inout network_t; + stream : stream_master_t; + delay : delay_length); + + procedure wait_for_time(signal net : inout network_t; + stream : stream_slave_t; + delay : delay_length); + + -- Overload com funtions + procedure receive(signal net : inout network_t; + stream : stream_master_t; + variable msg : out msg_t); + + procedure receive(signal net : inout network_t; + stream : stream_slave_t; + variable msg : out msg_t); + + -- Receive a value pushed to a stream with syncing + procedure receive_stream(signal net : inout network_t; + stream : stream_master_t; + variable transaction : out stream_transaction_t); + + procedure receive_stream(signal net : inout network_t; + stream : stream_master_t; + variable data : out std_ulogic_vector; + variable last : out boolean); + + procedure receive_stream(signal net : inout network_t; + stream : stream_master_t; + variable data : out std_ulogic_vector); + + -- Receive a stream pop request with syncing + procedure receive_stream(signal net : inout network_t; + stream : 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; + transaction : stream_transaction_t); + + procedure reply_stream(signal net : inout network_t; + variable msg : inout msg_t; + data : std_ulogic_vector; + last : boolean); + + procedure reply_stream(signal net : inout network_t; + variable msg : inout msg_t; + data : std_ulogic_vector); + 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..6141f60b1 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; diff --git a/vunit/vhdl/verification_components/src/uart_pkg.vhd b/vunit/vhdl/verification_components/src/uart_pkg.vhd index 3cb944115..c9827f515 100644 --- a/vunit/vhdl/verification_components/src/uart_pkg.vhd +++ b/vunit/vhdl/verification_components/src/uart_pkg.vhd @@ -8,8 +8,8 @@ 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.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..6e6b0ca13 100644 --- a/vunit/vhdl/verification_components/test/tb_avalon_stream.vhd +++ b/vunit/vhdl/verification_components/test/tb_avalon_stream.vhd @@ -13,8 +13,8 @@ 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; +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..9e6f6ac86 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,8 @@ 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; +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..9c2c414e0 100644 --- a/vunit/vhdl/verification_components/test/tb_axi_stream.vhd +++ b/vunit/vhdl/verification_components/test/tb_axi_stream.vhd @@ -12,8 +12,8 @@ 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.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..d20b4dfbd 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,8 @@ 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.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..2e05d6171 --- /dev/null +++ b/vunit/vhdl/verification_components/test/tb_stream_pkg.vhd @@ -0,0 +1,32 @@ +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("") 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..4a0e0e9bc 100644 --- a/vunit/vhdl/verification_components/test/tb_uart.vhd +++ b/vunit/vhdl/verification_components/test/tb_uart.vhd @@ -13,8 +13,8 @@ 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; +use work.stream_pkg.all; entity tb_uart is generic (runner_cfg : string); From d95eaa8f4f87b5ffec3c339c9418217d30c1a944 Mon Sep 17 00:00:00 2001 From: Bradley Harden Date: Sat, 18 May 2019 19:18:20 -0400 Subject: [PATCH 04/10] Make minor changes to functions --- .../src/stream_pkg-body.vhd | 24 ++++++++++--------- .../src/stream_pkg.vhd | 11 +++++---- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/vunit/vhdl/verification_components/src/stream_pkg-body.vhd b/vunit/vhdl/verification_components/src/stream_pkg-body.vhd index 9e2361fbd..ea23388a3 100644 --- a/vunit/vhdl/verification_components/src/stream_pkg-body.vhd +++ b/vunit/vhdl/verification_components/src/stream_pkg-body.vhd @@ -24,9 +24,20 @@ package body stream_pkg is 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 + variable normalized_data : std_logic_vector(transaction.data'length - 1 downto 0) := transaction.data; begin - push_std_ulogic_vector(msg, transaction.data); + push_std_ulogic_vector(msg, normalized_data); push_boolean(msg, transaction.last); end; @@ -255,7 +266,7 @@ package body stream_pkg is procedure reply_stream(signal net : inout network_t; variable msg : inout msg_t; data : std_ulogic_vector; - last : boolean) is + last : boolean := false) is variable transaction : stream_transaction_t(data(data'range)); begin transaction.data := data; @@ -263,14 +274,5 @@ package body stream_pkg is reply_stream(net, msg, transaction); end; - procedure reply_stream(signal net : inout network_t; - variable msg : inout msg_t; - data : std_ulogic_vector) is - variable transaction : stream_transaction_t(data(data'range)); - begin - transaction.data := data; - 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 index 971370ea1..67721045c 100644 --- a/vunit/vhdl/verification_components/src/stream_pkg.vhd +++ b/vunit/vhdl/verification_components/src/stream_pkg.vhd @@ -36,6 +36,11 @@ package stream_pkg is 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); @@ -159,11 +164,7 @@ package stream_pkg is procedure reply_stream(signal net : inout network_t; variable msg : inout msg_t; data : std_ulogic_vector; - last : boolean); - - procedure reply_stream(signal net : inout network_t; - variable msg : inout msg_t; - data : std_ulogic_vector); + last : boolean := false); end package; From ca7801a307f4d58a6890ac8bbd418604c423118c Mon Sep 17 00:00:00 2001 From: Bradley Harden Date: Sat, 18 May 2019 19:18:49 -0400 Subject: [PATCH 05/10] Fix issue with avalon_sink --- vunit/vhdl/verification_components/src/avalon_sink.vhd | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vunit/vhdl/verification_components/src/avalon_sink.vhd b/vunit/vhdl/verification_components/src/avalon_sink.vhd index 75ff4034a..a2c2a99a5 100644 --- a/vunit/vhdl/verification_components/src/avalon_sink.vhd +++ b/vunit/vhdl/verification_components/src/avalon_sink.vhd @@ -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'; From a1cdbf2e93e2a6e98b3417e31bdd7717991358ba Mon Sep 17 00:00:00 2001 From: Bradley Harden Date: Mon, 27 May 2019 17:55:44 -0400 Subject: [PATCH 06/10] Fix normalization problem with uart_master --- vunit/vhdl/verification_components/src/stream_pkg-body.vhd | 4 ++-- vunit/vhdl/verification_components/src/stream_pkg.vhd | 4 ++-- vunit/vhdl/verification_components/src/uart_master.vhd | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/vunit/vhdl/verification_components/src/stream_pkg-body.vhd b/vunit/vhdl/verification_components/src/stream_pkg-body.vhd index ea23388a3..e0e17c1a8 100644 --- a/vunit/vhdl/verification_components/src/stream_pkg-body.vhd +++ b/vunit/vhdl/verification_components/src/stream_pkg-body.vhd @@ -14,6 +14,7 @@ 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); @@ -35,9 +36,8 @@ package body stream_pkg is end; procedure push(msg : msg_t; transaction : stream_transaction_t) is - variable normalized_data : std_logic_vector(transaction.data'length - 1 downto 0) := transaction.data; begin - push_std_ulogic_vector(msg, normalized_data); + push_std_ulogic_vector(msg, transaction.data); push_boolean(msg, transaction.last); end; diff --git a/vunit/vhdl/verification_components/src/stream_pkg.vhd b/vunit/vhdl/verification_components/src/stream_pkg.vhd index 67721045c..e31bd06e3 100644 --- a/vunit/vhdl/verification_components/src/stream_pkg.vhd +++ b/vunit/vhdl/verification_components/src/stream_pkg.vhd @@ -137,7 +137,7 @@ package stream_pkg is stream : stream_slave_t; variable msg : out msg_t); - -- Receive a value pushed to a stream with syncing + -- Receive a value pushed to a stream while also handling sync messages procedure receive_stream(signal net : inout network_t; stream : stream_master_t; variable transaction : out stream_transaction_t); @@ -151,7 +151,7 @@ package stream_pkg is stream : stream_master_t; variable data : out std_ulogic_vector); - -- Receive a stream pop request with syncing + -- Receive a stream pop request while also handling sync messages procedure receive_stream(signal net : inout network_t; stream : stream_slave_t; variable msg : out msg_t); diff --git a/vunit/vhdl/verification_components/src/uart_master.vhd b/vunit/vhdl/verification_components/src/uart_master.vhd index 6141f60b1..c9b01acda 100644 --- a/vunit/vhdl/verification_components/src/uart_master.vhd +++ b/vunit/vhdl/verification_components/src/uart_master.vhd @@ -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; From f015f89036016716b163267b965dd74d0338e62b Mon Sep 17 00:00:00 2001 From: Bradley Harden Date: Mon, 10 Jun 2019 17:11:39 -0400 Subject: [PATCH 07/10] Remove duplicate stream_pkg use statements --- vunit/vhdl/verification_components/src/avalon_stream_pkg.vhd | 1 - vunit/vhdl/verification_components/src/axi_stream_pkg.vhd | 1 - vunit/vhdl/verification_components/src/uart_pkg.vhd | 1 - vunit/vhdl/verification_components/test/tb_avalon_stream.vhd | 1 - vunit/vhdl/verification_components/test/tb_avalon_stream_pkg.vhd | 1 - vunit/vhdl/verification_components/test/tb_axi_stream.vhd | 1 - .../test/tb_axi_stream_protocol_checker.vhd | 1 - vunit/vhdl/verification_components/test/tb_uart.vhd | 1 - 8 files changed, 8 deletions(-) diff --git a/vunit/vhdl/verification_components/src/avalon_stream_pkg.vhd b/vunit/vhdl/verification_components/src/avalon_stream_pkg.vhd index c304f1a75..432427c5c 100644 --- a/vunit/vhdl/verification_components/src/avalon_stream_pkg.vhd +++ b/vunit/vhdl/verification_components/src/avalon_stream_pkg.vhd @@ -9,7 +9,6 @@ use ieee.std_logic_1164.all; use work.logger_pkg.all; use work.stream_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_pkg.vhd b/vunit/vhdl/verification_components/src/axi_stream_pkg.vhd index a43ff04cc..5758aa3ec 100644 --- a/vunit/vhdl/verification_components/src/axi_stream_pkg.vhd +++ b/vunit/vhdl/verification_components/src/axi_stream_pkg.vhd @@ -11,7 +11,6 @@ use work.logger_pkg.all; use work.checker_pkg.all; use work.check_pkg.all; use work.stream_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/uart_pkg.vhd b/vunit/vhdl/verification_components/src/uart_pkg.vhd index c9827f515..485b7b2c8 100644 --- a/vunit/vhdl/verification_components/src/uart_pkg.vhd +++ b/vunit/vhdl/verification_components/src/uart_pkg.vhd @@ -9,7 +9,6 @@ use ieee.std_logic_1164.all; context work.com_context; use work.stream_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/test/tb_avalon_stream.vhd b/vunit/vhdl/verification_components/test/tb_avalon_stream.vhd index 6e6b0ca13..9aa260aaf 100644 --- a/vunit/vhdl/verification_components/test/tb_avalon_stream.vhd +++ b/vunit/vhdl/verification_components/test/tb_avalon_stream.vhd @@ -14,7 +14,6 @@ context work.com_context; context work.data_types_context; use work.avalon_stream_pkg.all; use work.stream_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 9e6f6ac86..284d01da1 100644 --- a/vunit/vhdl/verification_components/test/tb_avalon_stream_pkg.vhd +++ b/vunit/vhdl/verification_components/test/tb_avalon_stream_pkg.vhd @@ -14,7 +14,6 @@ context work.com_context; context work.data_types_context; use work.avalon_stream_pkg.all; use work.stream_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 9c2c414e0..e998dd1ee 100644 --- a/vunit/vhdl/verification_components/test/tb_axi_stream.vhd +++ b/vunit/vhdl/verification_components/test/tb_axi_stream.vhd @@ -13,7 +13,6 @@ context work.com_context; context work.data_types_context; use work.axi_stream_pkg.all; use work.stream_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 d20b4dfbd..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 @@ -13,7 +13,6 @@ context work.com_context; context work.data_types_context; use work.axi_stream_pkg.all; use work.stream_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_uart.vhd b/vunit/vhdl/verification_components/test/tb_uart.vhd index 4a0e0e9bc..81d9c1432 100644 --- a/vunit/vhdl/verification_components/test/tb_uart.vhd +++ b/vunit/vhdl/verification_components/test/tb_uart.vhd @@ -14,7 +14,6 @@ context work.data_types_context; use work.uart_pkg.all; use work.sync_pkg.all; use work.stream_pkg.all; -use work.stream_pkg.all; entity tb_uart is generic (runner_cfg : string); From 3cbfdbe7650170d4396e441ba70566e59be1bfa0 Mon Sep 17 00:00:00 2001 From: Bradley Harden Date: Mon, 10 Jun 2019 17:17:51 -0400 Subject: [PATCH 08/10] Temporarily fix empty tb_stream_pkg --- vunit/vhdl/verification_components/test/tb_stream_pkg.vhd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vunit/vhdl/verification_components/test/tb_stream_pkg.vhd b/vunit/vhdl/verification_components/test/tb_stream_pkg.vhd index 2e05d6171..2ebbec107 100644 --- a/vunit/vhdl/verification_components/test/tb_stream_pkg.vhd +++ b/vunit/vhdl/verification_components/test/tb_stream_pkg.vhd @@ -18,7 +18,7 @@ begin test_runner_setup(runner, runner_cfg); while test_suite loop - if run("") then + if run("empty") then end if; end loop; From a3e5fcc1bd5b44075f4e2c571fb54fb79265e19f Mon Sep 17 00:00:00 2001 From: Bradley Harden Date: Mon, 10 Jun 2019 17:20:52 -0400 Subject: [PATCH 09/10] Update licenses --- vunit/vhdl/verification_components/src/stream_pkg-body.vhd | 2 +- vunit/vhdl/verification_components/src/stream_pkg.vhd | 2 +- vunit/vhdl/verification_components/test/tb_stream_pkg.vhd | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/vunit/vhdl/verification_components/src/stream_pkg-body.vhd b/vunit/vhdl/verification_components/src/stream_pkg-body.vhd index e0e17c1a8..4d55afa15 100644 --- a/vunit/vhdl/verification_components/src/stream_pkg-body.vhd +++ b/vunit/vhdl/verification_components/src/stream_pkg-body.vhd @@ -2,7 +2,7 @@ -- 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-2018, Lars Asplund lars.anders.asplund@gmail.com +-- Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com -- Stream master & slave verification components diff --git a/vunit/vhdl/verification_components/src/stream_pkg.vhd b/vunit/vhdl/verification_components/src/stream_pkg.vhd index e31bd06e3..c54aaace5 100644 --- a/vunit/vhdl/verification_components/src/stream_pkg.vhd +++ b/vunit/vhdl/verification_components/src/stream_pkg.vhd @@ -2,7 +2,7 @@ -- 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-2018, Lars Asplund lars.anders.asplund@gmail.com +-- Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com -- Stream master & slave verification component interfaces diff --git a/vunit/vhdl/verification_components/test/tb_stream_pkg.vhd b/vunit/vhdl/verification_components/test/tb_stream_pkg.vhd index 2ebbec107..ec1842485 100644 --- a/vunit/vhdl/verification_components/test/tb_stream_pkg.vhd +++ b/vunit/vhdl/verification_components/test/tb_stream_pkg.vhd @@ -1,3 +1,9 @@ +-- 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; From d0b87a3bbd43e76486257287cf14a6b025c42a68 Mon Sep 17 00:00:00 2001 From: Bradley Harden Date: Mon, 10 Jun 2019 18:14:24 -0400 Subject: [PATCH 10/10] Update stream_pkg style --- .../src/stream_pkg-body.vhd | 269 +++++++++++------- .../src/stream_pkg.vhd | 212 ++++++++------ 2 files changed, 285 insertions(+), 196 deletions(-) diff --git a/vunit/vhdl/verification_components/src/stream_pkg-body.vhd b/vunit/vhdl/verification_components/src/stream_pkg-body.vhd index 4d55afa15..265e03fd2 100644 --- a/vunit/vhdl/verification_components/src/stream_pkg-body.vhd +++ b/vunit/vhdl/verification_components/src/stream_pkg-body.vhd @@ -4,7 +4,7 @@ -- -- Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com --- Stream master & slave verification components +-- Stream master & slave verification component interfaces library ieee; use ieee.std_logic_1164.all; @@ -15,19 +15,25 @@ use work.sync_pkg.all; package body stream_pkg is - impure function new_stream_master return stream_master_t 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 + 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 + 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; @@ -35,30 +41,41 @@ package body stream_pkg is return transaction; end; - procedure push(msg : msg_t; transaction : stream_transaction_t) is + 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 + impure function pop ( + msg : msg_t) + return stream_transaction_t + is begin - return (data => pop_std_ulogic_vector(msg), last => pop_boolean(msg)); + return (data => pop_std_ulogic_vector(msg), + last => pop_boolean(msg)); end; - procedure push_stream(signal net : inout network_t; - stream : stream_master_t; - transaction : stream_transaction_t) is + 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; - stream : stream_master_t; - data : std_logic_vector; - last : boolean := false) is + 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; @@ -66,17 +83,55 @@ package body stream_pkg is push_stream(net, stream, transaction); end; - procedure pop_stream(signal net : inout network_t; - stream : stream_slave_t; - variable reference : inout stream_reference_t) is + 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 + 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); @@ -85,10 +140,12 @@ package body stream_pkg is 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 + 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); @@ -96,47 +153,23 @@ package body stream_pkg is 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 + 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 pop_stream(signal net : inout network_t; - stream : 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; - 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 : stream_transaction_t; - msg : string := "") is + 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); @@ -144,11 +177,13 @@ package body stream_pkg is check_equal(got.last, expected.last, msg); end; - procedure check_stream(signal net : inout network_t; - stream : stream_slave_t; - expected_data : std_logic_vector; - expected_last : boolean := false; - msg : string := "") is + 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; @@ -156,49 +191,63 @@ package body stream_pkg is check_stream(net, stream, expected, msg); end; - procedure wait_until_idle(signal net : inout network_t; - stream : stream_master_t) is + 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; - stream : stream_slave_t) is + 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; - stream : stream_master_t; - delay : delay_length) is + 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; - stream : stream_slave_t; - delay : delay_length) is + 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; - stream : stream_master_t; - variable msg : out msg_t) is + 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; - stream : stream_slave_t; - variable msg : out msg_t) is + 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; - stream : stream_master_t; - variable transaction : out stream_transaction_t) is + 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 @@ -216,10 +265,12 @@ package body stream_pkg is end loop; end; - procedure receive_stream(signal net : inout network_t; - stream : stream_master_t; - variable data : out std_ulogic_vector; - variable last : out boolean) is + 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); @@ -227,18 +278,22 @@ package body stream_pkg is last := transaction.last; end; - procedure receive_stream(signal net : inout network_t; - stream : stream_master_t; - variable data : out std_ulogic_vector) is + 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; - stream : stream_slave_t; - variable msg : out msg_t) is + 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 @@ -253,20 +308,24 @@ package body stream_pkg is end loop; end; - procedure reply_stream(signal net : inout network_t; - variable msg : inout msg_t; - transaction : stream_transaction_t) is + 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); + 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; - data : std_ulogic_vector; - last : boolean := false) is + 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; diff --git a/vunit/vhdl/verification_components/src/stream_pkg.vhd b/vunit/vhdl/verification_components/src/stream_pkg.vhd index c54aaace5..efceb3e98 100644 --- a/vunit/vhdl/verification_components/src/stream_pkg.vhd +++ b/vunit/vhdl/verification_components/src/stream_pkg.vhd @@ -25,10 +25,12 @@ package stream_pkg is end record; -- Create a new stream master object - impure function new_stream_master return stream_master_t; + impure function new_stream_master + return stream_master_t; -- Create a new stream slave object - impure function new_stream_slave return stream_slave_t; + impure function new_stream_slave + return stream_slave_t; -- Encapsulate a stream transaction type stream_transaction_t is record @@ -37,15 +39,20 @@ package stream_pkg is end record; -- Create a new stream transaction - function new_stream_transaction(data : std_logic_vector; - last : boolean := false) - return stream_transaction_t; + 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); + 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; + 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]; @@ -53,118 +60,141 @@ package stream_pkg is -- 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"); + 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; - stream : stream_master_t; - transaction : stream_transaction_t); + 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; - stream : stream_master_t; - data : std_logic_vector; - last : boolean := false); + 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; - stream : stream_slave_t; - variable transaction : out stream_transaction_t); - - 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); + 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; - stream : stream_slave_t; - variable reference : inout stream_reference_t); + 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); + 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; - stream : stream_slave_t; - expected : stream_transaction_t; - msg : string := ""); - - procedure check_stream(signal net : inout network_t; - stream : stream_slave_t; - expected_data : std_logic_vector; - expected_last : boolean := false; - msg : string := ""); + 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; - stream : stream_master_t); + procedure wait_until_idle ( + signal net : inout network_t; + constant stream : in stream_master_t); - procedure wait_until_idle(signal net : inout network_t; - stream : stream_slave_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; - stream : stream_master_t; - delay : delay_length); + 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; - stream : stream_slave_t; - delay : 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; - stream : stream_master_t; - variable msg : out msg_t); + 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; - stream : stream_slave_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; - stream : stream_master_t; - variable transaction : out stream_transaction_t); - - procedure receive_stream(signal net : inout network_t; - stream : stream_master_t; - variable data : out std_ulogic_vector; - variable last : out boolean); - - procedure receive_stream(signal net : inout network_t; - stream : stream_master_t; - variable data : out std_ulogic_vector); + 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; - stream : stream_slave_t; - variable msg : out msg_t); + 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; - transaction : stream_transaction_t); - - procedure reply_stream(signal net : inout network_t; - variable msg : inout msg_t; - data : std_ulogic_vector; - last : boolean := false); + 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;