Entries from 2022-09-01 to 1 month

Building a RISC-V Linux Boot Environment with buildroot (2. Trying a Simulation on RTL)

Now that I have built the RISC-V Linux boot environment, I want to try running it on the RTL environment. First, the bootloader. It is stored in ELF format, so it is easy to run. However, it crashed right after loading. Huh, why does it fa…

Building a RISC-V Linux Boot Environment with buildroot

I want to use buildroot as the build environment for RISC-V Linux, but I couldn't find any material on an environment that builds reliably, so I decided to make one myself. I work on WSL, which has some annoying aspects such as setting up …

Trying RISCOF, the RISC-V Compliance Test Framework (1. Installation and Trying the Sample)

RISCOF stands for RISC-V Compliance Framework, a Python-based framework that uses RISC-V architectural assembly tests to test hardware and software against the standard RISC-V reference model. https://github.com/riscv-software-src/riscof F…

Tracing How Sniper Works (2. Overview of the Performance Model)

PerformanceModel::queueInstruction() just keeps pushing instructions into m_instruction_queue. I don't think ENABLE_PERF_MODEL_OWN_THREAD is defined. void PerformanceModel::queueInstruction(DynamicInstruction *ins) { if (m_fastforward || !…

Tracing How Sniper Works (1. Following the Execution)

I decided to write up how Sniper works once. I'll try to build a trace based on a simulation. main() : standalone.cc - Instantiate the Simulator - getTraceManager()->init() -getTraceManager()->run() - TraceThread::start() - TraceThread::ru…

Implementing RMW Instructions in My Own RISC-V Core (4. Debugging RMW Instructions)

I am trying to implement RISC-V RMW (Read Modify Write) instructions in my own OoO core. The basic functionality is now implemented, so next I added features such as issue restrictions for dependent instructions. Instructions younger than …

What Is the "iota" Vector?

It started when I noticed the viota.m instruction in the list of RISC-V vector instructions. According to the instruction's description, The viota.m instruction reads a source vector mask register and writes to each element of the destinat…

Implementing RMW Instructions in My Own RISC-V Core (3. Debugging RMW Instructions)

I am trying to implement RISC-V RMW (Read Modify Write) instructions in my own OoO core. The AMOADD implementation is done. Next, I implemented a feature that detects and stops instructions trying to overtake an RMW instruction. I added a …

Implementing a GShare Branch Predictor in My Own RISC-V CPU Core

On my own RISC-V CPU core, I improved several parts of the configuration and the GShare branch predictor now works correctly. The tricky part of GShare is that it is quite hard to predict multiple branches at the same time when multiple in…

Implementing RMW Instructions in My Own RISC-V Core (2. Implementing the Most Basic RMW)

I am trying to implement RISC-V RMW (Read Modify Write) instructions in my own OoO core. I am starting with the implementation of the AMOADD.W instruction. RMW instructions are basically sent into the pipeline from the STQ. However, unlike…

Investigating the Cycle-Based Simulator Sniper (Having Sniper Analyze RISC-V Vector Instructions)

Continuing the Sniper analysis. I want to be able to do cycle analysis of RISC-V vector instructions. In the previous result, the cycle count was still not what I expected. If 16 memory requests are generated, I would like it to take about…

Studying the Implementation of RMW Instructions in My Own RISC-V Core

I'm trying to implement RISC-V RMW (Read Modify Write) instructions in my own OoO core. There seem to be several ways to implement them, so let's think about how to build the basic atomic instruction flow. First, the RISC-V AMOADD instruct…

Investigating the Cycle-Based Simulator Sniper (Having Sniper Analyze RISC-V Vector Instructions)

Currently, Sniper can trace at most two memory accesses per instruction, so we first need to change that. In Sniper's SIFT trace format, I modify MAX_DYNAMIC_ADDRESSES so that it can accept more memory accesses. diff --git a/sift/sift.h b/…

Trying NaxRISCV (Compilation and Simulation)

I wanted to experiment with a few things, so I'm going to run NaxRISCV. github.com # Get the repo git clone https://github.com/SpinalHDL/SpinalHDL.git --recursive git clone https://github.com/SpinalHDL/NaxRiscv.git --recursive cd NaxRiscv …

Measuring the Performance of My Own RISC-V CPU Core While Changing Its Configuration (3. Dhrystone Measurement After RAS Performance Improvements)

On my own RISC-V CPU core, I changed several configurations and reworked the RAS. The RAS latency has increased, but it now predicts stably, so let's measure Dhrystone. The previous measurement results look like this. Configuration IPC tin…

Investigating the Cycle-Based Simulator Sniper (Converting Sniper's Trace Log to O3Pipeview)

Experiments in Converting Sniper's Results to O3Pipeview Let's modify it a bit more and pull in more information. Let's use the Tracer's times information. We'll assume that fetch / decode / rename each come one cycle before the previous s…

Investigating the Cycle-Based Simulator Sniper (Converting Sniper's Trace Log to O3Pipeview)

Experiments in Converting Sniper's Results to O3Pipeview I added some output to LoopTracer::traceInstruction() as shown below. Only the commit time is real; everything else is arbitrary. I simply hacked it so that every pipeline stage adva…

Investigating the Cycle-Based Simulator Sniper (Dumping the SQLite Commands Generated by Sniper)

Let's dump the SQLite commands generated by Sniper. ROI: Region of Interest apparently means the measurement range. For now I'll ignore it and observe the overall state. This time, I'll extract the SQLite information and simply print it hi…

Investigating the Cycle-Based Simulator Sniper (Checking What It Takes to Update Sniper's RISC-V Support to the Latest Spike)

The cycle-accurate simulator Sniper has basic support for executing RISC-V binaries, but there are problems such as the Spike version being old and unable to run vector instructions. So I updated the Spike simulator bundled with Sniper and…

Checking the Work to Migrate the Working Repository for "Learn by Building: Computer Architecture" to LLVM 15

LLVM 15 has been released, so I tried migrating the development repository of the "RISC-V + LLVM book" to the LLVM 15 series. The details are written on the following support page. github.com git clone https://github.com/msyksphinz-self/ll…

Trying to Install gem5 and Run Benchmarks (Adding New Vector Instructions to RISC-V Instructions 3)

I have been doing some debugging on the previous RVVLoad definition. There is very little documentation, so investigating is hard, and I am reading through how the code behaves one step at a time in GDB. seanzw.github.io It looks like defi…

Trying to Install gem5 and Run Benchmarks (Adding New Vector Instructions to RISC-V Instructions 2)

Continuing my attempt to add instructions to gem5. I have been experimenting by trial and error to find out what is needed to define a vector instruction. First, I define a class called RVVLoad to define the vector instructions as a whole.…

Learning About gem5's ISA Parser

That said, all I did was translate and read the ISA Parser page. I'm leaving it here as a memo. www.gem5.org ISA Parser The gem5 ISA description language is a custom language designed specifically to generate the class definitions and deco…

Releasing Docker Images to Reproduce the Environment of "Learn by Building: Computer Architecture"

The toolchain situation at the time of publication of "Learn by Building: Computer Architecture" (the so-called RISC-V + LLVM book) has changed considerably from the situation when I was writing it, and I have caused trouble for many reade…

Investigating AArch64 SVE Load Instructions (LD1{B,SB,H,SH,W,SW,D} Instructions)

Arm

Summarizing SVE Memory Access Instructions While looking at the gem5 code, I am summarizing what configurations exist for AArch64 memory access instructions. First of all, I don't really understand the structure of AArch64 memory access in…

Trying to Install gem5 and Run Benchmarks (Adding New Vector Instructions to RISC-V Instructions)

Continuing my attempt to add instructions to gem5. I have been looking into instruction definitions and investigating why VLE and VSE didn't work properly last time. It turned out that the VSETVLI instruction has to be implemented reasonab…

Chipyard's `scripts/build-toolchains.sh` Fails When `--clean-after-install` Is Specified

make: Leaving directory '/home/msyksphinz/work/riscv/chipyard/chipyard/toolchains/riscv-tools/riscv-isa-sim/build' cp: cannot stat '/home/msyksphinz/work/riscv/chipyard/chipyard/toolchains/riscv-tools/riscv-isa-sim/build/libfesvr.a': No su…

Trying to Install gem5 and Run Benchmarks (Adding New Vector Instructions to the RISC-V Instruction Set)

I want to understand gem5's instruction definition tables, so I will start by adding some simple RISC-V vector instructions. To run the simplest case, memcpy, it is enough to define the following three instructions. copy_data_vec: mv a3, a…