Jackli

@jackli

Joined on Mar 2, 2021

  • Our contribution to compressed instruction RV32IC contributed by < Jack, Ching-Hong Fang, anfong-query> Table of Contents [toc] Introduction minrv32 is a minimal RISC-V Implementation without a register file. It is inspired by the "MOS Technology 6502" which has very few registers. The main feature of minRV32 is that it has only one register (program counter) for this cpu. It can use "zero page" as registers. That is, all of the register files (i.e. a0, s1, t3) may be fetched from the memory.
     Like 2 Bookmark
  • contributed by < Jack > Requirements 1 First I set up the RISC-V toolchains in my environment, WSL2 Ubuntu 20.04, by the tutorial from 鄭育丞. Next I copy the c code I wrote in Assignment 1 into srv32/sw/me/me.c; then I add a Makefile which is copied from srv32/sw/qsort. Finally, I go into the srv32 directory and enter $make to compile it and get the result of RTL simulation and ISS simulator. At first, I use -O3 optimization to compile it, but I find something strange. That is, I cannot find where it get into the majorityElement function, which I think that it simplifies the whole process while calling it. So although it's highly optimized in the number of instrucitons and cycles, it's inconvenient to observe waveform. Therefore, I decide to change -O3 to -O1 in srv32/sw/common/Makefile.common to look at the normal and straightforward one. Compilation riscv-none-embed-gcc -O1 -Wall -march=rv32im -mabi=ilp32 -nostartfiles -nostdlib -L../common -o me.elf me.c -lc -lm -lgcc -lsys -T ../common/default.ld riscv-none-embed-objcopy -j .text -O binary me.elf imem.bin
     Like  Bookmark
  • contributed by < Jack > Environment setting Sort Colors Motivation I choose the problem from 張力尹, which is because it is a medium problem and I want to try it by myself. Problem description Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue.
     Like  Bookmark
  • contributed by < Jack > Majority Element Description This problem is based on LeetCode 169. Given an array nums of size n, return the majority element. The majority element is the element that appears more than $\lfloor n / 2 \rfloor$ times. You may assume that the majority element always exists in the array.
     Like 2 Bookmark