Coder Social home page Coder Social logo

Latency with MappedMemory about renode HOT 4 OPEN

slosar avatar slosar commented on June 21, 2024
Latency with MappedMemory

from renode.

Comments (4)

mateusz-holenko avatar mateusz-holenko commented on June 21, 2024

Hi @slosar, thanks for asking the question.

Renode simulations operate based on fully-controlled virtual time flow which allows us to obtain reproducible results and recreate scenarios where timing of events is important from the perspective of a simulated application.

Having said that, at the CPU level we operate on a simplified model where we assume that on average execution of each instruction takes the same amount of time. The performance of the CPU itself (the number of executed instructions per virtual second) can be controlled with the PerformanceInMIPS parameter.

For simulation performance reasons accesses to MappedMemory are optimized and executed as pointer operations directly at CPU level to avoid the necessity of executing C# layer.

To assess performance of your system taking into account memory accesses, you might use the post-mortem analysis of the execution traces. Please take a look at https://antmicro.com/blog/2023/07/risc-v-co-design-using-trace-based-simulation-with-renode-and-tbm/ and https://antmicro.com/blog/2022/09/execution-tracing-in-renode/.

Of course extending current CPU model with the notion of long-running instructions is technically possible, but would require some design and implementation work.

from renode.

jzee avatar jzee commented on June 21, 2024

@mateusz-holenko - that's interesting. In a fit of trying to understand what the assumption behind the average execution time is, I simulated an STM32F4 and ran 1M loops of 100 asm("nop") at PerformanceInMIPS = 168 . Then I compared this to the runtime on the actual STM32F4 discovery board, which is clocked at 168MHz.

It turns out that the HW board performs only marginally better than the Renode simulation (613.1ms on HW vs 625ms on renode).

This seems to indicate that the average execution time that renode assumes for a Cortex-M4 is only very slightly (~2%) higher than 1. Is that an expected result? Can I tweak that number somewhere?

from renode.

slosar avatar slosar commented on June 21, 2024

A somewhat related question, would it be possible to implement something like that as a python peripheral. Can python peripheral force "wait" cycles to the CPU? In practice any modern system does not use a constant time to fetch contents of memory location, but any effects of cache, etc should still be quite straightforward to deterministically simulate.

from renode.

slosar avatar slosar commented on June 21, 2024

It turns out that the HW board performs only marginally better than the Renode simulation (613.1ms on HW vs 625ms on renode).

I think any NOP takes exactly one cycle to execute. What you are seeing is almost certainly time "quantization" I think. Have you tried taking 10M loops vs 1M and see if the discrepancy changes?

from renode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.