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> }"];
contributed by < HenryChaing >
自我檢查清單
作業主題二: 整合井字遊戲對弈
Linux 核心模組
本次作業內容希望我們撰寫一個會執行井字遊戲的核心模組,並且使用者空間的行程可以接收到核心模組傳來的資訊並圖形化顯示過程及結果。因此我們會先來了解何謂 Linux 核心模組,並且說明如何實現它。
所謂核心模組就是指一段可以動態載入以及卸除的程式碼區塊,因此我們可以在不重新開機以及重新編譯核心的情形下加入我們需要的程式碼片段,而核心模組最常見的應用是作為硬體的驅動程式,這不僅增強核心整合週邊裝置的能力,還省去了改變原本核心程式碼的麻煩。
裝置驅動程式
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
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.
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!
:::
Jim Huang changed 2 years agoView mode 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.
Jim Huang changed 2 years agoView mode 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