Search code examples
verilogsystem-verilog

System Verilog Scheduler


from my understanding of system verilog event scheduler i think that between each two simulation steps we can have several delta cycle and each delta cycle can have many events and these events are distributed into regions and we have to finish each region before going to the next region but i think i miss something which is that

  • Separate delta cycles does each delta cycle have all the regions from active to re-NBA or we have the delta cycles of active set regions and we have to finish there events first and then we can go to the delta cycles of observed region to finish its events and then we can go back to the active region or to re-active regions set and we have to finish there delta cycle and after that we can go back to active regions set or to postponed region or
  • combined delta cycle each delta cycle have all the regions from active to re-NBA and we have to finish all these regions before we can go to the next delta cycle So do we divide events into delta cycles which means each regions set have its delta cycle and we have to finish its delta cycles first before going to the next region OR we divide delta cycles into events which means each delta cycle have all the event regions and when we loop back this means we will go to next delta cycle and in the case we divide events into delta cycle is the observed region considered to be part of the active region which means events active, inactive, NBA, observed share the same detla cycle ?

I want to know how scheduling is working in system verilog do we finish the delta cycle of each events region or we finish each delta cycle first which includes all the events region


Solution

  • SystemVerilog does not have a formal definition of a delta cycle. However in practice, that term usually refers to whenever the event scheduler jumps back to an earlier event region within the current time step.

    Section 4.5 SystemVerilog simulation reference algorithm in the IEEE 1800-2023 SystemVerilog LRM has a pseudocode definition of execution of all the event regions. In more simple terms, it can be stated for each time step as:

    • Execute events in the current region until it is empty. Execution in a region can put more events in current or other region
    • When the current region is empty, scan the list of event regions and start executing the earliest event region that is not empty.
    • when there are not more events in any region in the current time step, advance time to the time step with event scheduled.

    If you don't use program blocks (which I strongly advise against using), you can ignore all the extra complexities of the re-active/inactive regions. And assume the observed region only gets executed once per time slot.