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: 14 additions & 4 deletions .github/RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,20 @@ produce a patch version while the changelog still displays a title containing

## Automated release train

Release Please maintains one release pull request against `master`. Every Monday
(and on manual dispatch), the release workflow requests Mergify queueing.
`release:hold` prevents queueing and merging. While the open release PR carries
`merge-ready` or `queued`, Release Please freezes its head for the queue.
On each `master` push, Release Please calculates the next version and release
notes and updates a single **Celox release tracker** issue. This planning step
creates no branch or pull request, so ordinary changes do not trigger release
PR CI. The planner uses the pinned dependency in `scripts/release-please/`;
update its package and lockfile together when upgrading Release Please.

Every Monday at 12:00 JST (and on manual dispatch), the release workflow creates
or updates the release pull request against `master` and requests Mergify queueing.
It closes the tracker with a link to the PR once preparation succeeds.
`release:hold` on the tracker postpones PR creation and queueing. After a PR
exists, put `release:hold` on that PR to prevent queueing and merging. While the
open release PR carries `merge-ready` or `queued`, Release Please freezes its
head for the queue. The push workflow only updates the issue, including while a
release PR is open; it never rewrites that PR.

The release PR uses the lightweight merge queue. After it merges,
`stage-release-candidate.yml` advances `release` to that exact merge commit.
Expand Down
46 changes: 44 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,36 @@ concurrency:
permissions: {}

jobs:
release-issue:
name: Update release issue
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
# GitHub's generate-notes endpoint requires contents:write, even though
# planning does not save a release, tag, branch or commit.
contents: write
issues: write
pull-requests: read
steps:
- uses: actions/checkout@v7
- name: Install release planner
run: npm ci --ignore-scripts --prefix scripts/release-please
- name: Update release tracker without opening a pull request
env:
GH_TOKEN: ${{ github.token }}
run: node scripts/release-issue.mjs

release-please:
name: Update release pull request
name: Prepare weekly release pull request
outputs:
held: ${{ steps.release-issue.outputs.held }}
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

# Resources created with GITHUB_TOKEN do not start follow-up workflows.
# Use an installation token so release PR checks and release-triggered
# publisher workflows run normally. Workflows permission also allows a
Expand All @@ -35,6 +61,14 @@ jobs:
permission-pull-requests: write
permission-workflows: write

- name: Check whether the release issue is held
id: release-issue
env:
GH_TOKEN: ${{ steps.release-token.outputs.token }}
run: |
held="$(node scripts/release-issue.mjs held)"
echo "held=$held" >> "$GITHUB_OUTPUT"

# Freeze the source PR as soon as queueing is requested, including while
# waiting for admission or after a dequeue. Rewriting it invalidates the
# queue's speculative trees, including those of PRs stacked behind it.
Expand All @@ -54,6 +88,7 @@ jobs:

- name: Create release or update release pull request
id: release
if: steps.release-issue.outputs.held != 'true'
uses: googleapis/release-please-action@v5
with:
token: ${{ steps.release-token.outputs.token }}
Expand All @@ -63,10 +98,17 @@ jobs:
skip-github-release: true
skip-github-pull-request: ${{ steps.release-pr.outputs.frozen == 'true' }}

- name: Close tracker after preparing the release PR
if: steps.release.outputs.prs_created == 'true'
env:
GH_TOKEN: ${{ steps.release-token.outputs.token }}
RELEASE_PR_NUMBER: ${{ fromJSON(steps.release.outputs.pr).number }}
run: node scripts/release-issue.mjs

queue-release:
name: Queue weekly release
needs: release-please
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
if: needs.release-please.outputs.held != 'true' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
2 changes: 2 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ disallowed-methods = [
disallowed-types = [
{ path = "std::collections::HashMap", reason = "compiler data is trusted; use fxhash::FxHashMap (or the crate HashMap alias) to avoid RandomState overhead" },
{ path = "std::collections::HashSet", reason = "compiler data is trusted; use fxhash::FxHashSet (or the crate HashSet alias) to avoid RandomState overhead" },
{ path = "std::cell::RefCell", reason = "state is owned and passed explicitly: take &mut, return results, or key caches by all their inputs instead of mutating shared state behind shared references" },
{ path = "std::cell::Cell", reason = "state is owned and passed explicitly: take &mut, return results, or key caches by all their inputs instead of mutating shared state behind shared references" },
]
4 changes: 4 additions & 0 deletions conformance/sv-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ modes of `13.3.1--task-static` now pass. Its `int a = 0;` in a static task is
initialized once and shared by the four calls, which print 1, 2, 3 and 4 in
the local simulation driver; the full run reports no other change.

The `chandle` type updates two expectations: both state modes of
`6.14--chandle`, which declares a chandle variable, now pass. It is the only
fail-to-pass transition in the full local run; no failure expectation is broadened.

The official runner’s process exit code is separate from the case verdict.
The wrapper reads its `PASS`/`FAIL` log messages; it does not reconstruct their
rules from tool exit codes or `should_fail` metadata. A negative test may pass
Expand Down
4 changes: 2 additions & 2 deletions conformance/sv-tests/expected.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -1107,8 +1107,8 @@ chapter-6/6.12--shortreal.sv 2state pass
chapter-6/6.12--shortreal.sv 4state pass
chapter-6/6.13--void.sv 2state pass
chapter-6/6.13--void.sv 4state pass
chapter-6/6.14--chandle.sv 2state fail
chapter-6/6.14--chandle.sv 4state fail
chapter-6/6.14--chandle.sv 2state pass
chapter-6/6.14--chandle.sv 4state pass
chapter-6/6.16--string.sv 2state pass
chapter-6/6.16--string.sv 4state pass
chapter-6/6.16.1--string_len.sv 2state pass
Expand Down
17 changes: 10 additions & 7 deletions crates/celox-frontend-sv/src/lowering/hierarchy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,11 +672,14 @@ fn resolved_type(module: &ElaboratedModule, r#type: &sv::ir::Type) -> Option<sv:
.iter()
.map(|range| unpacked_range_bounds(range, &module.constants, &module.parameter_types))
.collect::<Option<Vec<_>>>()?;
Some(sv::ast::Type::resolved(
kind,
r#type.is_signed(),
r#type.signed_element_depth(),
&packed,
&unpacked,
))
Some(
sv::ast::Type::resolved(
kind,
r#type.is_signed(),
r#type.signed_element_depth(),
&packed,
&unpacked,
)
.with_chandle(r#type.is_chandle()),
)
}
5 changes: 5 additions & 0 deletions crates/celox-frontend-sv/src/lowering/procedural.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,11 @@ impl<'a> ProcModule<'a> {
sv::ir::DpiType::Bit => ExternType::Bit,
sv::ir::DpiType::Logic => ExternType::Logic,
sv::ir::DpiType::Integer { width, signed } => ExternType::Integer { width, signed },
// A pointer, 64 bits on the supported hosts.
sv::ir::DpiType::Chandle => ExternType::Integer {
width: 64,
signed: false,
},
};
let function = ExternFunction {
name: import.c_name().to_string(),
Expand Down
74 changes: 73 additions & 1 deletion crates/celox-sv-analyzer/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,11 @@ impl Module {
&type_aliases,
header_ports,
)?;
if let Some(port) = ports.iter().find(|port| port.r#type.holds_chandle()) {
return Err(AnalyzerError::IllegalChandleUse {
detail: format!("port `{}` of chandle type", port.name),
});
}
ports.extend(imported.ports.iter().cloned());
let mut port_names = HashSet::default();
if let Some(port) = ports.iter().find(|port| !port_names.insert(port.name())) {
Expand Down Expand Up @@ -1242,6 +1247,37 @@ impl Module {
let dpi_items = generate::items(syntax_tree, session, &const_env, &type_aliases)?;
let mut dpi_imports = dpi::imports(&dpi_items, syntax_tree, session, &type_aliases)?;
for import in &dpi_imports {
// Shapes check the actuals as assignments to the formals.
subroutine_shapes.insert(
import.name().to_string(),
import
.arguments()
.iter()
.filter_map(|argument| {
let r#type = match argument.r#type() {
crate::ir::DpiType::Bit => type_binding::builtin_type("bit", None),
crate::ir::DpiType::Logic => {
type_binding::builtin_type("logic", None)
}
crate::ir::DpiType::Chandle => {
type_binding::builtin_type("chandle", None)
}
crate::ir::DpiType::Integer { width, signed } => {
type_binding::builtin_type(
match width {
8 => "byte",
16 => "shortint",
32 => "int",
_ => "longint",
},
Some(signed),
)
}
}?;
Some(procedural::dimensions_from_type(&r#type))
})
.collect(),
);
subroutine_params.insert(
import.name().to_string(),
import
Expand Down Expand Up @@ -1434,6 +1470,7 @@ impl Module {
signed: function.return_signed,
is_2state: function.return_is_2state,
string: function.return_string,
chandle: function.return_chandle,
pattern_type: function.return_type.clone(),
enum_domain: function.return_enum_domain.clone(),
class: function.return_class.clone(),
Expand All @@ -1452,10 +1489,13 @@ impl Module {
width: Some(r#type.width()),
first_packed_dimension_width: (r#type.width() > 1)
.then_some(r#type.width()),
dimensions: Some(usize::from(r#type.width() > 1)),
dimensions: Some(usize::from(
r#type.width() > 1 && r#type != crate::ir::DpiType::Chandle,
)),
signed: r#type.is_signed(),
is_2state: !r#type.is_4state(),
string: false,
chandle: r#type == crate::ir::DpiType::Chandle,
pattern_type: None,
enum_domain: None,
class: None,
Expand Down Expand Up @@ -2476,6 +2516,9 @@ pub struct Type {
/// The typedef that names an enumeration, struct or union type, and how
/// `$typename` spells the type where its structure does not tell.
spelling: type_names::Spelling,
/// A `chandle` (IEEE 1800-2023 6.14): an opaque 64-bit C pointer, held
/// as 2-state bits, whose uses the analyzer restricts.
chandle: bool,
}

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -2505,6 +2548,7 @@ impl Type {
container: None,
unpacked_struct: None,
spelling: type_names::Spelling::default(),
chandle: false,
}
}

Expand All @@ -2524,6 +2568,7 @@ impl Type {
container: None,
unpacked_struct: None,
spelling: type_names::Spelling::default(),
chandle: false,
}
}

Expand All @@ -2544,6 +2589,16 @@ impl Type {
self.spelling.declaration()
}

/// Whether the type is a chandle or an unpacked structure with a
/// chandle member, which no port may have and no randomization fill
/// (IEEE 1800-2023 6.14).
pub(in crate::ast) fn holds_chandle(&self) -> bool {
self.chandle
|| self
.unpacked_struct()
.is_some_and(|aggregate| aggregate.leaves().iter().any(|leaf| leaf.r#type.chandle))
}

/// The members of an unpacked structure type.
pub(in crate::ast) fn unpacked_struct(&self) -> Option<&Arc<unpacked_structs::UnpackedStruct>> {
self.unpacked_struct.as_ref()
Expand Down Expand Up @@ -2624,6 +2679,17 @@ impl Type {
..Self::new(kind)
}
}

/// Whether the type is a `chandle`.
pub(crate) fn is_chandle(&self) -> bool {
self.chandle
}

/// The type, a `chandle` if `chandle` (see [`crate::ir::Type::is_chandle`]).
pub fn with_chandle(mut self, chandle: bool) -> Self {
self.chandle = chandle;
self
}
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -3103,6 +3169,8 @@ struct Function {
return_string: bool,
/// Whether the function returns a class handle.
return_handle: bool,
/// The function returns a `chandle`.
return_chandle: bool,
name: String,
params: Vec<FunctionParam>,
/// The function's value as one expression of its arguments, or `None`
Expand Down Expand Up @@ -3357,6 +3425,8 @@ struct VariableDimensions {
unpacked_struct: Option<Arc<unpacked_structs::UnpackedStruct>>,
/// The declared type, for `$typename`.
declared: type_names::Declared,
/// A `chandle` variable (see [`Type::chandle`]).
chandle: bool,
}

type VariablePackedDimensions = HashMap<String, VariableDimensions>;
Expand All @@ -3379,6 +3449,8 @@ struct FunctionReturnMetadata {
is_2state: bool,
/// The function returns a `string`.
string: bool,
/// The function returns a `chandle` (IEEE 1800-2023 6.14).
chandle: bool,
/// Declared aggregate type, available before function bodies are inlined.
pattern_type: Option<Type>,
/// The members of an enumerated return type, for its methods.
Expand Down
2 changes: 1 addition & 1 deletion crates/celox-sv-analyzer/src/ast/array_parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ fn array_parameters_from_declaration(
// default. Only defaults actually consumed here require their native ID.
let native_pattern = if bound.is_none() { pattern } else { None };
let parameter = ArrayParameter {
signal: Signal::new(name, type_with_unpacked_ranges(element, ranges)),
signal: Signal::new(name, type_with_unpacked_ranges(element, ranges)?),
native_pattern,
bound,
};
Expand Down
13 changes: 13 additions & 0 deletions crates/celox-sv-analyzer/src/ast/array_reductions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ use super::*;
use celox_sv_syntax::{Declarations, ExprId, ExprKind};
use system_functions::ContainerOp;

/// A chandle is no integral value to combine (IEEE 1800-2023 6.14).
fn chandle_elements() -> AnalyzerError {
AnalyzerError::IllegalChandleUse {
detail: "an array reduction of chandle elements".into(),
}
}

pub(super) fn bind(
id: ExprId,
native: &Declarations,
Expand Down Expand Up @@ -53,6 +60,9 @@ pub(super) fn bind(
"array reduction of elements wider than 64 bits",
));
}
if expression_binding::type_holds_chandle(&container.element) {
return Err(chandle_elements());
}
if container.layout.handle.is_some() {
return Err(unsupported("array reduction requires integral elements"));
}
Expand Down Expand Up @@ -87,6 +97,9 @@ pub(super) fn bind(
"array reduction arguments require a with expression",
));
}
if expression_binding::holds_chandle(shape) {
return Err(chandle_elements());
}
if shape.unpacked.len() != 1 || shape.real || shape.string || shape.class.is_some() {
return Err(unsupported(
"array reduction requires one-dimensional integral elements",
Expand Down
1 change: 1 addition & 0 deletions crates/celox-sv-analyzer/src/ast/classes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ impl Class {
}
if (property.rand || property.randc)
&& (property.field.handle.is_some()
|| property.r#type.holds_chandle()
|| (property.r#type.is_enum && property.r#type.enum_domain.is_none()))
{
return Err(unsupported(
Expand Down
4 changes: 4 additions & 0 deletions crates/celox-sv-analyzer/src/ast/classes/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ pub(in crate::ast) fn bind_inputs(
if property.field.four_state {
return Err("4-state class property in a constraint".into());
}
// A chandle has no integral value to constrain (6.14).
if property.r#type.holds_chandle() {
return Err("a chandle in a constraint".into());
}
Typed {
kind: Kind::Leaf(ConstraintExpr::Field(index)),
width: property.field.width,
Expand Down
Loading
Loading