Previous Section Next Section

7.9 Exercises

  1. Define a struct test1. Instantiate the struct test1 under sys. Define the following events in this struct. (Hint: Default sampling event is @sim. Although minimal numbers of @sim events should be used in e code, this exercise uses them for simplicity.)

    1. Event a_event.

    2. Event p_clk is the rising edge of the HDL signal ~/top/clock.

    3. Event n_clk is the falling edge of the HDL signal ~/top/clock.

    4. Event c_clk is either edge of the HDL signal ~/top/clock.

    5. Event rst is emitted when the HDL signal ~/top/reset is 1 at sampling event p_clk (this is a synchronous reset).

  2. Extend the struct test1. Add the following events to the struct test1.

    1. Event p_start is the rising edge of the HDL signal ~/top/packet_valid.

    2. Event p_end is the falling edge of the HDL signal ~/top/packet_valid.

    3. Event p_ack is the rising edge of the HDL signal ~/top/packet_ack.

    4. Event p_pulse is the rising edge of the HDL signal ~/top/packet_pulse.

  3. Extend the struct test1. Redefine the following event in struct test1 using the is only syntax.

    1. Event a_event is emitted if both p_start and p_pulse are emitted in the same sampling period. The sampling event is @p_clk.

  4. Extend the struct test1. Define the following events in struct test1.

    1. Event b_event is emitted if either p_start or p_pulse is emitted in the same sampling period. The sampling event is @p_clk.

    2. Event c_event is emitted if fail {p_start; p_ack} succeeds in a sampling period. The sampling event is @p_clk.

    3. Event d_event is emitted if not {p_start; p_ack} succeeds in a sampling period. The sampling event is @p_clk.

    4. Event e_event is emitted if p_start is immediately followed by 25 to 50 clock cycles and then immediately followed by p_ack. The sampling event is @p_clk.

    5. Event f_event is emitted if p_start is followed eventually by p_ack. The sampling event is @p_clk.

    6. Event g_event is emitted if p_start is immediately followed by three emissions of p_pulse, followed by five clock cycles and then immediately followed by p_ack. The sampling event is @p_clk.

Previous Section Next Section