I'm starting to explore RP2040/Raspberry Pi Pico, however, I was wondering about something: is there a "proper" emulator/simulator for RP2040?
From earlier Atmel experience, Atmel Studio allows access to a simulator: you write your C code for a given chip, and can then run the code in the simulator (very, veeery slowly), and do (say) C code tracepoint printout with cycle-leve accuracy; in addition, you can "stimulate" an GPIO input pin with a representation of, say, a UART serial signal, and then see what sort of effect this has on registers. Specifically, I remember this about it:
The simulator is based on software models of devices derived directly from the hardware designs, and are thus cycle-accurate per the real devices
Basically, that is what I'd want, but for RP2040.
So far, I've found this:
- https://github.com/wokwi/rp2040js - javascript simulator, not sure how much it covers though (or how can I use it outside of a webpage)
- https://github.com/NathanY3G/rp2040-pio-emulator - not all instructions are simulated
... which I don't think provide the kind of functionality like Atmel Simulator.
I found this interesting comment, however:
https://hackaday.com/2021/06/03/gdbdiff-diff-ing-a-real-rp2040-mcu-against-an-emulated-mcu/
No need to write an emulator, it’s 2021 and all the hardware is open hardware!
Just take the VHDL and launch it in Verilator!
What a wonderful world!
My sarcasm detector is broken, so I'm not sure if this is a joke, however https://www.veripool.org/verilator/ is a thing.
So I tried to find HDL sources for RP2040, and there is this blog post:
https://www.raspberrypi.com/news/the-journey-to-raspberry-silicon/
So, apparently the HDL description of the chip was made in Verilog; and there is this screenshot in this blog post, captioned "“ell” from the phrase “Hello World” from core0 of RP2040 in a simulator"
Yes, that is exactly the kind of analysis I'd want!
However, I wasn't really able to find the Verilog source of RP2040 - and I guess, it is probably not open.
But barring that - are there any other options for cycle-accurate simulation of RP2040, that could work with an arbitrary .uf2/.elf/.hex executable, and where I could also "stimulate" pins with (say) a digital capture (think .vcd file) of (say) an UART signal?