Entries from 2022-07-01 to 1 month

Learning How to Use Yosys (7. The Relationship Between Wires and Cells)

First, let's write a simple Pass for Yosys. Let's list the wires and cells in a module. I wrote search_wires() and search_cells() to print out the wires and so on in a module. void search_wires (RTLIL::Module* module) { log(" Wires :\n"); …

Studying Instruction Fetch Techniques and the Trace Cache

It suddenly occurred to me that I did not know much about trace caches, so I decided to read some material and study them. The book I read is the one below. It is old, but it covers the basics and is reliable. Modern Processor Design: Fund…

Trying the Branch Prediction Championship Kit, a Branch Predictor Evaluation Kit (5. Reading How GShare Works)

Continuing with the Branch Prediction Championship Simulator. Reading How Gshare Works It is implemented only in predictor_gshare.h, and it is quite short, so it is easy to read. Structure As many PHT entries as needed are allocated. HIST_…

Trying the Branch Prediction Championship Kit, a Branch Predictor Evaluation Kit (4. Trying Local Bimodal Branch Prediction)

Continuing with the Branch Prediction Championship Simulator. Building a Local Bimodal Branch Predictor I structured the PREDICTOR as follows. It has 4096 m_local entries (really 2 bits each) as member variables, used as the local branch p…

Trying the Branch Prediction Championship Kit, a Branch Predictor Evaluation Kit (3. Trying a Static Predictor)

Continuing with the Branch Prediction Championship Simulator. Building a Static Predictor Let's build a Predictor that always predicts a jump. #include <stdlib.h> #include <string.h> #include <assert.h> #include <inttypes.h> #include <math.h> #include "utils.h" #include <vector> class PREDICTOR {</vector></math.h></inttypes.h></assert.h></string.h></stdlib.h>…

Trying the Branch Prediction Championship Kit, a Branch Predictor Evaluation Kit (2. Analyzing the Trace File)

Continuing with the Branch Prediction Championship Simulator. Let's analyze the contents of the Branch Prediction Simulator trace file. Reading the Contents of the Trace File For example, the contents of SHORT_MOBILE-24.bt9.trace.gz look l…

Learning How to Use Yosys (6. Displaying Modules with My Own Pass)

Let's start by building a simple Pass for Yosys. We will write a Pass that lists the names of the modules. We obtain the names of the modules registered in the design. yosys/passes/tests/mypass.cc void execute(std::vector<std::string> args, RTLIL::Desi</std::string>…

Learning How to Use Yosys (5. Trying to Create My Own Pass)

Let's start by building a simple Pass for Yosys. It is called mypass, and it is a Pass that does nothing. yosys/passes/tests/mypass.cc struct MyPass : public Pass { MyPass() : Pass("mypass", "My Pass") { } void help() override { // |---v--…

Trying the Branch Prediction Championship Kit, a Branch Predictor Evaluation Kit (Installation)

I used Ubuntu 20.04 LTS. It seems Boost is required to build it. jilp.org sudo apt install libboost-dev libboost-iostreams-dev Download the Championship Kit and build it. curl -L http://hpca23.cse.tamu.edu/cbp2016/cbp2016.final.tar.gz | ta…

Studying MLIR (8. Studying the Rewriter 3)

I'm studying MLIR. Hmm, the PassManager just won't get applied no matter what. I can't figure out why the optimizer refuses to run with -opt. How does toyc do it? b SimplifyRedundantTranspose::matchAndRewrite * frame #0: 0x000000010007c77c…

Learning How to Use Yosys (4. Observing the RTLIL Intermediate Representation)

I have been looking at Yosys's RTLIL. The RTLIL code defines several structs. /yosys/kernel/rtlil.h namespace RTLIL /* ...omitted... */ struct Const; struct AttrObject; struct Selection; struct Monitor; struct Design; struct Module; struct…

Reading the Paper on the Alpha EV8 Branch Predictor (4. Redoing the Hybrid Branch Predictor Structure)

I started reading the paper on the Alpha EV8 branch predictor. https://ieeexplore.ieee.org/document/1003587ieeexplore.ieee.org https://msyksphinz-en.hatenablog.com/entry/2022/06/19/040000msyksphinz-en.hatenablog.com Someone pointed out a m…

Studying MLIR (8. Studying the Rewriter 2)

I'm studying MLIR. Hmm, the PassManager just won't get applied no matter what. Even when I display the Passes with -debug, it is clear that no Pass is being applied. When I run toy-ch3 with the -debug option, the Pass is applied properly. …

Studying MLIR (7. Studying the Rewriter)

I'm studying MLIR. I'd like to implement a few optimizations. For example, something that automatically turns A-A into 0 looks easy to build, but it seems you have to use MLIR's rewriter for that. /// This method attempts to match a patter…

Learning How to Use Yosys (4. Observing the RTLIL Intermediate Representation)

I ran a few test cases through the RTLIL intermediate representation to see what kind of output gets generated. The difference between always_comb and assign assign out0 = in0; always_comb begin out1 = in1; end The generated RTLIL was iden…

Learning How to Use Yosys (3. Looking at the Passes)

I want to look at Yosys's passes. In the Yosys repository, the passes are placed in directories like the following. . ├── cmds ├── equiv ├── fsm ├── hierarchy ├── memory ├── opt ├── pmgen ├── proc ├── sat ├── techmap └── tests 11 directori…

Reading the Paper on the Alpha EV8 Branch Predictor (3. The Structure of Hybrid Branch Prediction)

I have started reading the paper on the Alpha EV8 branch predictor. https://ieeexplore.ieee.org/document/1003587ieeexplore.ieee.org https://msyksphinz-en.hatenablog.com/entry/2022/06/19/040000msyksphinz-en.hatenablog.com I am re-reading it…

I Have Made "RISC-V + LLVM Book Appendix 2. Floating-Point Instructions" Available for Free

"Learning Computer Architecture by Building" (作って学ぶコンピュータアーキテクチャ) had already exceeded 500 pages at the time of writing, so I reluctantly cut two chapters. The first appendix, "Appendix 1. Variations of Function Calls and…

Learning How to Use Yosys (2. Compiling Rocket's Verilog Implementation with Yosys)

Next, I want to have Yosys read the Rocket-Chip implementation generated by Chipyard. To load the Rocket-Chip implementation generated by Chipyard into Yosys and elaborate it, run the following commands. synth.cmd read -sv chipyard.TestHar…

Learning How to Use Yosys (1. Environment Setup and Logic Synthesis)

It has been quite a while. For now, let's set up a Yosys environment and try to compile a simple Verilog design built with Chipyard. Installation git clone https://github.com/YosysHQ/yosys.git git co yosys-0.19 make -j$(nproc) make install…

Trying to Set Up a Chipyard Environment on an M1 Mac

I wanted to set up a Chipyard environment on M1 macOS, and while looking around I found that someone has already tried it. qiita.com I used Chipyard version 1.6.2. On an M1 Mac, OpenJDK has to be downloaded separately. curl -L https://cdn.…

Studying MLIR (6. Defining Operations)

I am studying MLIR. I am taking on the challenge of creating my own language and expressing its intermediate representation using MLIR. In the previous test, optimization was too aggressive and variables got merged together, so I couldn't …

Released "RISC-V + LLVM Book Appendix 1: Variations of Function Calls and Advanced Features" for Free

"Learn by Building: Computer Architecture" had already exceeded 500 pages at the time of writing, so I reluctantly had to cut two chapters. I have released one of them, "Appendix 1: Variations of Function Calls and Advanced Features", for …

Studying MLIR (5. Scopes in MLIRGen)

I am studying MLIR. I got stuck a bit on Type, so I am re-reading the documentation. mlir.llvm.org MLIR is designed to be a completely extensible infrastructure; there is no closed set of attributes (think: constant metadata), operations, …

Summarizing the Current Front-End Configuration of My Own CPU

CPU

When I tried to implement GShare for the first time in a while, I found I had forgotten a lot of things, so this is a memo to help me remember. By the way, I think the current front-end configuration summarized below is not good at all. I …

Bought "Digital Design and Computer Architecture: RISC-V Edition"

I don't have much room for physical books, so I bought the electronic version. I bought the PDF from Tatsu-zine (Tatsumi Publishing). tatsu-zine.com I had also bought the English edition, so now I have both the Japanese and English version…

Studying MLIR (5. Scopes in MLIRGen)

I am studying MLIR. I am taking on the challenge of creating my own language and expressing its intermediate representation with MLIR. The flow I have in mind is as follows: Read my own language (MYSV: an original modified version of Syste…

Reading the Paper on the Alpha EV8 Branch Predictor (2. The Difficulty of Parallel Branch Prediction)

I have started reading the paper on the Alpha EV8 branch predictor. https://ieeexplore.ieee.org/document/1003587ieeexplore.ieee.org https://msyksphinz-en.hatenablog.com/entry/2022/06/19/040000msyksphinz-en.hatenablog.com I roughly translat…