Skip to content

Edges of multi-bit event signals are judged on the low byte, not the LSB #1968

Open

Description

@tignear

Part of #1123. Found in the reviews of #1777 and #1967. The reference runtime's event_level (and the compiled scheduler's g.level, which mirrors it) reads up to 8 low bits of an event signal and tests != 0. So a multi-bit event or derived-clock expression has a 'level' of any bit of its low byte.

IEEE 1800-2023 9.4.2 / Table 9-2: posedge and negedge are judged on the least significant bit. Example: logic [3:0] c; with always @(posedge c), where c goes 4'b0001 -> 4'b0010. The LSB falls, so there's no posedge, but Celox sees level 1 -> 1. And 4'b0010 -> 4'b0011, where the LSB rises, is posedge, but Celox sees level 1 -> 1 and misses it.

Fix both the reference and the compiled level read to the LSB. That includes the four-state rows of Table 9-2 where four-state is supported. Add vtest cases checked against Icarus/Verilator.

Activity

  1. added
    bug
    on Oct 25, 2026
  2. tignear commented on Oct 25, 2026

    @tignear
    ContributorAuthor

    Note: reachability from SV still needs checking. Since #1708, a plain always @(posedge bus) with a multi-bit bus runs as a process (edge on the LSB through the wait machinery), so the example above may not reach event_level directly. Paths that can still reach it: multi-bit derived clock expressions, Veryl clock types wider than 1 bit, and host event signals. Confirm a reachable case first; if none exists, close this as unreachable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions