Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ jobs:

- name: cargo clippy
if: (needs.changes.result != 'success' || needs.changes.outputs.rust == 'true') && needs.changes.outputs.rust_full != 'false'
run: cargo clippy --locked --workspace --exclude lydite-celox --all-targets --features celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus --no-deps
run: cargo clippy --locked --workspace --exclude lydite-celox --all-targets --features celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus,celox-test-suite/xezim --no-deps

- name: Lint the crates this pull request can affect
if: needs.changes.outputs.rust_full == 'false' && needs.changes.outputs.rust_lint_packages != ''
Expand Down Expand Up @@ -259,7 +259,7 @@ jobs:
if: needs.changes.outputs.rust_full != 'false'
run: >-
cargo nextest run --locked --workspace --exclude 'lydite*' --profile ci
--features celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus,celox-test-suite/runtime-cases
--features celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus,celox-test-suite/xezim,celox-test-suite/runtime-cases

- name: Run the tests this pull request can affect
id: scoped-tests
Expand Down Expand Up @@ -305,7 +305,7 @@ jobs:
if: needs.changes.outputs.rust_full != 'false'
run: >-
cargo test --locked --workspace --exclude 'lydite*' --doc
--features celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus,celox-test-suite/runtime-cases
--features celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus,celox-test-suite/xezim,celox-test-suite/runtime-cases

- name: Run the documentation tests of the changed libraries
if: needs.changes.outputs.rust_full == 'false' && needs.changes.outputs.rust_libraries != ''
Expand Down Expand Up @@ -348,9 +348,11 @@ jobs:
fail-fast: false
matrix:
suite: [veryl, sv]
tool: [verilator, icarus]
tool: [verilator, icarus, xezim]
env:
VERIFY_TOOL: ${{ matrix.tool }}
# xezim builds from source, so only its jobs enter the shell with it.
VERIFY_SHELL: ${{ matrix.tool == 'xezim' && '.#xezim' || '.' }}
VERIFY_SUITE: ${{ matrix.suite }}
VERIFY_BIN: ${{ matrix.suite == 'sv' && format('verify-sv-{0}', matrix.tool) || format('verify-{0}', matrix.tool) }}
VERIFY_BASELINE: ${{ matrix.suite == 'sv' && format('crates/celox-test-suite/verification/sv/{0}.json', matrix.tool) || format('crates/celox-test-suite/verification/{0}.json', matrix.tool) }}
Expand All @@ -366,15 +368,15 @@ jobs:
- name: Test live simulator adapters
if: matrix.suite == 'veryl'
run: >-
nix develop --no-update-lock-file --command
nix develop "$VERIFY_SHELL" --no-update-lock-file --command
cargo test --locked -p celox-test-suite --features "$VERIFY_TOOL"
--test oracles -- --ignored

- name: Catalogue every shared case
if: ${{ !cancelled() }}
run: |
mkdir -p "$RUNNER_TEMP/external-suite"
nix develop --no-update-lock-file --command \
nix develop "$VERIFY_SHELL" --no-update-lock-file --command \
cargo run --locked -p celox-test-suite --features "$VERIFY_TOOL" \
--bin "$VERIFY_BIN" -- --list > "$RUNNER_TEMP/external-suite/catalogue.json"

Expand All @@ -385,7 +387,7 @@ jobs:
# The runner returns 1 for retained failures as well as regressions.
# The next step checks the complete fresh report and the exit status.
rm -f "$RUNNER_TEMP/external-suite/logs/results.json"
if nix develop --no-update-lock-file --command \
if nix develop "$VERIFY_SHELL" --no-update-lock-file --command \
cargo run --locked -p celox-test-suite --features "$VERIFY_TOOL" \
--bin "$VERIFY_BIN" -- --fresh --jobs 2 \
--output "$RUNNER_TEMP/external-suite/logs"; then
Expand All @@ -400,7 +402,7 @@ jobs:
env:
VERIFY_EXIT_STATUS: ${{ steps.verify.outputs.exit_status }}
run: >-
nix develop --no-update-lock-file --command
nix develop "$VERIFY_SHELL" --no-update-lock-file --command
node scripts/check-external-suite-report.mjs
"$RUNNER_TEMP/external-suite/logs/results.json" "$VERIFY_BASELINE"
"$RUNNER_TEMP/external-suite/catalogue.json" "$VERIFY_EXIT_STATUS" "$VERIFY_SUITE"
Expand Down
27 changes: 22 additions & 5 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
schedule:
- cron: "17 2 * * *"
workflow_dispatch:
inputs:
runner_probe:
description: Check Macro Runner availability without building or benchmarking
type: boolean
default: false

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -16,9 +21,20 @@ env:
permissions: {}

jobs:
runner-probe:
name: Probe CodSpeed runner
if: github.event_name == 'workflow_dispatch' && inputs.runner_probe
runs-on: codspeed-macro-arm64-graviton-ubuntu-22-04
timeout-minutes: 2
steps:
- name: Verify the ARM64 runner is available
run: test "$(uname -m)" = aarch64

codspeed:
name: CodSpeed
runs-on: ubuntu-latest
if: inputs.runner_probe != true
timeout-minutes: 60
runs-on: codspeed-macro-arm64-graviton-ubuntu-22-04
outputs:
run-id: ${{ steps.benchmarks.outputs.run-id }}
permissions:
Expand All @@ -39,19 +55,20 @@ jobs:
tool: cargo-codspeed@5.0.1

- name: Build compile-time benchmarks
run: cargo codspeed build --locked -p celox --bench compilation
run: cargo codspeed build --locked --measurement-mode walltime -p celox --bench compilation

- name: Run compile-time benchmarks
id: benchmarks
timeout-minutes: 15
uses: CodSpeedHQ/action@v5
with:
mode: simulation
run: cargo codspeed run -p celox
mode: walltime
run: cargo codspeed run --measurement-mode walltime -p celox --bench compilation

report:
name: Report CodSpeed
needs: codspeed
if: always() && (github.ref_name == 'master' || github.ref_name == 'develop')
if: always() && inputs.runner_probe != true && (github.ref_name == 'master' || github.ref_name == 'develop')
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rust-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: >-
cargo nextest list --locked --workspace --exclude 'lydite*' --message-format json
--features celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus,celox-test-suite/runtime-cases
--features celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus,celox-test-suite/xezim,celox-test-suite/runtime-cases
> /dev/null

rust-default-tests:
Expand Down
10 changes: 8 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ interpreter, native and Cranelift backends in both two-state and four-state mode
wide-value latch checks, and a small sorter compilation smoke test.
The 257/512-bit per-bit graph cases and sorter sizes 4/8/16/32 are measured by
`benches/compilation.rs` in the existing daily/manual CodSpeed workflow.
Compilation benchmarks use CodSpeed walltime measurement on its ARM64 Graviton
Macro Runner: CPU simulation made
a single 512-bit case take tens of minutes. The benchmark step has a 15-minute
timeout and the complete job a 60-minute limit; a timeout is reported as failure.
The organization runner group must allow this public repository to use CodSpeed
Macro Runners. Simulation and walltime measurements have separate baselines.
Nested-write benchmarks reuse the same semantic assertions as the small tests.
Scaling cases use one iteration without per-case warmups or adaptive sampling;
a small counter warms process-global analyzer state before measurement.
Expand All @@ -130,8 +136,8 @@ CodSpeed reporting workflow.
Build and run them with the same CodSpeed harness as CI:

```sh
cargo codspeed build --locked -p celox --bench compilation
cargo codspeed run -p celox
cargo codspeed build --locked --measurement-mode walltime -p celox --bench compilation
cargo codspeed run --measurement-mode walltime -p celox --bench compilation
```

## Finish validation
Expand Down
8 changes: 8 additions & 0 deletions conformance/sv-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,14 @@ the assertion. The [reviewed full CI run](https://github.com/celox-sim/celox/act
contains 2054 case/mode verdicts; these are the only two changed rows, and all
verdicts match the updated expectations.

Accepting undriven nets updates both rows for
`5.6.4--compiler-directives-pragma` from fail to pass. Its `protected_wire`
has no driver and now elaborates with the standard net default (IEEE 1800-2023
6.6 and 6.7.1). The official runner selects elaboration for this probe; runtime
high-impedance values are checked by the shared undriven-net simulation cases.
The [reviewed CI run](https://github.com/celox-sim/celox/actions/runs/40112270471)
changes only these two verdicts across 2,054 mode runs.

The report contains each case’s state mode, verdict, selected execution mode,
tags, tool return code and path to the official log. The output directory retains
both the official log and runner diagnostics for each case and state mode.
Expand Down
8 changes: 4 additions & 4 deletions conformance/sv-tests/expected.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -979,8 +979,8 @@ chapter-23/23.2--module-definition.sv 2state pass
chapter-23/23.2--module-definition.sv 4state pass
chapter-23/23.2--module-label.sv 2state pass
chapter-23/23.2--module-label.sv 4state pass
chapter-24/24.3--program.sv 2state fail
chapter-24/24.3--program.sv 4state fail
chapter-24/24.3--program.sv 2state pass
chapter-24/24.3--program.sv 4state pass
chapter-25/25.3-interface.sv 2state pass
chapter-25/25.3-interface.sv 4state pass
chapter-26/26.2--package-decl.sv 2state pass
Expand Down Expand Up @@ -1039,8 +1039,8 @@ chapter-5/5.6.4--compiler-directives-define.sv 2state pass
chapter-5/5.6.4--compiler-directives-define.sv 4state pass
chapter-5/5.6.4--compiler-directives-include.sv 2state pass
chapter-5/5.6.4--compiler-directives-include.sv 4state pass
chapter-5/5.6.4--compiler-directives-pragma.sv 2state fail
chapter-5/5.6.4--compiler-directives-pragma.sv 4state fail
chapter-5/5.6.4--compiler-directives-pragma.sv 2state pass
chapter-5/5.6.4--compiler-directives-pragma.sv 4state pass
chapter-5/5.6.4--compiler-directives-preprocessor-macro_0.sv 2state skip
chapter-5/5.6.4--compiler-directives-preprocessor-macro_0.sv 4state skip
chapter-5/5.6.4--compiler-directives-preprocessor-macro_1.sv 2state pass
Expand Down
100 changes: 96 additions & 4 deletions crates/celox-design/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,86 @@ pub struct TriggerSet<A> {
pub resets: Vec<A>,
}

#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum RuntimeEventKind {
Display,
Write,
AssertContinue,
AssertFatal,
/// A message of a severity task, or of a Veryl assertion
/// (IEEE 1800-2023 20.10). [`Severity::Fatal`] ends the simulation with
/// an error.
Report(Severity),
/// `$finish` executed by the design (IEEE 1800-2023 20.2).
Finish,
/// `$stop` executed by the design (IEEE 1800-2023 20.2).
Stop,
}

impl RuntimeEventKind {
/// A report that ends the simulation with an error.
pub fn is_fatal(self) -> bool {
self == Self::Report(Severity::Fatal)
}
}

/// The severity of a report (IEEE 1800-2023 20.10).
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub enum Severity {
/// `$info`: a message of no specific severity.
Info,
/// `$warning`.
Warning,
/// `$error`, and the default action of a failed `assert` or `assume`.
Error,
/// `$fatal`.
Fatal,
}

/// Where a report is written: the file and line of `__FILE__` and
/// `__LINE__` at the task call (IEEE 1800-2023 20.10).
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct ReportLocation {
pub file: String,
pub line: usize,
}

/// The assertion whose action block issues a report.
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct AssertionSite {
/// The statement label, which names the assertion within its scope
/// (IEEE 1800-2023 16.3).
pub label: Option<String>,
pub directive: AssertionDirective,
pub deferral: AssertionDeferral,
pub outcome: AssertionOutcome,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AssertionDirective {
Assert,
Assume,
Cover,
}

/// When an assertion reports (IEEE 1800-2023 16.4).
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AssertionDeferral {
/// A simple immediate assertion: at once.
None,
/// `#0`: in the Reactive region.
Observed,
/// `final`: in the Postponed region.
Final,
}

/// Which action block of an assertion issues a report.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AssertionOutcome {
/// The pass action, or the statement of a `cover`.
Pass,
/// The fail action.
Fail,
}

/// How a runtime event site sizes its formatted arguments.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
pub enum DisplaySizing {
Expand All @@ -118,6 +186,11 @@ pub struct RuntimeEventSite {
pub sizing: DisplaySizing,
/// Fully elaborated module-instance scope that emitted this event.
pub scope: Option<String>,
#[serde(default)]
pub location: Option<ReportLocation>,
/// The assertion whose action issues this report.
#[serde(default)]
pub assertion: Option<AssertionSite>,
pub arg_widths: Vec<usize>,
pub arg_signed: Vec<bool>,
pub arg_is_string: Vec<bool>,
Expand Down Expand Up @@ -291,6 +364,9 @@ pub enum ProcessStatus {
/// A synchronous host operation. The delay slot holds its family and
/// local site index; the same process resumes after the host responds.
HostRequest,
/// A program kernel called `$exit` (IEEE 1800-2023 24.7): it and every
/// other kernel of its program instance ([`ProcessSlots::program`]) end.
Exit,
}

impl ProcessStatus {
Expand All @@ -308,6 +384,7 @@ impl ProcessStatus {
Self::Yield => 8,
Self::Stop => 9,
Self::HostRequest => 10,
Self::Exit => 11,
}
}

Expand All @@ -323,6 +400,7 @@ impl ProcessStatus {
8 => Some(Self::Yield),
9 => Some(Self::Stop),
10 => Some(Self::HostRequest),
11 => Some(Self::Exit),
_ => None,
}
}
Expand Down Expand Up @@ -465,6 +543,12 @@ pub struct ProcessSlots<A> {
/// Every delay the kernel suspends for is a constant of at least one
/// time unit.
pub const_delays: bool,
/// For an `initial` procedure of a program instance (IEEE 1800-2023
/// 24.3), the status slot of that instance's first such kernel, which
/// every kernel of the instance names: the kernel runs in the reactive
/// region set (24.3.1), and `$exit` and the end of the instance's
/// kernels act on them together (24.7). `None` for design code.
pub program: Option<A>,
pub resume: A,
pub status: A,
pub delay: A,
Expand All @@ -476,6 +560,7 @@ impl<A> ProcessSlots<A> {
is_initializer: self.is_initializer,
requires_timed_simulation: self.requires_timed_simulation,
const_delays: self.const_delays,
program: self.program.map(&mut map),
resume: map(self.resume),
status: map(self.status),
delay: map(self.delay),
Expand Down Expand Up @@ -1058,6 +1143,9 @@ pub struct SchedulerSchema<A> {
/// The event signals a host periodic clock may drive inside the
/// scheduler's slots, in the order of its clock slots.
pub clocks: Vec<A>,
/// Per process kernel, the event signals it writes, as indices into
/// [`Self::events`]; empty for a kernel the scheduler does not run.
pub kernel_events: Vec<Vec<usize>>,
}

impl<A> SchedulerSchema<A> {
Expand All @@ -1069,6 +1157,7 @@ impl<A> SchedulerSchema<A> {
fallback: self.fallback,
events: self.events.into_iter().map(&mut map).collect(),
clocks: self.clocks.into_iter().map(map).collect(),
kernel_events: self.kernel_events,
}
}
}
Expand Down Expand Up @@ -1791,6 +1880,7 @@ mod tests {
ProcessStatus::from_code(10),
Some(ProcessStatus::HostRequest)
);
assert_eq!(ProcessStatus::from_code(11), Some(ProcessStatus::Exit));
}

#[test]
Expand Down Expand Up @@ -1883,10 +1973,12 @@ mod tests {
let mut runtime = RuntimeSchema::default();
runtime.runtime_errors.insert(1, error.clone());
runtime.runtime_event_sites.push(RuntimeEventSite {
kind: RuntimeEventKind::AssertFatal,
kind: RuntimeEventKind::Report(Severity::Fatal),
template: Some("failed".to_string()),
sizing: DisplaySizing::Veryl,
scope: None,
location: None,
assertion: None,
arg_widths: Vec::new(),
arg_signed: Vec::new(),
arg_is_string: Vec::new(),
Expand Down
Loading
Loading