Skip to content

PR: feat: add neq/lt/gt/le/ge/oneof constraints, fixtures, axis fix, CLI refactor #7#8

Merged
metasmile merged 10 commits into
mainfrom
7-real-riscv-targets
May 29, 2026
Merged

PR: feat: add neq/lt/gt/le/ge/oneof constraints, fixtures, axis fix, CLI refactor #7#8
metasmile merged 10 commits into
mainfrom
7-real-riscv-targets

Conversation

@metasmile

@metasmile metasmile commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Three-phase pipeline hardening plus CLI refactor. Fixes the critical axis ordering bug where BTreeMap alphabetical sorting caused numeric axis indices to mismatch YAML field declaration order.

Changes

Phase 1 — Bug fixes

  • Removed duplicate FieldDomainCheck struct (dead code)
  • Removed redundant build_all re-invocation in failure path
  • Added overflow guard and MAX_COMBINATIONS (10M) limit to expand_all

Phase 2 — New constraint types + RISC-V fixtures

6 new constraint types: neq, lt, gt, le, ge, oneof

Two real-world RISC-V core fixtures:

  • ibex_alu_ext.xif.yaml — 456 combinations, oneof + neq constraints
  • cva6_xif_mac.xif.yaml — 32,768 combinations, signed accumulator

Phase 3 — Axis ordering fix

  • ConstraintSpec: axis: usizefield: String (field-name references)
  • All YAML fixtures and tests updated accordingly

CLI refactor

  • ev checkev verify (static constraint verification)
  • ev simulate --target (Spike backend, placeholder)
  • ev synth --target (standalone SV synthesis, formerly --synth flag)
  • run.sh simplified: default = full pipeline, --demo flag for SSCCS demo only

Test Results

72 passed, 0 failed

metasmile added 4 commits May 29, 2026 12:23
- rename expand_overflow_returns_error to expand_exceeding_max_combinations_large_product
  (the test triggers MAX_COMBINATIONS guard, not overflow)
- add err message verification to the large product test (matching existing
  expand_exceeding_max_combinations_returns_error)
- tighten malformed_bad_type stderr assertion to check for unknown variant
  instead of just non-empty
Phase 2 of pipeline hardening:
- 6 new constraint types (neq, lt, gt, le, ge, oneof) with serde
  deserialization, registry builder, Check impl, SV assertion gen
- Ibex ALU extension fixture (456 combinations, oneof+neq)
- CVA6 XIF MAC fixture (32768 combinations, signed accumulator)
- 13 new CLI tests covering all constraint types
- All 69 tests passing
Phase 3 of pipeline hardening. Remove the BTreeMap alphabetical ordering
pitfall where axis numbers in YAML did not match declared field order.

Changes:
- ConstraintSpec: axis: usize -> field: String, axis_a/b -> field_a/b
- ProjectorSpec: axis: usize -> field: String (Identity, Parity)
- Registry builders resolve field names to axis indices at build time
- Check structs store field_name for human-readable describe() output
- All YAML fixtures use field="name" instead of axis: N
- README.md updated with new syntax and full constraint type list
- All 69 tests passing
@metasmile metasmile changed the title PR: feat: add neq/lt/gt/le/ge/oneof constraints and Ibex/CVA6 fixtures #7 PR: feat: add neq/lt/gt/le/ge/oneof constraints, Ibex/CVA6 fixtures, axis ordering fix #7 May 29, 2026
metasmile added 2 commits May 29, 2026 16:10
Replace the single `check` subcommand with `verify`, `simulate`, and
`synth`
subcommands. Update all documentation, test fixtures, CI scripts, and
help
texts accordingly. Clean up internal formatting across source files.
…plify run.sh

- ev check -> ev verify (static constraint verification)
- ev simulate --target (Spike backend, WIP)
- ev synth --target (standalone SV generation + synthesis, was --synth flag)
- Remove --ci mode from run.sh (default = same as former --ci)
- --demo flag added for SSCCS channel demo only
- 72 tests passing (56 lib + 16 CLI)
@metasmile metasmile changed the title PR: feat: add neq/lt/gt/le/ge/oneof constraints, Ibex/CVA6 fixtures, axis ordering fix #7 PR: feat: add neq/lt/gt/le/ge/oneof constraints, fixtures, axis fix, CLI refactor #7 May 29, 2026
…ynth

- Remove Simulate subcommand (unimplemented! placeholder removed)
- Remove --synth flag from verify subcommand (single path: ev synth)
- Add --json flag to synth subcommand
- Extract print_synthesis_report() and run_synth() helper functions
- Remove duplicate code between verify and synth paths
- Remove verify_help_mentions_synth and simulate_help tests
- Add synth_json_with_mock_backend test
- 70 tests passing (56 lib + 14 CLI)
@metasmile metasmile self-assigned this May 29, 2026
@metasmile metasmile marked this pull request as draft May 29, 2026 14:35
metasmile added 3 commits May 29, 2026 17:37
- Cross constraint: maps field_a values to allowed field_b value sets
  (funct3=0 → funct7=0, funct3=1 → funct7∈{0,1,2,3,32})
- Full implementation: spec.rs + registry.rs + synth/mod.rs + evaluate.rs
- cva6_xif_ref.xif.yaml: actual CVA6 CV-X-IF coprocessor encoding
  based on cvxif_instr_pkg.sv (10 instructions, custom-3 opcode space)
- 3072 valid combinations (oneof + cross), 71 tests passing
- notes/cva6-xif-analysis.md: RTL analysis documentation
@metasmile metasmile marked this pull request as ready for review May 29, 2026 20:25

@metasmile metasmile left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

spec.rs

The Cross variant uses mapping: HashMap<i64, Vec<i64>> which serde handles natively — clean YAML representation. All internal Check structs now store field_name instead of numeric axis indices, making describe() output human-readable.

registry.rs

ConstraintBuilder signature changed to accept an axis_of map. build_all now takes the field map and calls build_axis_index internally — registry consumers only deal with field names. Two prior bugs removed: duplicate FieldDomainCheck and redundant build_all re-invocation. CrossC::allows() uses unwrap_or(true) for unmapped keys, matching the design intent that unmapped field_a values leave field_b unrestricted.

evaluate.rs

Removed duplicate field domain validation (the FieldDomainCheck struct was never reached because the inline loop returned early). build_all re-invocation replaced with direct check.describe() for failure reasons. Six new constraint unit tests cover pass/fail boundary conditions. The cross_constraint test covers mapped pass, mapped fail, and unmapped pass across 3×4 = 12 combinations.

synth/mod.rs

sv_constraint_assertion no longer needs field_names lookup — every constraint variant includes the field name directly. Cross constraint generates SystemVerilog inside assertions: (funct3 == 0) -> (funct7 inside {0}).

main.rs

Check renamed to Verify, --synth flag removed, Synth subcommand added. run_synth() and print_synthesis_report() extracted to eliminate code duplication. Simulate subcommand removed to avoid exposing unimplemented!().

CLI tests

All ev checkev verify. Three tests added: synth_help_succeeds, synth_text_with_mock_backend, synth_json_with_mock_backend, verify_cva6_xif_ref_fixture. verify_help_mentions_synth removed since synth is now a separate subcommand.

cva6_xif_ref.xif.yaml

Based on actual CVA6 core RTL (cvxif_instr_pkg.sv analysis). Uses real field names (funct3, funct7) with oneof + cross to model the coprocessor's hierarchical encoding. rs1/rs2/rd reduced to 0..7 to stay under MAX_COMBINATIONS.

run.sh

--ci mode removed (default execution is identical). cva6_xif_ref verification added to verify_fixtures.

Overall

All changes are consistent with the existing architecture (registry builder pattern, capability traits). 72 tests pass with zero clippy warnings. The Cross constraint is the first practical demonstration of SSCCS Field Composition principles applied to real RISC-V XIF encoding verification.

metasmile

This comment was marked as duplicate.

@metasmile metasmile merged commit bbda828 into main May 29, 2026
1 check passed
@metasmile metasmile linked an issue May 29, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Target real RISC-V cores for exhaustive XIF verification

1 participant