Ripes is a graphical processor simulator and assembly code editor built for the RISC-V instruction set architecture, suitable for teaching how assembly level code is executed on various microarchitectures.
The following sections serve as an introduction to the main features of Ripes.
The editor tab shows two code segments. On the left hand side, it is possible to write an assembly program written using the RISC-V RV32(I/M/C) instruction sets. Whenever any edits are performed in this assembly program - and no syntax errors are found - the assembly code will automatically be assembled and inserted into the simulator. If a C compiler has been registered, the input type
may be set to C
. It is then possible to write, compile and execute C-language programs within Ripes, see
this docs page for more detail.
Next, on the right hand side a second code view is displayed. This is a non-interactive view of the current program in its assembled state, denoted as the program viewer. We may view the assembled program as either disassembled RISC-V instructions, or as the raw binary code. The blue sidebar of the right-hand view may be clicked on to set a breakpoint at the desired address. Pressing the icon will bring up a list of all symbols in the current program. Through this, it is possible to navigate the program viewer to any of these symbols.
Ripes is bundled with various examples of RISC-V assembly programs, which can be found under the File->Load Examples
menu.
An example program could be the following: loading a value from memory into a register and incrementing the value.
.data
w: .word 0x1234
.text
lw a0 w
addi a0 a0 1
With a program ready to be simulated, we may now move to the Processor tab.
The processor tab is where Ripes displays its view of the currently selected processor, as well as any additional information relevant to the execution. Apart from the processor view, the processor tab contains the following views:
ecall
print function will be displayed here.Processor models in Ripes communicate the current state of the datapath through various visual means, such as
The processor view may be zoomed by performing a ctrl+scroll operation (cmd+scroll on OSX).
Clicking a wire highlights the entirety of the wire. This is useful when trying to deduce how a signal is routed through the datapath in some of the more complex layouts. Given that Ripes simulates the entire datapath of a processor, it is possible to investigate the value of any signal, at any point in time.
The toolbar within Ripes contains all of the relevant actions for controlling the simulator. | | | | | | | | |:-:|:-:|:-:|:-:|:-:|:-:|:-:| |Select Processor|Reset|Reverse|Clock|Auto-clock|Run|Show stage table|
ecall
functions will still be printed to the output console. Running will stop once a breakpoint is hit or an exit ecall
has been performed.View->Show processor signal values
to display all output port values of the processor.
While executing the program loaded earlier, we may observe that, in cycle 4, a load-use dependency arises between the 2nd and 3rd instruction. This results in the ID
stage being stalled for one clock cycle, whilst the load is being performed. Pipeline stalls (due to hazards) and flushes (due to control flow) will be indicated above a pipeline stage as nop
instructions highlighted in red.
Through providing multiple processor models, Ripes provides the ability to investigate how different microarchitectures affect program execution. The set of processor models shipping in version 2.0 (described below) aims to address each level of added complexity when going from a single cycle processor to a fully functioning, in-order pipelined processor.
Ripes provides the following processor models:
Furthermore, each processor provides multiple layouts of the processor. By default, the following two layouts are provided:
Opening the processor selection dialog, one may choose and configure the current processor:
On the left hand side, each available processor is listed. As for configuration:
ISA Exts.
allows you to toggle ISA extensions for the processor. This will have an effect on which instructions you are able to assemble, as well has which instructions a C
compiler will generate.As an example processor selection, the following image shows the extended layout of the RISC-V 5-stage Processor:
The memory tab provides a view into the entire addressable address space of the processor. Navigating the memory may be done as follows:
.text
segment, the static data .data
segment etc). Furthermore, a custom address may be specified through the “Address…” option.Whenever the processor is reset, all memory written during program execution will be reset to its initial state.
Ripes includes a cache simulator, which you can read more about
here.
Ripes includes memory mapped I/O allowing for interaction with various different simulated devices, which you can read more about
here.
This concludes the introduction to Ripes and its main features. Reading on, please refer to the following pages: