Grapefruit

@Grapefruit

Joined on Sep 30, 2024

  • contributed by < TingSheng > Quiz1 - Problem C Promblem Describe We implement fp16_to_fp32 function (with clz), which converts a 16-bit floating-point number in IEEE half-precision format (bit representation) to a 32-bit floating-point number in IEEE single-precision format (bit representation). clz function counts the number of leading zero bits in the binary representation of an unsigned integer, starting from the most significant bit (MSB). It returns an integer representing how many zero bits precede the first 1 in the binary representation of the number. If the input is zero, the output is "undefined". C code of fp16_to_fp32 static inline int my_clz(uint32_t x) {
     Like  Bookmark
  • Code : int arraySearch(int *p_a, int arr_size, int target) { int result = -1; asm volatile( // Your code // t0:counter // t1:a[i] "mv t0, zero \n\t"
     Like  Bookmark
  • 二進位逼近 在實作前先介紹何謂二進位逼近。 先看以下範例,我們利用此法求出 $\sqrt{13}$ 的整數部分 $13 = 2^3 + 2^2 + 2^0$, 因此我們依以下假設使用 $(S_{m})^2$ 來逼近 $$13 = \left( a_{3}2^3 + a_{2}2^2 + a_{1}2^1 + a_{0}2^0 \right)^2 = \left(\sum^{3}{i=0} a{i}2^{i} \right)^2 \text{和}$$ $$S_{m} = (a_{3}2^3 + \dots + a_{m}2^m) = \sum^{3}{k=m} a{k}2^k$$
     Like 1 Bookmark