/blog/images/avatar.png

Rocket RISC-V processor - Adding custom instructions

Introduction In the context of a research project related to RIMI [1], we need to add new instructions in the Rocket Chip decoder. @QDucasse already proposed an analysis of the structure of the Rocket Chip source code [1]. This blog post aims to give a bit more details about the instruction encoding for load/store instructions in particular. Instructions specification Each instruction is defined with a dictonary of parameters (rocket-chip/IDecode.scala at v1.

Capstone 101 - Decoding RISC-V instructions

Capstone & RISC-V Just a few notes about playing with Capstone for RISC-V ISA. Be aware that RISC-V support has been added recently in Capstone. If you want to use Python bindings, you must install a v5 release candidate: 1 pip3 install capstone==5.0-rc2 [1] is an online RISC-V ISA decoder. In the context of a research project, we had to decode instructions with Capstone [2]. Here is a simple example with two instructions (same instruction copied twice):

Rocket RISC-V processor - Adding a custom CSR, hardware point of view

Introduction In the context of a research project related to RIMI [1], we need to add a new CSR (Control & Status Register) in the Rocket processor [2] in order to store new security settings. There are obviously modifications to do in the hardware description of the processor. This blog article tries to sum up what needs to be done. Hardware stack of the Rocket Chip The first difficulty with the Rocket Chip is its implementatinon langage, Chisel.

Rocket RISC-V processor - Adding a custom CSR, software point of view

Introduction In the context of a research project related to RIMI [1], we need to add a new CSR (Control & Status Register) in the Rocket processor [2] in order to store new security settings. There are obviously modifications to do in the hardware description of the processor (it will be the topic of a future article). However, we also need to modify a few lines of the software stack.

How to add a processor in LiteX?

Introduction Two methods can be done: Including the processor code in LiteX framework (see CV32E40P [4]). Importing the processor code from an external repository (see FemtoRV [5]). The choice mainly depends on how the HDL code is written. This tutorial focuses on the first method as targeted processors will be composed of several HDL files. We will see later how it is configured. LiteX workflow for custom processors This tutorial is based on the work done by Antmicro for the CV32E40P [4].

Arduino Due vs. embedded C - ARM reversing

arduino-cli: Command Line Interface for Arduino ARM cross compiler: sudo apt install gcc-arm-none-eabi Sample program We want to create the most simple program which goal is to light on the built-in LED, located at port PB27 on the Arduino Due. Arduino 1 2 3 4 5 6 7 8 void setup() { pinMode(LED_BUILTIN, OUTPUT); } void loop() { digitalWrite(LED_BUILTIN, HIGH); } Embedded C 1 2 3 4 5 6 7 int main() { PIOB->PIO_PER = 1<<27; /* Enable port PB27 */ PIOB->PIO_OER = 1<<27; /* Configure PB27 as output */ PIOB->PIO_ODSR = 0xFFFFFFFF; /* Write 1 in all PORTB ports */ return 0; } Codes and compilation 1 2 3 4 5 6 7 8 9 $ ls -lR .