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

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Puzzle Bank
  • SystemVerilog Language Puzzles25
    • Datatype and Bit Puzzles
      • X-Bit Comparisons and Mixed Arithmetic
      • Signed vs Unsigned Comparison Trap
      • Type Cast Controls Sign Extension
      • Signed Part-Select Is Still Unsigned
      • X Collapse into 2-State `int`
      • Case Equality vs Wildcard Equality
    • Fork Join Puzzles
    • Queue and Array Puzzles
    • String and Casting Puzzles
    • SystemVerilog Language Puzzles: Tricky Q&A
  • Difficulty Guide
  • Full Topic Map
  • Interview-Day Tips
  • OOP & Testbench Puzzles25
  • Concurrency & Timing Puzzles25
  • Randomization & Constraint Puzzles25
  • SVA Assertion Puzzles25
  • Functional Coverage Puzzles25
  • Logic & Aptitude Puzzles25
  • Scenario & Debug Puzzles25
  • Interview Prep: Puzzle Rounds5
  • DV Puzzle Cheatsheet
Loading lesson

‹Datatype and Bit Puzzles
  1. Topics
  2. DV Interview Puzzles
  3. SystemVerilog Language Puzzles
  4. Datatype and Bit Puzzles
  5. Signed Part-Select Is Still Unsigned

VLSI DV Interview Puzzles · All levels

Signed Part-Select Is Still Unsigned

Explain why these three lines are not all the same numeric value.

On this page

    Puzzle

    Difficulty: Hard · Puzzle 4 of 6 · Topic: Datatype and Bit Puzzles

    Explain why these three lines are not all the same numeric value.

    Code

    p4.sv
    1
    2
    3
    4
    5
    6
    7
    8
    module p4;
      logic signed [7:0] s = -8'sd2; // 1111_1110
      initial begin
        $display("slice=%0d", s[7:4]);
        $display("signed_slice=%0d", $signed(s[7:4]));
        $display("shift=%0d", s >>> 4);
      end
    endmodule

    Hint

    Part-select expressions lose signedness unless you cast them. `>>>` uses the signedness of the left operand.

    Step-by-step solution

    Diagram
    1) `s[7:4]` is 4'b1111 but a part-select expression is unsigned by default, so decimal is 15.
    2) `$signed(s[7:4])` reinterprets 4'b1111 as signed -1.
    3) `s >>> 4` arithmetic-shifts signed -2 to -1, so it matches line 2, not line 1.

    Answer

    Answer: slice=15, signed_slice=-1, shift=-1

    Why candidates get it wrong

    People expect signedness to propagate automatically through slices of signed vectors.

    Interviewer follow-up

    How would `s >> 4` differ from `s >>> 4` in this example?

    Related topics

    • Back to Datatype and Bit Puzzles

    • SystemVerilog Language Puzzles section

    Previous

    8 / 210

    Next: X Collapse into 2-State `int`

    Up next

    Up nextX Collapse into 2-State `int`

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • X-Bit Comparisons and Mixed Arithmetic
    • Signed vs Unsigned Comparison Trap
    • Case Equality vs Wildcard Equality