r/embedded • u/ActBrokeToStayRich • 4d ago
Emulation and Simulation
In the last year AI has completely taken over how much my team used AI and We were able to basically just Gen code left right and center. Using connected hardware CI/CD works to a certain extent but it felt like we really need better ways to handle the type of load that AI was putting for the pace we "needed" to be going with agents.
So when generation is easy and validation is still hard, how useful are people finding emulation/simulation? And since its important this is for usually post silicon micro-controller level work IOT, automotive etc.
7
u/mossy_stile 4d ago
Renode only simulates the datasheet, not the silicon errata.
6
u/PurpleSupermarket1 4d ago
I have Claude making changes and running it on emulation. Emulation is very helpful to find RTL issues. This is pre-silicon.
5
u/Simple_Tough4223 4d ago
Instead of using (or even building) a simulator/emulator, I would rather build a hook/mcp for the agent to knows what's happening in the board, or at least hook a debug tool for the agent to handle and understand what's going on. And even it can mock peripheral to "simulate" directly in the hardware instead of a sim tool in computer.
And if it needs you to interact your board, it can pause and ask/guide you do to, then it will auto continue.
4
u/ArgVoid42 3d ago
In my experience, simulation is super useful as long as you're clear about what you're actually testing with it.
I use PC simulation a lot for complex state machines (including sub-state machines) per unit. Since I can just spin up a thread per unit on a PC, I can simulate the actual network communication and timing interactions between multiple units way faster than on a physical test bench.
For the hardware layer, I keep it simple with stubs and mocks instead of trying to emulate silicon accurately. For example, for hardware ID detection (an ADC reading from a resistor voltage divider), I just stub it directly. For something like a stepper motor on a robot arm, I use a mock so I can inject whatever state, position, or fault I want and verify how the state machines react.
It obviously won't catch silicon errata or real electrical quirks, so you still need the hardware farm at the end. But it takes a huge load off your physical CI boards because you catch almost all the state machine, protocol, and fault-handling bugs on PC first.
4
u/Ohmic_Test_Systems 3d ago
Making Renode simulations has been very powerful for me. With Claude and a debugger you can scrape all the registers and put together a good simulation quickly. Same goes for sensors IC's too.
There's several projects where I do all my firmware development in Renode now and don't need the hardware. Which opens up the door to many parallel devices working on different firmware tickets at the same time. Really powerful if done right.
14
u/madsci 4d ago
I have yet to find anything that I need simulated where I could depend on the simulation to model the behavior I'm interested in. If the hardware always worked the same as the documentation says, I wouldn't have all of these bugs to figure out.
4
u/RepresentativeCut486 STM32 Supremacy 4d ago
Simulacra and Simulation
3
u/duane11583 3d ago
Hire experienced engineers and pay them
You need to understand the code ai creates otherwise you Mr company has no value
1
u/Aggressive_Canary_10 4d ago
I have been using Ai to write code and have been running it on cadence emulation platforms. The Ai was helpful in coding as well as to give me assistance in using the cadence tools.
2
u/ventZl CMRX RTOS 2d ago
We isolate hardware behind the driver API which abstracts hardware behavior away. Not that we put a thick abstraction on top of the HW. The difference in HW behavior is a problem of the driver. It **MUST** provide stable behavior.
Then the rest is just a standard application software. So we'll usually build spec-compliant mock of the driver and assemble the software on top of it for testing purposes.
You can do A LOT this way.