Introducing risc v in the simics simulator mac
Goal Framework
Software cannot execute on a CPU by itself, a platform is required. The platform offered for RISC-V is a basic virtual platform that doesn’t match any specific real-world RISC-V machine. It has all the standard features you would expect from a platform, including disks, networking, and serial. As of right now, the platform looks like this:
The amount of processor cores, active instruction set extensions, memory capacity, virtual disk size and content, Ethernet network address, and other configuration options can all be changed on hardware. The platform employs virtio devices for networking, drives, and entropy (instead of devices from some particular real-world RISC-V-based system-on-chip (SoC)) to simplify program support. Practically speaking, it feels and appears like a little embedded device, despite the fact that it may be configured with many gigabytes of disk and RAM.
Both Linux and bare-metal software can be executed on the platform. Buildroot is used to build the standard software stack for Linux. Creating a bootloader, Linux kernel, and bootable file-system image for the RISC-V virtual platform is a pretty simple task when you use Buildroot.
Connecting the Virtual Platform RISC-V
Enabling networking was a fairly intriguing use case throughout the platform’s development. It wasn’t difficult to get networking to function at the point where machines could “ping” one another. It required some effort to enable remote login from one computer to another.
Telnet would have been used to accomplish this in the past. There is minimal configuration required, and the protocol, client, and server are all straightforward. But the networking world isn’t what it used to be, and almost every Linux distribution demands that secure shell (SSH) be used for any form of remote login. It only takes a few lines of setup to add SSH to Buildroot, then rebuild.
SSH, however, is a more intricate creature. After adding SSH to the root filesystem, the target machine would not start up and would hang right before the login prompt appeared. The absence of unpredictability was the issue. SSH requires a source of randomness in order to produce a host key when it is first installed. The random pool was filling up very slowly since the Linux kernel could not find many sources of randomness to use on the very basic virtual platform. stopping the boot’s advancement. Nice example of “oh, I didn’t realize that might be an issue.”
Intel enhanced the target system by adding a “Virtio entropy” device. This gives the target system a high-bandwidth source of randomness. To assure simulation repeatability, it is implemented in the simulator using a deterministic pseudorandom system, even if it appears to the target system to be a hardware random-number generator (RNG). The variation is undetectable to the target software.
This is a straightforward simulated network architecture that makes use of several RISC-V virtual platforms, each with a unique hardware arrangement. It should be noted that the virtual network also has a “service node” that offers standard services like DHCP for system configuration and a dependable target for ping to check network connectivity.
SSH is being used by the “small” machine to connect to the “medium” machine. To display the memory size, the “medium” and “large” machines are both operating at the top. In order to show the simulation of a multicore target system, they are also running a few copies of the single-threaded coremark benchmark. A list of the simulated machines and every processor core in the active simulation is displayed by the Simics simulator command line.
The target machines differ in terms of clock frequencies, memory sizes, and core counts, as can be seen from the Simics command-line interaction in the terminal.
Because each RISC-V target is housed in a separate Simics simulator cell, the simulation can run three machines concurrently, which speeds up the simulation. Additionally, each machine has the option to activate parallel simulation, which might result in the creation of two + four plus eight, or 14-way parallelism in this instance. Workloads involving a lot of computation benefit greatly from this acceleration.
Using the Quick Start Platform for networking
Heterogeneous mixed-architecture simulations can be conducted since the Intel Simics Simulator Public Release includes the Intel Architecture-based Quick-Start Platform (QSP). Combining the two targets into a single network within a single Simics simulation operation is a basic example. similar to this
The service node’s Network Address Translation (NAT) feature allows any virtual network to be connected to the outside world. The screenshot below shows the host system (this time running Microsoft Windows for variety’s sake) logging into the RISC-V target system via inbound port forwarding with an SSH client. Additionally, two SSH connections are open due to an SSH login from the QSP target system to the RISC-V target system..
All that is required to set this up is a short amount of top-level scripting over the virtual platform scripts that are already in place. Initially, default parameter values that deviate from the targets’ standard values are set up using a YAML file. Keep in mind that the exact names of the parameters and the parameter hierarchy may vary because this is based on early drops of the targets.
Second, the YAML file calls a Simics simulator command-line script, which uses pre-existing setup scripts to produce the separate setup components in order to build the network and target systems.