Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutRoadmapCareersInternshipsFAQContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Puzzle Bank
  • SystemVerilog Language Puzzles25
    • Datatype and Bit Puzzles
    • Fork Join Puzzles
      • join vs join_any vs join_none
      • Loop Variable Capture in Detached Threads
      • wait fork Synchronization Point
      • disable Named Fork Scope
      • join_any Without Cleanup
      • Inner disable fork Does Not Kill Outer Sibling
    • Queue and Array Puzzles
    • String and Casting Puzzles
    • SystemVerilog Language Puzzles: Tricky Q&A
  • Difficulty Guide
  • Full Topic Map
  • Interview-Day Tips
  • Study Route: One Week Before the Interview
  • Study Route: Two Weeks
  • Study Route: Four Weeks (Full Course)4
  • OOP & Testbench Puzzles25
  • Concurrency & Timing Puzzles25
  • Randomization & Constraint Puzzles25
  • SVA Assertion Puzzles25
  • Functional Coverage Puzzles25
  • Logic & Aptitude Puzzles25
  • Scenario & Debug Puzzles25
  • UVM Testbench Puzzles25
  • Clock, Reset & CDC Puzzles25
  • Bus and Interface Protocol Puzzles25
  • Interview Prep: Puzzle Rounds7
  • DV Puzzle Cheatsheet
Loading lesson

←Fork Join Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. SystemVerilog Language Puzzles
  4. Fork Join Puzzles
  5. disable Named Fork Scope
On this page

    VLSI DV Interview PuzzlesAll levels

    disable Named Fork Scope

    Which lines print, and why does one statement after `disable` never execute?

    Puzzle

    Difficulty: Medium · Puzzle 4 of 6 · Topic: Fork Join Puzzles

    Which lines print, and why does one statement after `disable` never execute?

    Code

    p4.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    `timescale 1ns/1ns
    module p4;
      initial begin
        fork : outer
          begin
            #5 $display("%0t W1", $time);
            #5 $display("%0t W2", $time);
          end
          begin
            #6 disable outer;
            $display("%0t K", $time);
          end
        join
        $display("%0t DONE", $time);
      end
    endmodule

    Hint

    `disable outer` terminates the named block and all processes inside it, including the caller process itself.

    Step-by-step solution

    Diagram
    1) Worker prints W1 at t=5.
    2) At t=6, second branch executes `disable outer`, which terminates the entire named fork block.
    3) Because caller is terminated by disable, statement `K` is never reached.
    4) `join` returns immediately after block termination, so DONE prints at t=6.
    5) W2 at t=10 never occurs.

    Answer

    Answer: W1@5 and DONE@6 only; W2 and K do not print

    How this was checked

    Checked by running the code in Icarus Verilog 13 and Verilator 5; the printed output supports the answer above. disable outer also kills the branch that runs it. (Icarus, 4-state) disable outer also kills the branch that runs it. (Verilator, 2-state)

    Why candidates get it wrong

    `disable outer` also terminates the process that executes it, so K is unreachable; execution resumes after the whole fork, which is why DONE still prints at t=6.

    Interviewer follow-up

    How would behavior differ if you used `disable fork;` instead of `disable outer;` here? Model answer: `disable fork` only kills the children of the calling process, and branch 2 has none, so nothing is killed: K prints at 6, W2 at 10, then DONE at 10.

    Say it out loud

    I would first see what disable of a named block does, because it kills the whole labelled block including the process that calls it. So W1 prints at 5, the second branch disables the block at 6, the statement after it is never reached, and join returns so DONE prints at 6. W2 at 10 never prints. The trap is expecting the next statement to run, or expecting only the other branch to die. I would check which scope the label names.

    Related topics

    • Threads and Control: Fork, Disable, Wait, Process

    • Back to Fork Join Puzzles

    • SystemVerilog Language Puzzles section

    Previous

    20 / 293

    Next: join_any Without Cleanup

    Up next

    Up nextjoin_any Without Cleanup

    Sign in to save progress

    Practice this lessonPrevious lessonReport an error

    See also

    • join vs join_any vs join_none
    • Loop Variable Capture in Detached Threads
    • Inner disable fork Does Not Kill Outer Sibling