1 ------------------------------------------------------------------------------- 3 --! @brief GPIO device test bench 4 ------------------------------------------------------------------------------- 9 --! Using IEEE standard logic components 10 USE ieee.std_logic_1164.
ALL;
12 --! @brief GPIO device test bench 14 END ENTITY gpio_device_tb;
16 --! Architecture tb of gpio_device_tb entity 19 --! Test bench clock period 22 --! Stimulus record type 24 name : (1 TO 30);
--! Stimulus name 25 rst : ;
--! Reset input to gpio_device 26 data_wr : (31 DOWNTO 0);
--! Write data to gpio_device 27 data_rd : (31 DOWNTO 0);
--! Expected read data from gpio_device 29 gpio_out : (31 DOWNTO 0);
--! Expected GPIO outputs 32 --! Stimulus array type 57 SIGNAL clk : ;
--! Clock input to uut 58 SIGNAL rst : ;
--! Reset input to uut 60 SIGNAL dat_wr_reg : (31 DOWNTO 0);
--! Data write register input to uut 61 SIGNAL dat_rd_reg : (31 DOWNTO 0);
--! Data read register output from uut 62 SIGNAL gpio_in : (31 DOWNTO 0);
--! GPIO inputs 63 SIGNAL gpio_out : (31 DOWNTO 0);
--! GPIO outputs 65 --! Function to create string from std_logic_vector 70 VARIABLE v_str : (1 TO vector'length);
74 FOR i IN vector'range LOOP 75 v_str(i + 1) := 'image(vector(i))(2);
80 END FUNCTION to_string;
84 --! Instantiate GPIO device as uut 96 --! @brief Clock generator process 98 --! This generates the clk signal and the adv signal 108 END PROCESS pr_clock;
110 --! @brief Stimulus process to drive PWM unit under test 111 pr_stimulus :
PROCESS IS 114 -- Initialize entity inputs 121 -- Loop over stimulus 124 -- Log start of stimulus 127 -- Perform write to device 135 -- Assert read from device 137 REPORT "Expected read of " & 143 -- Assert read from device 145 REPORT "Expected gpio_out of " & 153 REPORT "Finished" SEVERITY note;
155 -- Finish the simulation 158 END PROCESS pr_stimulus;
std_logic_vector( 31 DOWNTO 0) data_rd
Expected read data from gpio_device.
out dat_rd_reg_outstd_logic_vector( 31 DOWNTO 0)
Device Read Register value.
std_logic_vector( 31 DOWNTO 0) gpio_out
Expected GPIO outputs.
std_logic dat_wr_done
Data write done input to uut.
in clk_instd_logic
Clock.
out gpio_bus_outstd_logic_vector( 31 DOWNTO 0)
GPIO outputs.
in rst_instd_logic
Asynchronous reset.
in dat_wr_done_instd_logic
Device Write Done flag.
std_logic rst
Reset input to gpio_device.
time := 10 ns c_clk_period
Test bench clock period.
std_logic_vector( 31 DOWNTO 0) dat_wr_reg
Data write register input to uut.
string( 1 TO 30) name
Stimulus name.
string to_stringvector,
Function to create string from std_logic_vector.
t_stimulus_array :=((name => "Reset ",rst => '1',data_wr => X"00000000",data_rd => X"00000000",gpio_in => X"00000000",gpio_out => X"00000000"),(name => "Transfer ",rst => '0',data_wr => X"DEADBEEF",data_rd => X"AA550011",gpio_in => X"AA550011",gpio_out => X"DEADBEEF")) c_stimulus
Test stimulus.
std_logic clk
Clock input to uut.
in dat_wr_reg_instd_logic_vector( 31 DOWNTO 0)
Device Write Register value.
in gpio_bus_instd_logic_vector( 31 DOWNTO 0)
GPIO inputs.
_library_ ieeeieee
Using IEEE library.
std_logic_vector( 31 DOWNTO 0) gpio_in
GPIO inputs.
std_logic_vector( 31 DOWNTO 0) data_wr
Write data to gpio_device.
t_stimulus
Stimulus record type.
std_logic_vector( 31 DOWNTO 0) dat_rd_reg
Data read register output from uut.
array(natural range <> ) of t_stimulus t_stimulus_array
Stimulus array type.