江冠霆 JIANG,GUAN-TING N96121210

@Henry0922

Joined on Jun 28, 2023

  • contributed by < HenryChaing > Git 命令操作 git fetch 新增遠端分支到本地專案 $ git remote add sysprog https://github.com/sysprog21/lab0-c.git 同步遠端最新進度 $ git fetch sysprog
     Like  Bookmark
  • contributed by < HenryChaing > 研讀課程教材 繼上次作業三之後,接著要繼續研究第三週後續的教材。 並行程式設計: 排程器原理 首先講到的是並行程式設計的排程器原理,這裡要研究的排程器是使用者空間的任務排程器,我們會探討多個任務之間的轉換方式以及事件驅動。任務間又分成協同式多工以及搶佔式多工,協同式多工又可解釋成非搶佔式多工,它的 context switch 可以透過 setjmp/longjmp 完成,使用這兩個函式完成的是流程的控制。 而接下來的搶佔式多工,我們會接收 SIGALRM signal 來判別任務需進行切換。這些都是使用者空間進行任務切換的方法,Linux 核心的排程器還會處理到行程間的切換。最後是事件驅動,在 NGINX 當中事件驅動會由執行緒池指派的執行緒完成任務並回傳給行程,因此得知事件驅動有助於解決例行任務以及任務間的護衛效應。 你所不知道的 C 語言:函式呼叫篇
     Like 1 Bookmark
  • 第三週測驗 測驗一 /* ceiling division without needing floating-point operations. */ static size_t ceil_div(size_t n, size_t d) { return (n+d-1)/d; } 這是採取 include/linux/math.h 當中整數除法並向上取整的巨集實作,它的原理是歸納所有可能的餘數,例如 ${n = d \times q + r}$ (其中商數為 $q$ ,餘數為 $r$ ),會發現到餘數會介於 $0$ 以及 $d-1$ 之間。因此當我們將數字加上 $d-1$ 時,會發現在 C 語言的整數除當中,原先餘數為 0 的被除數會得到相同的商數,但是其他被除數在加了 $d-1$ 後會有向上取整數的效果。達成我們無條件進位的要求。 #define INTMAX BBBB
     Like  Bookmark
  • contributed by < HenryChaing > 第一週測驗 測驗 1 digraph "Doubly Linked List" { rankdir=LR; node [shape=record]; h [label="{ head | <ref2> }"]; a [label="{ <data> b | <ref2> }"]; b [label="{<data> c | <ref2> }"];
     Like  Bookmark
  • contributed by < HenryChaing > 開發環境 $ 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 < HenryChaing > Reviewed by HotMercury 可以嘗試以 linux coding style 的方式改寫 queue.c 其餘的 review 在底下有留言 你的洞見呢? 開發環境 $ gcc --version
     Like  Bookmark
  • rpmsg_client_sample 這個是位在 linux/samples 目錄底下的一支範例程式,可以編譯成核心模組。這個模組現在的編譯方法是連同核心一起編譯成動態模組,並且目前可以正常掛載並卸除在 Milk-V 的 linux 環境當中。但是現在還無法驗證這個 driver 模組是否可以運作,因為我還沒找到其相對應的 device ,照 Linux 的說明書文件來看,這個 device 的名稱叫作 channel , 是與另一個核的溝通界面。 所以接著可能要觀察 milkv-duo SoC 的 dts 檔案。 RPMsg-lite 在這個專案中,有個需要引入的檔案名為 rpmsg_platform.c (下圖中的 platfrom.c ), 專案有因應不同的 SoC 分別製作屬於他們的 rpmsg_platform.c , 但是顯然 cvitek 的 cv1812cp 並未被涵蓋在裡面,因此我必須製作屬於 milkv-duo256m 的 rpmsg_platform.c 。 目前發現我只須實作 3 個方法,就能支援 RPMsg-lite 專案的所有功能。這三個函式分別是 platform_notify , platform_init_interrupt , platform_deinit_interrupt . 而其中這三個函式與處理器相關的程式碼,分別是 觸發、啟動、停用 關於 Virtio 的中斷事件。 因此我現在想要研究關於 milkv-duo256m 所採用的 cv1812cp 中 Virtio 的機制,來找出實作 RPMsg-lite 的方法。但是我在想最快的方法是,確認 rpmsg_client_sample 可以正常運作 , 如果這個模組可以運作也就代表下層的 Virtio 以及 Mailbox 這兩個機制是有正常運行的,並且我就有機會實作 RPMsg-lite 。
     Like  Bookmark
  • patch files cvitek_cv1812cp_milkv_duo256m_sd_defconfig.patch --- cvitek_cv1812cp_milkv_duo256m_sd_defconfig_copy 2024-06-21 22:26:20.884680334 +0800 +++ cvitek_cv1812cp_milkv_duo256m_sd_defconfig 2024-06-21 22:25:03.885183233 +0800 @@ -1,3 +1,5 @@ +# file location : duo-buildroot-sdk/build/boards/cv181x/cv1812cp_milkv_duo256m_sd/linux/cvitek_cv1812cp_milkv_duo256m_sd_defconfig + CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_SWAP=y CONFIG_SYSVIPC=y
     Like  Bookmark
  • 目標簡介 期末專題的預設目標為使用 Linux 核心提供的 rpmsg ,在 milkv-duo256m 這塊嵌入式開發板上建立大小核之間的通訊。並且也有前置步驟需要完成,包括 8051 子系統的功能開通、架設 ADB (android debug bridge) 開發環境。 milkv-duo 這是一個僅須 5 美元的嵌入式開發板,裡頭的 SoC 主要包含了兩個 RISC-V 處理器,但是這兩個處理器的規格不同,因此屬於 AMP (Asymmetric Multi Processing) 架構。 我們分別讓這兩顆處理器運行不同的作業系統,功能較完善的大核運行 Linux ,而小核則是運行 FreeRTOS 。 rpmsg (Remote Processer Message) 以這次的專題來說,我的目標是要讓 Linux 以及 FreeRTOS 都能啟用 rpmsg 的功能。但是實作上並非如此容易,由於 rpmsg 的概念類似於 OSI 網路堆疊,位在傳輸層的 rpmsg ,底下還有資料連結層負責媒介存取的 Virtio ,還有實體層的 Mailbox 。 因此在 milkv-duo 只預設提供 Mailbox 的情況下,我們還需要額外了解 rpmsg 、 Virtio (以及 Mailbox )的機制,才能動手實作這次的專題。
     Like 1 Bookmark
  • contributed by < HenryChaing > 自我檢查清單 作業主題二: 整合井字遊戲對弈 Linux 核心模組 本次作業內容希望我們撰寫一個會執行井字遊戲的核心模組,並且使用者空間的行程可以接收到核心模組傳來的資訊並圖形化顯示過程及結果。因此我們會先來了解何謂 Linux 核心模組,並且說明如何實現它。 所謂核心模組就是指一段可以動態載入以及卸除的程式碼區塊,因此我們可以在不重新開機以及重新編譯核心的情形下加入我們需要的程式碼片段,而核心模組最常見的應用是作為硬體的驅動程式,這不僅增強核心整合週邊裝置的能力,還省去了改變原本核心程式碼的麻煩。 裝置驅動程式
     Like  Bookmark
  • contributed by < HenryChaing > 研讀課程教材 繼上次作業三之後,接著要繼續研究第三週後續的教材。 並行程式設計: 排程器原理 首先講到的是並行程式設計的排程器原理,這裡要研究的排程器是使用者空間的任務排程器,我們會探討多個任務之間的轉換方式以及事件驅動。任務間又分成協同式多工以及搶佔式多工,協同式多工又可解釋成非搶佔式多工,它的 context switch 可以透過 setjmp/longjmp 完成,使用這兩個函式完成的是流程的控制。 而接下來的搶佔式多工,我們會接收 SIGALRM signal 來判別任務需進行切換。這些都是使用者空間進行任務切換的方法,Linux 核心的排程器還會處理到行程間的切換。最後是事件驅動,在 NGINX 當中事件驅動會由執行緒池指派的執行緒完成任務並回傳給行程,因此得知事件驅動有助於解決例行任務以及任務間的護衛效應。 你所不知道的 C 語言:函式呼叫篇
     Like  Bookmark
  • contributed by < HenryChaing > 第三週測驗題 測驗二 參考: CA2023-Lab02, rv32emu CPU 週期數量 在測驗二當中共有兩種不使用除法及模數運算來得到商及餘數的方法,我們會針對這兩種方法進行分析,分別會分析他們的組譯結果以及執行時所需要的 CPU 週期。 在分析中我所使用到的工具為 rv32emu , GNU toolchain ,我們會分析經由跨平台編譯器組譯後的 RISC-V 組合語言程式,以及在 rv32emu 運行時程式在模擬器當中所使用的時脈週期數量。
     Like  Bookmark
  • contributed by < HenryChaing > 第一週測驗題 :::warning 不用列出參考答案,你要解讀和分析的對象是程式碼,而非列於 Google 表單的選項 ::: 測驗一 list_tail node_t *list_tail(node_t **left)
     Like  Bookmark
  • contributed by < HenryChiang > 1. Introduction to Project 1.1. rv32emu This is a simulator designed based on the RISC-V architecture, capable of executing ELF format files. The operation involves initially using an interpreter to translate the instructions read from the ELF file into corresponding C code. Finally, a JIT compiler is employed to compile the generated C code into the corresponding machine language. 1.2. Instruction Specialization The goal is to create special functions for common instructions, allowing them to be translated into faster C code. The objective is to reduce the overhead during the execution stage of these common instructions, indirectly speeding up the translation speed of the interpreter. We will also apply this technology to this project to accelerate the execution speed of rv32emu. 1.3. Purpose
     Like  Bookmark
  • E4B3 Tech and Architecture E4B3 uses products from IBM, Mandiant, Palo Alto Networks, Tenable, and VMware. Certificates from DigiCert are also used. Table L-1 lists all of the technologies used in E4B3 ZTA. It lists the products used to instantiate each ZTA 4839 component and the security function that each component provides. image 圖L-1描述了E4B3的邏輯架構。圖L-1使用編號箭頭來描述主體請求訪問資源所需的消息的一般流程,並根據主體身份(包括請求用戶和請求端點身份)、授權和請求端點健康來評估該訪問請求。 此外,它描述了支援定期重新驗證請求用戶和請求端點,以及定期驗證請求端點健康狀態的消息流程。所有這些都必須進行,以持續重新評估訪問權限。圖L-1中標記的步驟具有與圖4-1相同的含義。然而,圖L-1還包括實例化E4B3架構的具體產品。圖L-1還不顯示在圖4-1中找到的任何資源管理步驟,因為在E4B3中部署的ZTA技術不支持對資源執行身份驗證和重新驗證,或者對資源健康進行定期驗證。 E4B3 was designed with IBM Security Verify as the ZTA PE, PA, and PEP, and IBM Security Verify providing ICAM support.
     Like  Bookmark
  • contributed by < HenryChaing > Abstract 製作Fusion RAID的原因為減少software overhead. 分配request到各個SSD中,分散application workload. 以最後的效能分析,Fusion RAID 相比一般磁碟陣列減少了22%-98%的median latency,並且減少了2.7-62倍的效能提升在tail latency. Introduction 近期all-flash arrays(AFAs)有越來越普遍的趨勢,例如澳洲的ANZ Bank採用了高達400TB的 SSD Arrays.AFAs的好處在於整合了各個單一磁碟的bandwidth來提升IOPS,並且擁有更正碼來提升SSD的錯誤更正功能。 我們模擬由HDD構成的RAID5並且與一般的SSD RAID進行比較,觀察他的Median Latency 以及 Tail latency,執行的benchmark 為寫入密集的Exchange benchmark.
     Like  Bookmark
  • contributed by < HenryChaing > Single Cycle Datapath setup This time, we are going to learn how to design a Single Cycle RISCV Processor using the Scala programming language. Throughout the process, we need to complete the implementation of the code for each stage. It's crucial to understand how each Module specifies its input and output, and then use Chisel to bring them to life. Commonly used syntax includes when, mux, and so on. Additionally, we need to refer to example diagrams to accomplish the signal transmission between different stages. Next is Run Assembly Code on Processor. We need to place the previously written homework onto the CPU simulated with Chisel and observe the output results at specific memory addresses to determine if they match. This helps verify whether the CPU can properly execute various instructions. Finally, we can use GtkWave to observe the signals within the CPU. :::danger :warning: Read the requirements carefully! :::
     Like  Bookmark
  • contributed by < HenryChaing > Selected Topic This time, the chosen topic is 吳堉銨 string encryption and decryption using "count leading zero." The reason for selecting this topic is due to my interest in cybersecurity encryption and decryption. I found that it utilizes a relatively simple symmetric encryption and decryption method. During the process of studying the code, I also identified areas for improvement, which is why I chose it as the subject for this assignment. Environment Build The computer's operating system used is Windows 10. Therefore, Virtual Box is employed to set up a virtual machine, and the image file selected is Ubuntu 22.04.5 LTS. The first step is to install the "riscv-none-elf-gcc" package provided by the teacher on GitHub, along with "rv32emu," which is placed in the environment for the RV32 project. You should know before modify code In the main program, in order to evaluate the compiled performance, I referenced the files "ticks.c" and "perfcounter." In "ticks.c," it is possible to calculate the number of elapsed cycles using the methods provided internally. "perfcounter" includes two ".s" files that offer the "getcycles()" and "get_instret()" methods. Therefore, the generated ELF file after compilation can execute successfully and accurately print the number of elapsed cycles.
     Like  Bookmark
  • contributed by < HenryChiang > 1. Introduction to Problem 1.1. Normalizing an integer The problem I have chosen is an extension of Problem A, "Counting leading zeros." It allows an integer to be normalized into a binary floating-point representation, where the format will be expressed in the standard "1.XX*2^n" form. 1.2. prepare solution First, use CLZ to determine the number of shifts N (which will be exactly the number of leading zeros plus one). Then, use the sll instruction to perform the shifting and finally output the result to the console using ecall (System call). 2. Assembly code
     Like  Bookmark
  • 實驗一 內部RAM與Flash空間定址與存取 進階題 請利用Keil C51的各種功能,找出問題的答案,總共12題。 A. ORG 0 MOV R0, #01H MOV R1, #0FFH SETB RS0 ; switch from RB0 to RB1
     Like 1 Bookmark