Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

push avalon master read req msg one cycle earlier (fix #695) #696

Merged
merged 2 commits into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions vunit/vhdl/verification_components/src/avalon_master.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ begin
address <= pop_std_ulogic_vector(request_msg);
byteenable(byteenable'range) <= (others => '1');
read <= '1';
push(acknowledge_queue, request_msg);
wait until rising_edge(clk) and waitrequest = '0';
read <= '0';
push(acknowledge_queue, request_msg);

elsif msg_type = bus_burst_read_msg then
while rnd.Uniform(0.0, 1.0) > read_high_probability loop
Expand All @@ -92,9 +92,9 @@ begin
burstcount <= std_logic_vector(to_unsigned(burst, burstcount'length));
byteenable(byteenable'range) <= (others => '1');
read <= '1';
push(burst_acknowledge_queue, request_msg);
wait until rising_edge(clk) and waitrequest = '0';
read <= '0';
push(burst_acknowledge_queue, request_msg);
push(burstlen_queue, burst);

elsif msg_type = bus_write_msg then
Expand Down
75 changes: 75 additions & 0 deletions vunit/vhdl/verification_components/test/avalon_tb.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
-- 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-2020, Lars Asplund [email protected]

-- This test bench is to reproduce issue with pop form empty queue in modelsim.
library ieee;
use ieee.std_logic_1164.all;

library vunit_lib;
context vunit_lib.vunit_context;
context vunit_lib.vc_context;

entity avalon_tb is
generic (runner_cfg : string);
end avalon_tb;

architecture testbench of avalon_tb is

-- Avalon-MM Slave --
signal av_address : std_logic_vector(31 downto 0);
signal av_write : std_logic := '0';
signal av_writedata : std_logic_vector(31 downto 0) := (others=> '0');
signal av_read : std_logic := '0';
signal av_readdata : std_logic_vector(31 downto 0) := (others=> '0');
signal av_byteenable : std_logic_vector(3 downto 0);
signal av_burstcount : std_logic_vector(3 downto 0);

constant avalon_bus : bus_master_t := new_bus(data_length => 32, address_length => av_address'length);

signal clk : std_logic := '0';

constant CLK_period : time := 20 ns;

begin
avalon_master : entity vunit_lib.avalon_master
generic map (
bus_handle => avalon_bus,
use_readdatavalid => false,
fixed_read_latency => 0
)
port map (
clk => clk,
address => av_address,
byteenable => av_byteenable,
burstcount => av_burstcount,
write => av_write,
writedata => av_writedata,
read => av_read,
readdata => av_readdata,
readdatavalid => '0',
waitrequest => '0'
);

-- Clock process definitions
CLK_process: process
begin
clk <= '0';
wait for CLK_period/2;
clk <= '1';
wait for CLK_period/2;
end process;

tests: process
begin
test_runner_setup(runner, runner_cfg);

wait for CLK_period*2;

check_bus(net, avalon_bus, 0, (0 to 31 => '0'));

test_runner_cleanup(runner);
end process;
end;