first commit
This commit is contained in:
210
tb/Scheduler_tb.vhd
Normal file
210
tb/Scheduler_tb.vhd
Normal file
@@ -0,0 +1,210 @@
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
use ieee.math_real.all;
|
||||
use std.env.stop;
|
||||
|
||||
entity Scheduler_tb is
|
||||
end entity Scheduler_tb;
|
||||
|
||||
architecture Bench of Scheduler_tb is
|
||||
-- Clock period
|
||||
constant K_CLKPeriod : time := 10 ns;
|
||||
|
||||
-- Generics
|
||||
constant G_DataWidth : integer := 32;
|
||||
-- Ports
|
||||
signal I_CLK : std_logic;
|
||||
signal I_CE : std_logic := '1';
|
||||
signal I_RST : std_logic := '0';
|
||||
signal I_P0_Valid : std_logic := '0';
|
||||
signal O_P0_Ready : std_logic := '0';
|
||||
signal I_P0_Data : std_logic_vector(G_DataWidth - 1 downto 0) := (others => '0');
|
||||
signal I_P1_Valid : std_logic := '0';
|
||||
signal O_P1_Ready : std_logic := '0';
|
||||
signal I_P1_Data : std_logic_vector(G_DataWidth - 1 downto 0) := (others => '0');
|
||||
signal I_P2_Valid : std_logic := '0';
|
||||
signal O_P2_Ready : std_logic := '0';
|
||||
signal I_P2_Data : std_logic_vector(G_DataWidth - 1 downto 0) := (others => '0');
|
||||
signal I_P3_Valid : std_logic := '0';
|
||||
signal O_P3_Ready : std_logic := '0';
|
||||
signal I_P3_Data : std_logic_vector(G_DataWidth - 1 downto 0) := (others => '0');
|
||||
signal O_Out_Valid : std_logic := '0';
|
||||
signal I_Out_Ready : std_logic := '0';
|
||||
signal O_Out_Data : std_logic_vector(G_DataWidth - 1 downto 0) := (others => '0');
|
||||
signal O_Out_Address : std_logic_vector(1 downto 0) := (others => '0');
|
||||
|
||||
signal TestDone : boolean := false;
|
||||
begin
|
||||
|
||||
ClockProc : process
|
||||
begin
|
||||
while TestDone = false loop
|
||||
I_CLK <= '0';
|
||||
wait for K_CLKPeriod / 2;
|
||||
I_CLK <= '1';
|
||||
wait for K_CLKPeriod / 2;
|
||||
end loop;
|
||||
|
||||
I_CLK <= '0';
|
||||
stop(0);
|
||||
wait;
|
||||
end process;
|
||||
|
||||
i_AXI_Handshaking_Scheduler_4 : entity work.AXI_Handshaking_Scheduler_4
|
||||
generic map(
|
||||
G_DataWidth => G_DataWidth
|
||||
)
|
||||
port map(
|
||||
I_CLK => I_CLK,
|
||||
I_CE => I_CE,
|
||||
I_RST => I_RST,
|
||||
I_P0_Valid => I_P0_Valid,
|
||||
O_P0_Ready => O_P0_Ready,
|
||||
I_P0_Data => I_P0_Data,
|
||||
I_P1_Valid => I_P1_Valid,
|
||||
O_P1_Ready => O_P1_Ready,
|
||||
I_P1_Data => I_P1_Data,
|
||||
I_P2_Valid => I_P2_Valid,
|
||||
O_P2_Ready => O_P2_Ready,
|
||||
I_P2_Data => I_P2_Data,
|
||||
I_P3_Valid => I_P3_Valid,
|
||||
O_P3_Ready => O_P3_Ready,
|
||||
I_P3_Data => I_P3_Data,
|
||||
O_Out_Valid => O_Out_Valid,
|
||||
I_Out_Ready => I_Out_Ready,
|
||||
O_Out_Data => O_Out_Data,
|
||||
O_Out_Address => O_Out_Address
|
||||
);
|
||||
|
||||
ReceiverProc : process
|
||||
variable PacketCounter : integer := 0;
|
||||
begin
|
||||
I_Out_Ready <= '0';
|
||||
wait for 3 * K_CLKPeriod;
|
||||
|
||||
loop
|
||||
-- Ein paar Takte Ready aktivieren
|
||||
I_Out_Ready <= '1';
|
||||
for i in 0 to 2 loop
|
||||
wait until rising_edge(I_CLK);
|
||||
if O_Out_Valid = '1' and I_Out_Ready = '1' then
|
||||
report "Received packet #" & integer'image(PacketCounter) &
|
||||
" from address " & integer'image(to_integer(unsigned(O_Out_Address))) &
|
||||
" with data: " & integer'image(to_integer(unsigned(O_Out_Data)));
|
||||
|
||||
PacketCounter := PacketCounter + 1;
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
-- Pausephase
|
||||
-- I_Out_Ready <= '0';
|
||||
-- wait for 1 * K_CLKPeriod;
|
||||
end loop;
|
||||
end process;
|
||||
|
||||
-- Sender 0: sendet 1 Paket
|
||||
Sender0Proc : process (I_CLK)
|
||||
constant K_MaxCount : integer := 280;
|
||||
variable V_Counter : integer := 0;
|
||||
begin
|
||||
if rising_edge(I_CLK) then
|
||||
if V_Counter < K_MaxCount then
|
||||
I_P0_Data <= std_logic_vector(to_unsigned(V_Counter, G_DataWidth));
|
||||
I_P0_Valid <= '1';
|
||||
if O_P0_Ready = '1' and I_P0_Valid = '1' then
|
||||
report "Sender 0: Packet " & integer'image(V_Counter) & " sent with data: " & integer'image(to_integer(unsigned(I_P0_Data)));
|
||||
V_Counter := V_Counter + 1;
|
||||
if V_Counter = K_MaxCount then
|
||||
I_P0_Valid <= '0';
|
||||
end if;
|
||||
end if;
|
||||
else
|
||||
if V_Counter = K_MaxCount then
|
||||
V_Counter := V_Counter + 1;
|
||||
report "Sender 0: No more packets to send.";
|
||||
end if;
|
||||
I_P0_Valid <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Sender 1: sendet 1 Paket
|
||||
Sender1Proc : process (I_CLK)
|
||||
constant K_MaxCount : integer := 225;
|
||||
variable V_Counter : integer := 0;
|
||||
begin
|
||||
if rising_edge(I_CLK) then
|
||||
if V_Counter < K_MaxCount then
|
||||
I_P1_Data <= std_logic_vector(to_unsigned(V_Counter, G_DataWidth));
|
||||
I_P1_Valid <= '1';
|
||||
if O_P1_Ready = '1' and I_P1_Valid = '1' then
|
||||
report "Sender 1: Packet " & integer'image(V_Counter) & " sent with data: " & integer'image(to_integer(unsigned(I_P1_Data)));
|
||||
V_Counter := V_Counter + 1;
|
||||
if V_Counter = K_MaxCount then
|
||||
I_P1_Valid <= '0';
|
||||
end if;
|
||||
end if;
|
||||
else
|
||||
if V_Counter = K_MaxCount then
|
||||
V_Counter := V_Counter + 1;
|
||||
report "Sender 1: No more packets to send.";
|
||||
end if;
|
||||
I_P1_Valid <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Sender 2: sendet 1 Paket
|
||||
Sender2Proc : process (I_CLK)
|
||||
constant K_MaxCount : integer := 665;
|
||||
variable V_Counter : integer := 0;
|
||||
begin
|
||||
if rising_edge(I_CLK) then
|
||||
if V_Counter < K_MaxCount then
|
||||
I_P2_Data <= std_logic_vector(to_unsigned(V_Counter, G_DataWidth));
|
||||
I_P2_Valid <= '1';
|
||||
if O_P2_Ready = '1' and I_P2_Valid = '1' then
|
||||
report "Sender 2: Packet " & integer'image(V_Counter) & " sent with data: " & integer'image(to_integer(unsigned(I_P2_Data)));
|
||||
V_Counter := V_Counter + 1;
|
||||
if V_Counter = K_MaxCount then
|
||||
I_P2_Valid <= '0';
|
||||
end if;
|
||||
end if;
|
||||
else
|
||||
if V_Counter = K_MaxCount then
|
||||
V_Counter := V_Counter + 1;
|
||||
report "Sender 2: No more packets to send.";
|
||||
end if;
|
||||
I_P2_Valid <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Sender 3: sendet 1 Paket
|
||||
Sender3Proc : process (I_CLK)
|
||||
constant K_MaxCount : integer := 150;
|
||||
variable V_Counter : integer := 0;
|
||||
begin
|
||||
if rising_edge(I_CLK) then
|
||||
if V_Counter < K_MaxCount then
|
||||
I_P3_Data <= std_logic_vector(to_unsigned(V_Counter, G_DataWidth));
|
||||
I_P3_Valid <= '1';
|
||||
if O_P3_Ready = '1' and I_P3_Valid = '1' then
|
||||
report "Sender 3: Packet " & integer'image(V_Counter) & " sent with data: " & integer'image(to_integer(unsigned(I_P3_Data)));
|
||||
V_Counter := V_Counter + 1;
|
||||
if V_Counter = K_MaxCount then
|
||||
I_P3_Valid <= '0';
|
||||
end if;
|
||||
end if;
|
||||
else
|
||||
if V_Counter = K_MaxCount then
|
||||
V_Counter := V_Counter + 1;
|
||||
report "Sender 3: No more packets to send.";
|
||||
end if;
|
||||
I_P3_Valid <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
end architecture;
|
133
tb/Scheduler_tb.wcfg
Normal file
133
tb/Scheduler_tb.wcfg
Normal file
@@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<wave_config>
|
||||
<wave_state>
|
||||
</wave_state>
|
||||
<db_ref_list>
|
||||
<db_ref path="./isim.wdb" id="1" type="auto">
|
||||
<top_modules>
|
||||
<top_module name="env" />
|
||||
<top_module name="glbl" />
|
||||
<top_module name="math_real" />
|
||||
<top_module name="numeric_std" />
|
||||
<top_module name="scheduler_tb" />
|
||||
<top_module name="std_logic_1164" />
|
||||
</top_modules>
|
||||
</db_ref>
|
||||
</db_ref_list>
|
||||
<WVObjectSize size="21" />
|
||||
<wvobject fp_name="/scheduler_tb/i_clk" type="logic" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">i_clk</obj_property>
|
||||
<obj_property name="ObjectShortName">i_clk</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/i_ce" type="logic" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">i_ce</obj_property>
|
||||
<obj_property name="ObjectShortName">i_ce</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/i_rst" type="logic" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">i_rst</obj_property>
|
||||
<obj_property name="ObjectShortName">i_rst</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/i_p0_valid" type="logic" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">i_p0_valid</obj_property>
|
||||
<obj_property name="ObjectShortName">i_p0_valid</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/o_p0_ready" type="logic" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">o_p0_ready</obj_property>
|
||||
<obj_property name="ObjectShortName">o_p0_ready</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/i_p0_data" type="array" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">i_p0_data[31:0]</obj_property>
|
||||
<obj_property name="ObjectShortName">i_p0_data[31:0]</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/i_p1_valid" type="logic" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">i_p1_valid</obj_property>
|
||||
<obj_property name="ObjectShortName">i_p1_valid</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/o_p1_ready" type="logic" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">o_p1_ready</obj_property>
|
||||
<obj_property name="ObjectShortName">o_p1_ready</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/i_p1_data" type="array" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">i_p1_data[31:0]</obj_property>
|
||||
<obj_property name="ObjectShortName">i_p1_data[31:0]</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/i_p2_valid" type="logic" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">i_p2_valid</obj_property>
|
||||
<obj_property name="ObjectShortName">i_p2_valid</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/o_p2_ready" type="logic" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">o_p2_ready</obj_property>
|
||||
<obj_property name="ObjectShortName">o_p2_ready</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/i_p2_data" type="array" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">i_p2_data[31:0]</obj_property>
|
||||
<obj_property name="ObjectShortName">i_p2_data[31:0]</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/i_p3_valid" type="logic" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">i_p3_valid</obj_property>
|
||||
<obj_property name="ObjectShortName">i_p3_valid</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/o_p3_ready" type="logic" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">o_p3_ready</obj_property>
|
||||
<obj_property name="ObjectShortName">o_p3_ready</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/i_p3_data" type="array" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">i_p3_data[31:0]</obj_property>
|
||||
<obj_property name="ObjectShortName">i_p3_data[31:0]</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/o_out_valid" type="logic" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">o_out_valid</obj_property>
|
||||
<obj_property name="ObjectShortName">o_out_valid</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/i_out_ready" type="logic" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">i_out_ready</obj_property>
|
||||
<obj_property name="ObjectShortName">i_out_ready</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/o_out_data" type="array" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">o_out_data[31:0]</obj_property>
|
||||
<obj_property name="ObjectShortName">o_out_data[31:0]</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/o_out_address" type="array" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">o_out_address[1:0]</obj_property>
|
||||
<obj_property name="ObjectShortName">o_out_address[1:0]</obj_property>
|
||||
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="group29" type="group">
|
||||
<obj_property name="label">Intern</obj_property>
|
||||
<obj_property name="DisplayName">label</obj_property>
|
||||
<wvobject fp_name="/scheduler_tb/i_AXI_Handshaking_Scheduler_4/r_counter" type="array" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">r_counter[1:0]</obj_property>
|
||||
<obj_property name="ObjectShortName">r_counter[1:0]</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/i_AXI_Handshaking_Scheduler_4/c_select" type="array" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">c_select[3:0]</obj_property>
|
||||
<obj_property name="ObjectShortName">c_select[3:0]</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/i_AXI_Handshaking_Scheduler_4/c_code" type="array" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">c_code[1:0]</obj_property>
|
||||
<obj_property name="ObjectShortName">c_code[1:0]</obj_property>
|
||||
<obj_property name="Radix">BINARYRADIX</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/i_AXI_Handshaking_Scheduler_4/c_codereverse" type="array" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">c_codereverse[1:0]</obj_property>
|
||||
<obj_property name="ObjectShortName">c_codereverse[1:0]</obj_property>
|
||||
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
||||
</wvobject>
|
||||
</wvobject>
|
||||
<wvobject fp_name="group30" type="group">
|
||||
<obj_property name="label">PE</obj_property>
|
||||
<obj_property name="DisplayName">label</obj_property>
|
||||
<wvobject fp_name="/scheduler_tb/i_AXI_Handshaking_Scheduler_4/i_PriorityEncoder_4/i_select" type="array" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">i_select[3:0]</obj_property>
|
||||
<obj_property name="ObjectShortName">i_select[3:0]</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/i_AXI_Handshaking_Scheduler_4/i_PriorityEncoder_4/o_code" type="array" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">o_code[1:0]</obj_property>
|
||||
<obj_property name="ObjectShortName">o_code[1:0]</obj_property>
|
||||
</wvobject>
|
||||
<wvobject fp_name="/scheduler_tb/i_AXI_Handshaking_Scheduler_4/i_PriorityEncoder_4/c_code" type="array" db_ref_id="1">
|
||||
<obj_property name="ElementShortName">c_code[1:0]</obj_property>
|
||||
<obj_property name="ObjectShortName">c_code[1:0]</obj_property>
|
||||
</wvobject>
|
||||
</wvobject>
|
||||
</wave_config>
|
Reference in New Issue
Block a user