From c836d04373e61acdf80e1d47ed082c4dfed86e1f Mon Sep 17 00:00:00 2001 From: tignear Date: Thu, 29 Oct 2026 10:45:54 +0900 Subject: [PATCH 1/2] fix(sv): accept class typedefs as members of class structures A structure declared in a class whose members use the typedefs of the class or of its bases, such as `uvm_comparer`'s `typedef struct { recursion_state_e state; bit ret_val; } state_info_t;` with `recursion_state_e` from `uvm_policy`, was rejected as an unsupported struct member. The scope validation binds every structure type with the module's dimensions, where the class scope is not visible. Such a structure is now left to the class, which binds it in its scope and still rejects members that are not supported. Change-Id: Idba00fb69517fe94dd5039ca6679bbd6e719af9f --- .../celox-sv-analyzer/src/ast/validation.rs | 9 ++++++ .../systemverilog/unpacked_structs.rs | 31 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/crates/celox-sv-analyzer/src/ast/validation.rs b/crates/celox-sv-analyzer/src/ast/validation.rs index 6e352d6afe1..63800cb1f2c 100644 --- a/crates/celox-sv-analyzer/src/ast/validation.rs +++ b/crates/celox-sv-analyzer/src/ast/validation.rs @@ -834,6 +834,15 @@ fn validate_scope( if !selected(data.tokens) { continue; } + // A structure of a class may name the typedefs of the class and its + // bases, which only the class scope resolves; the class binds it. + if native + .classes + .iter() + .any(|class| contains(class.tokens, data.tokens)) + { + continue; + } if matches!(data.kind, DataTypeKind::Struct { .. }) && type_binding::bind(id, syntax_tree, indexed_dimensions)?.is_none() { diff --git a/crates/celox/tests/frontends/systemverilog/unpacked_structs.rs b/crates/celox/tests/frontends/systemverilog/unpacked_structs.rs index 9db470da720..c6b6441ee1d 100644 --- a/crates/celox/tests/frontends/systemverilog/unpacked_structs.rs +++ b/crates/celox/tests/frontends/systemverilog/unpacked_structs.rs @@ -341,6 +341,37 @@ sv_backends! { let value = sim.signal("value"); assert_eq!(sim.get(value), BigUint::from(1231u16)); } + fn structure_members_of_class_typedefs(sim) { + @setup { + let source = r#"module Top(output int value); + class Base; + typedef enum { NEVER, STARTED, FINISHED } rs_e; + endclass + class C extends Base; + typedef bit [3:0] nibble_t; + typedef struct { rs_e state; nibble_t n; bit ret_val; } st_t; + st_t m[string]; + function int f(); + st_t s; + s.state = rs_e'(2); + s.n = 4'h9; + s.ret_val = 1; + m["a"] = s; + return m["a"].state * 100 + m["a"].n * 10 + m["a"].ret_val; + endfunction + endclass + initial begin + C c; + c = new; + value = c.f(); + end + endmodule"#; + } + @build celox::Simulation::from_sv_sources(vec![(source, Path::new("struct.sv"))], "Top"); + sim.run_until(0).unwrap(); + let value = sim.signal("value"); + assert_eq!(sim.get(value), BigUint::from(291u16)); + } fn structure_defaults_descend_to_members_of_their_type(sim) { @setup { let source = r#"module Top(output int value); From 116a1deef7bfb99b41204cddd07962afd0665d67 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 29 Oct 2026 07:33:26 +0000 Subject: [PATCH 2/2] chore(deps): update dependency pytest to v9.2.0 --- benchmarks/taxi/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/taxi/requirements.txt b/benchmarks/taxi/requirements.txt index e7ded5981dc..76638388c1b 100644 --- a/benchmarks/taxi/requirements.txt +++ b/benchmarks/taxi/requirements.txt @@ -4,7 +4,7 @@ cocotb-bus==0.3.0 cocotbext-axi==0.1.28 cocotbext-eth==0.1.28 find_libpython==0.5.1 -pytest==9.0.3 +pytest==9.2.0 scapy==2.8.0 iniconfig==2.3.1 packaging==26.3