Repository navigation
feat(sim): build a timed Simulation from a native image - #1926
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f22d0d6706
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Queued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 2 hours 15 minutes 56 seconds in the queue, including 1 hour 29 minutes 6 seconds running CI. ReasonThe merge conditions cannot be satisfied due to failing checks
Failing checks: HintYou may have to fix your CI before adding the pull request to the queue again. Waiting for
All conditions
Requeued — the merge queue status continues in this comment ↓. |
Simulation's builder gets compile_native, which returns a NativeCompilation<Simulation> whose image carries the process kernels and the compiled scheduler, and build_native_from_image, which starts a timed simulation of such an image without code generation. A differential simulation loads a second copy of the image for its reference-loop shadow. Simulation::advance_to runs the slots before a time and stops there, so a host can act at the start of that slot. NativeProgramInstance now fails to attach an image with process kernels, as every Simulator loader already does. Part of #1730 Change-Id: I94db5d6a6ee51fd7059303f78a0c7b8cadd9312c
build_native_from_image and NativeCompilation<Simulation>::initialize now make the packed-array check of the untimed native loader, through one shared validate_native_vcd_layout: an image compiled without VCD cannot record element-strided unpacked arrays. Change-Id: I4d968bb5136d9fe772ec0afedb8f648161900f3a
A cross-compiling build, such as x86-64 code generation on AArch64, cannot execute an image: start_native_image is now a separate stub there instead of an early return, so no binding of the real loader is left unused. Change-Id: Ief37d80cf28c9ee09417a864934ff01b9e6617df
Program-rejection cases of the timing group are untimed designs: their native-image backend round-trips a Simulator image, with the same language-rejection classification as the other untimed backends. Change-Id: Ie295e8c565eba3dc382ba8b5624f7ebb75aa513f
7e97e2e to
5835d61
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Merge Queue Status
This pull request spent 52 minutes 16 seconds in the queue, including 25 minutes 45 seconds running CI. Required conditions to merge
|
Part of #1730 (PR 1 of 3; the plan is in the issue thread with the coordinator). This PR changes no VPI behaviour. It adds what the cocotb host will build on: a timed
Simulationthat runs from a native image.Change
SimulatorBuilder<Simulation>::compile_native()returns aNativeCompilation<Simulation>.NativeCompilationnow has a target parameter that defaults toSimulator, so existing code is unchanged. The image is compiled with the trigger stores and the compiled scheduler unit, and carries the process kernels.NativeCompilation<Simulation>::initialize()starts a timed simulation of it in-process.SimulatorBuilder<Simulation>::build_native_from_image(image)starts a timed simulation of an image without code generation. It mirrorsSimulator's method of the same name: the runtime metadata comes from the image, and the builder supplies only runtime options (scheduler mode, DPI symbols, plusargs, VCD).Differentialmode it loads a second copy of the image as the reference-loop shadow. The scheduler unit is simply unused there.build_with_backendintostart_shadow, which both paths use.Simulation::advance_to(time)runs every slot beforetime, then moves time totimewithout running that slot. Host writes made next join the slot, ahead of the processes that resume in it. The VPI host needs this to firecbAfterDelay/cbNextSimTimeat the start of a slot:run_until(T)would already have run slot T.NativeProgramInstance::from_imagenow fails to attach an image with process kernels. It reports the existingAttacherror withProcessRequiresSimulation, the same check everySimulatorloader already makes (Simulator silently ignores process kernels #1712).Image format
No change. The container stays at v34, so this is not a breaking change:
scheduler::attach), which the image already serializes (process_offsets,runtime_schema.scheduler).A process-free image from
Simulator::compile_nativealso loads as aSimulation. It runs every time slot in the reference loop, never in compiled slots, because it has no scheduler unit. The test checks that its state file afteradd_clockandrun_until(97)equals a freshSimulationbuild's (compiled_slots == 0).Tests
crates/celox/tests/native_simulation_image.rs:always #5,always_ff, delays,@(posedge)and$display. It runs from container bytes, matching the in-processbuild_nativeevents and outputs, with compiled slots taken;initialize()gives the same result;Simulator::build_native_from_imageandNativeProgramInstance::from_image;advance_to: stops before the slot, a host write at that time is seen by the process resuming there, and an earlier target is a no-op.native_imagebackend: compile, encode, decode, load and run every timed case. All 124 pass, with the default scheduler and withCELOX_SCHEDULER=differential.Validation
node scripts/run-vtest.mjs --test systemverilog: 4666 passed.cargo nextest run -p celox --lib --features celox/systemverilog,...: 214 passed.cargo nextest run -p celox-vpi --features systemverilog: 140 passed.cargo nextest run -p celox --test native_simulation_image: 5 passed.cargo clippy -p celox -p celox-vpi --all-targets -- -D warningsandcargo fmt --check: clean.#[ignore]cocotb e2e tests. The VPI host is unchanged for every imagevpi buildcan produce today.