洪佑杭

@hungyuhang

Joined on Apr 23, 2017

  • contributed by < hungyuhang > :::danger 以後關於 vcam 的部份內容(例如改善項目)會更新到 期末專題頁面 上面 ::: 參考文件列表 過往開發紀錄 2020 年開發紀錄 / GitHub vcam 測試記錄
     Like  Bookmark
  • contributed by < hungyuhang > 前 4 週測驗題改進 閱讀〈因為自動飲料機而延畢的那一年〉的啟發與課程心得 閱讀完因為自動飲料機而延畢的那一年這一系列文章,我感觸良多。在文章前面的部分作者提到了一個現象,那就是在學校學到的東西往往不能在業界實際應用,學校教了許多理論基礎,但多數學生卻無法將他們學到的知識拿來做實際應用,還是需要到職場上才有辦法開始學習如何實際的去實作一些東西。 而作者對於堅持完成一件事物的精神,也令我深深感到敬佩。作者一開始覺得製作一台飲料機應該沒有什麼難的,但是當實際開始製作時,才發現原來問題比想像中的多,許多從來沒有想過會發生的問題,全部都成為阻礙,擋住完成自動飲料機的去路。而這時候就作者開始懷疑自己是不是該繼續做下去,開始會認真考慮著該不該放棄。 而在修這堂課的這六個禮拜以來,當我在閱讀課程教材,以及做作業時,我也常常陷入相同的處境。在實際去閱讀教材時,才發現以我自身的能力,要完成指定的作業以及教材進度可以說是難如登天,要讀完一篇教材少說要專注地投入三四個小時以上,要完成作業的一個子題目可能要花上至少一整天才能完成。在期初選這堂課的時候,我曾經告訴自己一定要全心投入這個課程的每個作業,但是在實際投入心力之後,才發現現實往往跟想像中的不一樣,如果我專注在做作業的其中一個子題目,盡量做到最好,那麼我勢必會無法空出多餘的時間去閱讀教材,甚至完成作業的其他子題目。
     Like  Bookmark
  • contributed by < hungyuhang > 自我檢查清單 [x] 研讀前述 ==Linux 效能分析== 描述,在自己的實體電腦運作 GNU/Linux,做好必要的設定和準備工作 $\to$ 從中也該理解為何不希望在虛擬機器中進行實驗; [x] 閱讀〈Linux 核心模組運作原理〉並對照 Linux 核心原始程式碼 (v6.1+),解釋 insmod 後,Linux 核心模組的符號 (symbol) 如何被 Linux 核心找到 (使用 List API)、MODULE_LICENSE 巨集指定的授權條款又對核心有什麼影響 (GPL 與否對於可用的符號列表有關),以及藉由 strace 追蹤 Linux 核心的掛載,涉及哪些系統呼叫和子系統? [ ] 閱讀《The Linux Kernel Module Programming Guide》(LKMPG) 並解釋 simrupt 程式碼裡頭的 mutex lock 的使用方式,並探討能否改寫為 lock-free; [ ] 探討 Timsort, Pattern Defeating Quicksort (pdqsort) 及 Linux 核心 lib/sort.c 在排序過程中的平均比較次數,並提供對應的數學證明; [ ] 研讀 CMWQ (Concurrency Managed Workqueue) 文件,對照 simrupt 專案的執行表現,留意到 worker-pools 類型可指定 "Bound" 來分配及限制特定 worker 執行於指定的 CPU,Linux 核心如何做到?CMWQ 關聯的 worker thread 又如何與 CPU 排程器互動? [ ] 解釋 xoroshiro128+ 的原理 (對照〈Scrambled Linear Pseudorandom Number Generators〉論文),並利用 ksort 提供的 xoro 核心模組,比較 Linux 核心內建的 /dev/random 及 /dev/urandom 的速度,說明 xoroshiro128+ 是否有速度的優勢?其弱點又是什麼? (https://blog.cruciferslab.net/?p=599)
     Like  Bookmark
  • contributed by <hungyuhang> 第 3 週測驗題 測驗 1 這個測驗內容是 Digit-by-digit calculation ,該演算法的目的是去找出某數字開平方,以下是簡單的運行方式: 將要開平方的數(也就是 $x$ )拆成 2 的冪相加 (若是十進位則為 10 的冪),也就是如下形式:$$ x = (000b_0b_1b_2\cdots b_{n-1}b_{n})^2 $$ 其中 $$ 000b_0b_1b_2\cdots b_{n-1}b_{n} $$ 為 bits pattern,其中 $b_0$ 為最高位的 1 。
     Like  Bookmark
  • contributed by <hungyuhang> 開發環境 $ gcc --version gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 $ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 39 bits physical, 48 bits virtual
     Like  Bookmark
  • contributed by <hungyuhang> 第 1 週測驗題 測驗 1 觀察程式碼,可以發現 main 程式碼做了以下事情: 產生 100000 個數字並且執行 shuffle 將其順序打亂 將這 100000 個數字使用 list_construct 函式轉換成鏈節串列 使用 quick_sort() 函式對鏈節串列進行排序 檢查排序結果並釋放記憶體
     Like  Bookmark
  • contributed by < hungyuhang, RayChen > Introduction System emulation provides a virtual model of a machine (CPU, memory and emulated devices) to run a guest OS. In integrated circuit (IC) design, system emulation plays a significant role during the initial design phase of the chip. And among those system emulators, semu is a minimalist RISC-V system emulator capable of running Linux the kernel and corresponding userland. But as the term "minimalist" implies, semu does not include some essential peripherals, such as the RTC module. To improve the system emulation of semu, we add a simple RTC module. The implementations are in the following repositories: hungyuhang/semu
     Like  Bookmark
  • contributed by < hungyuhang > Environment Setup Issue Encountered when Running Chisel Bootcamp I run the Chisel Bootcamp on my Windows laptop locally using Docker. But the Docker image provided by Chisel has some issues. After I boot up the Docker image, the code cell in the Jupyter notebook of the Chisel bootcamp cannot execute normally. To solve the issue, I rebuild the Docker image using the method in this article. And after the fixup, the bootcamp runs normally. GTKWave Installation
     Like  Bookmark
  • contributed by < hungyuhang > Problem Selection For this assignment, I choose the program Find Leftmost 0-byte using CLZ by 陳川曜. And the reason to pick this implementation, is because there are a lot of binary operations in this implementation, and I want to practice more binary operations so that I can be more familiar with it. Program Adaptation Assembly Code To adapt the assembly from Ripes to rv32emu, most of the work involves changing the code for system calls. For example, in Ripes there is a system call to print integer. But in rv32emu, it only supports system call to print string.
     Like  Bookmark
  • contributed by < hungyuhang > Multiplication Overflow Prediction This method utilizes the formula below:$$ \lceil log_2(xy) \rceil \leq \lceil log_2(x) \rceil + \lceil log_2(y) \rceil $$ So if we calculate log2(x) and log2(y), we can predict whether the product of x and y will overflow without doing the multiplication. By counting the leading zeros of x and y in binary representation, we can obtain the logarithm of x and y with base 2. Although the concept is straightforward, this method has some exceptions. For example, for $x \approx 2^{61.4}$ and $y \approx 2^{1.6}$, the result of $\lceil log_2(x) \rceil + \lceil log_2(y) \rceil$ is 64, and the algorithm will predict that the product of $x$ and $y$ will overflow. However, the product of $x$ and $y$ is about $2^{63}$, since it is smaller than $2^{64}$, the value will not overflow.
     Like  Bookmark