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 diff --git a/crates/celox-sv-analyzer/src/ast/validation.rs b/crates/celox-sv-analyzer/src/ast/validation.rs index 6a6ffb93289..ef4bc44a35e 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);