tb_feature.vhd 17.6 KB
Newer Older
Martin Jeřábek's avatar
Martin Jeřábek committed
1
--------------------------------------------------------------------------------
2
-- 
Martin Jeřábek's avatar
Martin Jeřábek committed
3
-- CTU CAN FD IP Core
4 5 6 7
-- Copyright (C) 2015-2018
-- 
-- Authors:
--     Ondrej Ille <ondrej.ille@gmail.com>
8
--     Martin Jerabek <martin.jerabek01@gmail.com>
9 10
-- 
-- Project advisors: 
Martin Jeřábek's avatar
Martin Jeřábek committed
11 12
-- 	Jiri Novak <jnovak@fel.cvut.cz>
-- 	Pavel Pisa <pisa@cmp.felk.cvut.cz>
13
-- 
Martin Jeřábek's avatar
Martin Jeřábek committed
14 15 16
-- Department of Measurement         (http://meas.fel.cvut.cz/)
-- Faculty of Electrical Engineering (http://www.fel.cvut.cz)
-- Czech Technical University        (http://www.cvut.cz/)
17
-- 
18 19 20 21 22
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this VHDL component and associated documentation files (the "Component"),
-- to deal in the Component without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Component, and to permit persons to whom the
Martin Jeřábek's avatar
Martin Jeřábek committed
23
-- Component is furnished to do so, subject to the following conditions:
24
-- 
25
-- The above copyright notice and this permission notice shall be included in
Martin Jeřábek's avatar
Martin Jeřábek committed
26
-- all copies or substantial portions of the Component.
27
-- 
28 29 30 31
-- THE COMPONENT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHTHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Martin Jeřábek's avatar
Martin Jeřábek committed
32
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
33
-- FROM, OUT OF OR IN CONNECTION WITH THE COMPONENT OR THE USE OR OTHER DEALINGS
Martin Jeřábek's avatar
Martin Jeřábek committed
34
-- IN THE COMPONENT.
35
-- 
36 37
-- The CAN protocol is developed by Robert Bosch GmbH and protected by patents.
-- Anybody who wants to implement this IP core on silicon has to obtain a CAN
Martin Jeřábek's avatar
Martin Jeřábek committed
38
-- protocol license from Bosch.
39
-- 
Martin Jeřábek's avatar
Martin Jeřábek committed
40 41 42
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
43 44 45
-- @TestInfoStart
--
-- @Purpose:
Martin Jeřábek's avatar
Martin Jeřábek committed
46 47
--  Main environment for feature tests
--
48
-- @TestInfoEnd
Martin Jeřábek's avatar
Martin Jeřábek committed
49 50 51
--------------------------------------------------------------------------------
-- Revision History:
--    20.6.2016   Created file
52
--    June 2018   Major rewrite for support of new unified testing framework.
Martin Jeřábek's avatar
Martin Jeřábek committed
53 54
--------------------------------------------------------------------------------

55 56
context work.ctu_can_synth_context;
context work.ctu_can_test_context;
Martin Jeřábek's avatar
Martin Jeřábek committed
57

58
use lib.pkg_feature_exec_dispath.all;
Martin Jeřábek's avatar
Martin Jeřábek committed
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90

--------------------------------------------------------------------------------
-- Test enity for feature tests. Additional signals representing two memory
-- buses are present to connect two DUTs of feature tests!
--------------------------------------------------------------------------------
entity CAN_feature_test is
    port (
        -- Input trigger, test starts running when true
        signal run              : in    boolean;

        -- Number of iterations that test should do
        signal iterations       : in    natural;

        -- Logging level, severity which should be shown
        signal log_level        : in    log_lvl_type;

        -- Test behaviour when error occurs: Quit, or Go on
        signal error_beh        : in    err_beh_type;

        -- Error tolerance, error counter should not
        -- exceed this value in order for the test to pass
        signal error_tol        : in    natural;

        -- Status of the test
        signal status           : out   test_status_type;

        -- Memory access buses
        signal mem_bus          : inout mem_bus_arr_t;

        -- Bus level injected value and whether it should be forced on bus
        signal bl_inject        : in    std_logic;
        signal bl_force         : in    boolean;
91 92 93
        
        -- Transmitter delays
        signal transmitter_delays :in   t_ftr_tx_delay;
94 95 96 97
        
        -- Timestamp forcing (preset)
        signal ts_preset        : in    std_logic_vector(2 downto 1);
        signal ts_preset_val    : in    std_logic_vector(63 downto 0);
Martin Jeřábek's avatar
Martin Jeřábek committed
98 99

        -- Internal signals; TODO: direction
Martin Jeřábek's avatar
Martin Jeřábek committed
100
        signal iteration_done   : in boolean := false;
Martin Jeřábek's avatar
Martin Jeřábek committed
101 102
        signal hw_reset_on_new_test         : in boolean := true;

103
        signal iout             : out instance_outputs_arr_t;
Martin Jeřábek's avatar
Martin Jeřábek committed
104 105

        --CAN bus signals
106
        signal bus_level        : out std_logic := RECESSIVE;
Martin Jeřábek's avatar
Martin Jeřábek committed
107 108 109 110 111 112 113 114 115 116 117 118 119 120

        --Test name to be loaded by the TCL script from TCL test FIFO
        --Note that string always have to have fixed length
        signal test_name        : in string (1 to 20) := strtolen(20, "overload")
    );

    -- Internal test signals
    signal error_ctr            :       natural :=  0;
    signal loop_ctr             :       natural :=  0;
    signal exit_imm             :       boolean :=  false;
end entity;

architecture feature_env_test of CAN_feature_test is
    type instance_signals_t is record
121 122
        tr_del          : time;
        tr_delayed      : std_logic;
Martin Jeřábek's avatar
Martin Jeřábek committed
123 124 125 126 127 128 129 130 131
        clk_sys         : std_logic;
        res_n           : std_logic;
        int             : std_logic;
        CAN_tx          : std_logic;
        CAN_rx          : std_logic;
        timestamp       : std_logic_vector(63 downto 0);

        data_in         : std_logic_vector(31 downto 0);
        data_out        : std_logic_vector(31 downto 0);
132
        adress          : std_logic_vector(15 downto 0);
Martin Jeřábek's avatar
Martin Jeřábek committed
133 134 135 136 137 138 139 140
        scs             : std_logic; --Chip select
        srd             : std_logic; --Serial read
        swr             : std_logic; --Serial write
        sbe             : std_logic_vector(3 downto 0); --Byte enable
    end record;
    type instance_signals_arr_t is array(1 to NINST) of instance_signals_t;

    signal p : instance_signals_arr_t := (others => (
141 142
        tr_del          => 20 * f100_Mhz * 1 ps,
        tr_delayed      => RECESSIVE,
Martin Jeřábek's avatar
Martin Jeřábek committed
143 144 145 146 147 148 149 150 151 152 153 154 155
        clk_sys         => '0',
        res_n           => '0',
        int             => '0',
        CAN_tx          => RECESSIVE,
        CAN_rx          => RECESSIVE,
        timestamp       => (OTHERS=>'0'),

        data_in         => (OTHERS=>'0'),
        data_out        => (OTHERS=>'0'),
        adress          => (OTHERS=>'0'),
        scs             => '0',
        srd             => '0',
        swr             => '0',
Martin Jeřábek's avatar
Martin Jeřábek committed
156
        sbe             => (OTHERS => '1')
Martin Jeřábek's avatar
Martin Jeřábek committed
157
    ));
158 159

    signal s_bus_level : std_logic := RECESSIVE;
Martin Jeřábek's avatar
Martin Jeřábek committed
160 161 162 163 164
begin

    g_inst: for i in 1 to 2 generate
        CAN_inst: CAN_top_level
        generic map(
165
            rx_buffer_size    => 64
Martin Jeřábek's avatar
Martin Jeřábek committed
166 167
        )
        port map(
Martin Jeřábek's avatar
Martin Jeřábek committed
168 169 170 171 172 173 174 175 176 177 178 179 180
            clk_sys           => p(i).clk_sys,
            res_n             => p(i).res_n,
            data_in           => p(i).data_in,
            data_out          => p(i).data_out,
            adress            => p(i).adress,
            scs               => p(i).scs,
            srd               => p(i).srd,
            swr               => p(i).swr,
            sbe               => p(i).sbe,
            int               => p(i).int,
            CAN_tx            => p(i).CAN_tx,
            CAN_rx            => p(i).CAN_rx,
            timestamp         => p(i).timestamp,
Martin Jeřábek's avatar
Martin Jeřábek committed
181 182
            drv_bus_o         => iout(i).drv_bus,
            stat_bus_o        => iout(i).stat_bus
Martin Jeřábek's avatar
Martin Jeřábek committed
183 184
        );

185 186 187 188 189 190 191 192 193 194
        i_txdelay : entity work.signal_delayer
            generic map (
                NSAMPLES    => 16
            )
            port map (
                input       => p(i).CAN_tx,
                delay       => p(i).tr_del,
                delayed     => p(i).tr_delayed
            );

Martin Jeřábek's avatar
Martin Jeřábek committed
195
        -------------------------------------------------
Martin Jeřábek's avatar
Martin Jeřábek committed
196
        -- Connect individual bus signals of memory buses
Martin Jeřábek's avatar
Martin Jeřábek committed
197
        -------------------------------------------------
Martin Jeřábek's avatar
Martin Jeřábek committed
198 199
        x1: mem_bus(i).clk_sys    <= p(i).clk_sys;
        x2: p(i).data_in          <= mem_bus(i).data_in;
200
        x3: p(i).adress           <= mem_bus(i).address(15 downto 0);
Martin Jeřábek's avatar
Martin Jeřábek committed
201 202 203 204 205 206 207 208
        x4: p(i).scs              <= mem_bus(i).scs;
        x5: p(i).swr              <= mem_bus(i).swr;
        x6: p(i).srd              <= mem_bus(i).srd;
        x7: p(i).sbe              <= mem_bus(i).sbe;
        x8: mem_bus(i).data_out   <= p(i).data_out;
        x9: iout(i).irq           <= p(i).int;
        xc: iout(i).hw_reset      <= p(i).res_n;
        -- stat_bus and drv_bus passwd directly, as indirection costs
209
        -- @10% of simulation time
Martin Jeřábek's avatar
Martin Jeřábek committed
210 211 212 213

        ---------------------------------
        --Transceiver and bus realization
        ---------------------------------
Martin Jeřábek's avatar
Martin Jeřábek committed
214 215
        xd: p(i).CAN_rx           <= s_bus_level;
        xe: bus_level             <= s_bus_level;
216 217
        
        xf: iout(i).can_tx        <= p(i).CAN_tx;
218 219
        
        x10: p(i).tr_del          <= transmitter_delays(i);
Martin Jeřábek's avatar
Martin Jeřábek committed
220 221

        ---------------------------------
Martin Jeřábek's avatar
Martin Jeřábek committed
222
        -- Clock & timestamp generation
Martin Jeřábek's avatar
Martin Jeřábek committed
223
        ---------------------------------
224 225
        clk_gen_proc: clock_gen_proc(period => f100_Mhz, duty => 50,
                       epsilon_ppm => (i - 1) * 100, out_clk => p(i).clk_sys);
226 227
        tsgen_proc: timestamp_gen_proc(p(i).clk_sys, p(i).timestamp, ts_preset(i),
                        ts_preset_val);
Martin Jeřábek's avatar
Martin Jeřábek committed
228 229
    end generate;

230 231 232 233 234 235 236 237 238 239 240 241 242 243
    tr_proc:process(all)
        variable busl : std_logic;
    begin
        if bl_force then
            s_bus_level <= bl_inject;
        else
            busl := RECESSIVE;
            for i in 1 to 2
            loop
                busl := busl and p(i).tr_delayed;
            end loop;
            s_bus_level <= busl;
        end if;
    end process;
Martin Jeřábek's avatar
Martin Jeřábek committed
244 245 246 247 248 249 250 251 252

    ---------------------------------
    --Test process listening to the
    --  higher hierarchy wrapper!
    ---------------------------------
    test_proc:process
    begin
        status <= waiting;
        loop_ctr <= 0;
Martin Jeřábek's avatar
Martin Jeřábek committed
253
        wait until run = true;
Martin Jeřábek's avatar
Martin Jeřábek committed
254
        if hw_reset_on_new_test then
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
255
            info("HW Restart of feature test environment started!");
Martin Jeřábek's avatar
Martin Jeřábek committed
256
            wait for 5 ns;
Martin Jeřábek's avatar
Martin Jeřábek committed
257 258 259 260 261 262
            error_ctr <= 0;
            p(1).res_n <= '0';
            p(2).res_n <= '0';
            wait for 100 ns;
            p(1).res_n <= '1';
            p(2).res_n <= '1';
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
263
            info("HW Restart of feature test environment finished");
264
            wait for 250 ns; -- wait until the core is really out of reset
Martin Jeřábek's avatar
Martin Jeřábek committed
265 266 267 268 269 270 271 272 273
        end if;

        --Status is restarted no matter the HW reset
        status <= running;
        print_test_info(iterations, log_level, error_beh, error_tol);

        -------------------------------
        --Main loop of the test
        -------------------------------
274
        while (loop_ctr<iterations and not exit_imm)
Martin Jeřábek's avatar
Martin Jeřábek committed
275
        loop
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
276
            info("Starting loop nr " & integer'image(loop_ctr));
Martin Jeřábek's avatar
Martin Jeřábek committed
277 278 279 280
            --Wait on signal from higher level wrapper to move to the next iteration
            wait until iteration_done = true;

            loop_ctr <= loop_ctr + 1;
281
            wait for 0 ns;
Martin Jeřábek's avatar
Martin Jeřábek committed
282 283 284 285 286 287 288 289 290
        end loop;

        status <= passed;
        wait until run = false;
    end process;
end architecture;


Library ieee;
291 292 293
library vunit_lib;
context vunit_lib.vunit_context;

Martin Jeřábek's avatar
Martin Jeřábek committed
294 295 296
USE IEEE.std_logic_1164.all;
USE IEEE.numeric_std.ALL;
USE ieee.math_real.ALL;
297
use work.can_constants.all;
Martin Jeřábek's avatar
Martin Jeřábek committed
298 299
USE work.CANtestLib.All;
USE work.randomLib.All;
300
use work.pkg_feature_exec_dispath.all;
Martin Jeřábek's avatar
Martin Jeřábek committed
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317

entity tb_feature is
    generic (
        runner_cfg : string := runner_cfg_default;
        iterations : natural := 1;
        log_level  : log_lvl_type := info_l;

        -- Test behaviour when error occurs: Quit, or Go on
        error_beh  : err_beh_type := quit;

        -- Error tolerance, error counter should not exceed this value
        -- in order for the test to pass
        error_tol  : natural := 0;

        -- Timeout in simulation time. 0 means no limit
        timeout    : string := "0 ms";

318 319
        seed       : natural := 0;

Martin Jeřábek's avatar
Martin Jeřábek committed
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
        hw_reset_on_new_test : boolean := true;

        test_name : string

    );
end entity;
-----------------------------------------------------------------------------------------------------------------
-- Test wrapper and control signals generator
-----------------------------------------------------------------------------------------------------------------
architecture tb of tb_feature is
    signal run         : boolean;          -- Input trigger, test starts running when true                                                        -- exceed this value in order for the test to pass
    signal status_int  : test_status_type; -- Status of the test

    constant mem_bus_init : Avalon_mem_type := (
        scs         => '0',
        swr         => '0',
        srd         => '0',
        address     => (OTHERS =>'0'),
        data_in     => (OTHERS =>'0'),
        clk_sys     => '0',
        data_out    => (OTHERS =>'0'),
        sbe         => x"0"
    );
343 344 345 346 347 348
    
    constant tran_delay_init : t_ftr_tx_delay :=
        (
            11 * f100_Mhz * 1 ps,
            11 * f100_Mhz * 1 ps
    );
Martin Jeřábek's avatar
Martin Jeřábek committed
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369

    procedure restart_mem_bus(
        signal mem_bus : out  Avalon_mem_type
    ) is begin
        mem_bus.scs         <= '0';
        mem_bus.swr         <= '0';
        mem_bus.srd         <= '0';
        mem_bus.address     <= (OTHERS =>'0');
        mem_bus.data_in     <= (OTHERS =>'0');
        mem_bus.clk_sys     <= 'Z';
        mem_bus.data_out    <= (OTHERS =>'Z');
        mem_bus.sbe         <= x"F";
    end procedure;

    --Additional signals definitions
    signal error_ctr      : natural := 0;
    signal exit_imm       : boolean := false;

    signal bl_inject      : std_logic := RECESSIVE;
    signal bl_force       : boolean := false;

370 371 372
    -- Default delay of 110 ns is realistic for CAN transceivers! 
    signal ftr_tb_trv_delays     :   t_ftr_tx_delay := tran_delay_init;

Martin Jeřábek's avatar
Martin Jeřábek committed
373
    -- test internal signals
374
    signal iteration_done : boolean := false;
Martin Jeřábek's avatar
Martin Jeřábek committed
375 376 377 378 379 380 381 382

    signal mem_bus        : mem_bus_arr_t := (OTHERS => mem_bus_init);

    signal iout           : instance_outputs_arr_t;

    signal bus_level      : std_logic;

    signal rand_ctr       : natural range 0 to RAND_POOL_SIZE;
383
    
Martin Jeřábek's avatar
Martin Jeřábek committed
384
    constant padded_test_name : string(1 to 20) := strtolen(20, test_name);
Martin Jeřábek's avatar
Martin Jeřábek committed
385

386 387 388 389 390 391
    signal so : feature_signal_outputs_t := (
        '0',
        false,
        ((
            11 * f100_Mhz * 1 ps,
            11 * f100_Mhz * 1 ps
392 393 394
        )),
        "00",
        (OTHERS => '0')
395 396
    );

Martin Jeřábek's avatar
Martin Jeřábek committed
397
begin
Martin Jeřábek's avatar
Martin Jeřábek committed
398 399
    bl_inject <= so.bl_inject;
    bl_force  <= so.bl_force;
400
    ftr_tb_trv_delays <= so.ftr_tb_trv_delay;
Martin Jeřábek's avatar
Martin Jeřábek committed
401

402
    -- In this test wrapper generics are directly connected to the signals
Martin Jeřábek's avatar
Martin Jeřábek committed
403 404 405 406 407 408 409 410 411 412 413 414
    -- of test entity
    test_comp: entity work.CAN_feature_test
    port map(
        run              =>  run,
        iterations       =>  iterations,
        log_level        =>  log_level,
        error_beh        =>  error_beh,
        error_tol        =>  error_tol,
        status           =>  status_int,
        mem_bus          =>  mem_bus,
        bl_inject        =>  bl_inject,
        bl_force         =>  bl_force,
415
        transmitter_delays =>  ftr_tb_trv_delays,
416 417 418
        
        ts_preset        => so.ts_preset,
        ts_preset_val    => so.ts_preset_val,
Martin Jeřábek's avatar
Martin Jeřábek committed
419 420 421 422 423 424

        iteration_done   => iteration_done,
        hw_reset_on_new_test => hw_reset_on_new_test,
        test_name        => padded_test_name,
        iout             => iout,
        --Internal signals of CAN controllers
425
        bus_level        => bus_level
Martin Jeřábek's avatar
Martin Jeřábek committed
426 427 428 429 430 431 432 433 434 435 436 437
    );

    ---------------------------------------
    ---------------------------------------
    --Starts the test and lets it run
    ---------------------------------------
    ---------------------------------------
    test:process
        constant ID_1    : natural range 0 to 15 := 1;
        constant ID_2    : natural range 0 to 15 := 2;
    begin
        test_runner_setup(runner, runner_cfg);
438

Martin Jeřábek's avatar
Martin Jeřábek committed
439 440 441 442
        --Set the process to run and wait until it comes out of reset
        iteration_done    <= false;
        run               <= true;
        error_ctr         <= 0;
443 444 445

        apply_rand_seed(seed, 0, rand_ctr);

Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
446
        info("Restarting mem_bus(1)");
Martin Jeřábek's avatar
Martin Jeřábek committed
447
        restart_mem_bus(mem_bus(1));
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
448
        info("Restarting mem_bus(1)");
Martin Jeřábek's avatar
Martin Jeřábek committed
449
        restart_mem_bus(mem_bus(2));
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
450
        info("Waiting for out of reset");
Martin Jeřábek's avatar
Martin Jeřábek committed
451

452 453 454 455
        --wait for 10 ns;
        wait until status_int = running;
        --wait until iout(1).hw_reset = '1' and iout(2).hw_reset = '1';
        --wait for 10 ns;
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
456
        info("... ready .. let's begin");
Martin Jeřábek's avatar
Martin Jeřábek committed
457

458 459 460 461
        -- Initialize TXT Buffer memories (not to have too many logs!)
        CAN_init_txtb_mems(ID_1, mem_bus(1));
        CAN_init_txtb_mems(ID_2, mem_bus(2));

Martin Jeřábek's avatar
Martin Jeřábek committed
462 463 464
        --Execute the controllers configuration
        CAN_turn_controller(true, ID_1, mem_bus(1));
        CAN_turn_controller(true, ID_2, mem_bus(2));
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
465
        info("Controllers are ON");
Martin Jeřábek's avatar
Martin Jeřábek committed
466 467 468 469 470 471 472

        --Set default retransmitt limit to 0
        -- Failed frames are not retransmited
        -- by default!!!
        CAN_enable_retr_limit(true, 0, ID_1, mem_bus(1));
        CAN_enable_retr_limit(true, 0, ID_2, mem_bus(2));

473 474 475 476
        -- Wait till integration is over!
        CAN_wait_bus_on(ID_1, mem_bus(1));
        CAN_wait_bus_on(ID_2, mem_bus(2));

Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
477
        info("RETR limit set");
Martin Jeřábek's avatar
Martin Jeřábek committed
478 479 480
        -------------------------------------------------
        -- Main test loop
        -------------------------------------------------
Martin Jeřábek's avatar
Martin Jeřábek committed
481
        while status_int /= passed loop
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
482
            info("Iteration ...");
Martin Jeřábek's avatar
Martin Jeřábek committed
483
            iteration_done <= false;
Martin Jeřábek's avatar
Martin Jeřábek committed
484
            exec_feature_test(test_name => test_name,
485 486 487 488
                              rand_ctr  => rand_ctr,
                              mem_bus   => mem_bus,
                              iout      => iout,
                              so        => so,
Martin Jeřábek's avatar
Martin Jeřábek committed
489 490
                              bus_level => bus_level
                              );
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
491
            info("... out of exec function");
Martin Jeřábek's avatar
Martin Jeřábek committed
492

Martin Jeřábek's avatar
Martin Jeřábek committed
493 494 495 496 497 498 499 500 501 502 503 504
            wait for 200 ns;
            iteration_done <= true;
            wait for 10 ns;
        end loop;

        run               <= false;
        test_runner_cleanup(runner, error_ctr > error_tol);
    end process;
    watchdog: if time'value(timeout) > 0 ns generate
        test_runner_watchdog(runner, time'value(timeout));
    end generate;
end architecture;