From eecd74700ff7b4aa66aa3cdb08deff4f35292454 Mon Sep 17 00:00:00 2001 From: tignear Date: Tue, 27 Oct 2026 02:56:44 +0900 Subject: [PATCH] perf(vpi): compile process-capable images without retrying VPI builds first compiled an untimed Simulator image and, after detecting a process, repeated frontend analysis and SIR optimization with Simulation. Compile the process-capable Simulation native image directly for both process-free and process-containing SystemVerilog DUTs. Keep the configured optimization level, diagnostics, parameter overrides and signal access settings. This removes the complete Simulator-to-Simulation retry without disabling optimization. Large VCU108 and HTG9200 native compilations remain a performance issue; this change does not claim that all Taxi configurations or runtime tests pass. Validation: 166 normal celox-vpi tests passed, all eight explicitly selected cocotb tests passed, affected VPI clippy with warnings denied, formatting and diff checks. Cocotb coverage includes a process-free flip-flop, DUT processes, edge/NBA ordering, force/release, unpacked arrays, finish and femtosecond clocks. Change-Id: I6439f16cd7cc0f3b26019b6c8bccb526b7fb1302 --- crates/celox-vpi/src/bin/celox.rs | 37 +++++++++---------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/crates/celox-vpi/src/bin/celox.rs b/crates/celox-vpi/src/bin/celox.rs index 225e09851ca..e5829c56bd8 100644 --- a/crates/celox-vpi/src/bin/celox.rs +++ b/crates/celox-vpi/src/bin/celox.rs @@ -839,35 +839,18 @@ fn compile_native_design(design: &Design) -> Result .iter() .map(|(text, path)| (text.as_str(), path.as_path())) .collect(); - let untimed = configure_sv( + // VPI advances time and dispatches callbacks even for a process-free + // DUT. Compile its process-capable image directly, rather than first + // compiling an untimed image and repeating analysis and optimization + // when that builder discovers a process. + let simulation = configure_sv( design, - celox::Simulator::from_sv_sources(refs.clone(), &design.top), + celox::Simulation::from_sv_sources(refs, &design.top), ) - .compile_native(); - let image = match untimed { - Ok(simulator) => { - report_warnings(simulator.warnings())?; - simulator.into_program_image() - } - // A design with processes runs as a timed simulation, in step - // with the VPI time callbacks. - Err(error) - if matches!( - error.kind(), - celox::SimulatorErrorKind::ProcessRequiresSimulation(_) - ) => - { - let simulation = configure_sv( - design, - celox::Simulation::from_sv_sources(refs, &design.top), - ) - .compile_native() - .map_err(|error| format!("compilation failed:\n{error}"))?; - report_warnings(simulation.warnings())?; - simulation.into_program_image() - } - Err(error) => return Err(format!("compilation failed:\n{error}")), - }; + .compile_native() + .map_err(|error| format!("compilation failed:\n{error}"))?; + report_warnings(simulation.warnings())?; + let image = simulation.into_program_image(); return Ok(image); } #[cfg(not(feature = "systemverilog"))]