Skip to content
Snippets Groups Projects
Commit b1283364 authored by LEESANGKYEONG's avatar LEESANGKYEONG
Browse files

Merge branch 'sk1' into 'master'

Sk1

See merge request !20
parents 33b0baf9 814dbf6c
No related branches found
No related tags found
1 merge request!20Sk1
......@@ -328,3 +328,15 @@
- problem of bitwise operator.
- printf is a fobidden function.
- some macros are forbidden.
# Dynamic Test(fx_s3132)
## Code Coverage
- One of the indicators of how much testing is sufficient when discussing software testing.
## Project Coverage (60% -> 100%)
### Before
![4](./image/4.png)
### After
![5](./image/5.png)
File moved
File moved
File moved
File moved
# Requirements Specification(fx_s3132)
## 1. introduction
### - 1.1 purpose
- 1.1.1 basic purpose
- This product is a kind of calculator that performs various operations related to fixed point number.
- For fixed-point arithmetic, c langauge's math library and type conversion are required.
- in iteration2, with using shift operation can create a variety of functions that perform differently under different conditions.
### - 1.2 concept
- 1.1.2 basic concept
- To operate several calculation for fixed-point numebr type casting is essential.
- Correct type conversion is very important in order to accurately calculate and avoid missing bits.
- 1.1.3 concept of fixed-point number
- ![image](/uploads/0ae109d4300d11722c53531d1a9615ac/image.png)
- a. data types in computer langauge always have fixed length
- b. in fixed point decimal point position of specific number should be fixed
- c. mean of s3132
- s(sign) / 31(interger) / 32(decimal point)
- first s bit is used for number's sign (+ or -)
- second 31bits are used to represent interger part
- third 32bits are used to represent decimal
## 2. overall description
### - 2.1 product functions
- 2.1.1 list of fuctions
- 2.1.1.1 iteration 1
- a. add
~~~
#define fx_add(a, b) ((a)+(b))
~~~
- to add two fixed point numbers there is no need to conversion of data type
- just add two fixed point numbers and return result
- b. sub
~~~
#define fx_sub(a, b) ((a)-(b))
~~~
- to sub one fixed point number from another fixed point number there is no need to conversion of data type.
- just operate function without conversion of data type and return result
- c. mul
~~~
#define fx_mul(a, b) double_to_fx(fx_to_double (a) * fx_to_double (b))
~~~
- to mul two fixed pouint number shoul do type conversion
- first convert two fixed point number to double type and do mul operation
- second result calculated from first step should be converted to fixed point number(type conversion)
- d. div
~~~
#define fx_div(a, b) double_to_fx(fx_to_double (a) / fx_to_double (b))
~~~
- to div two fixed pouint number shoul do type conversion
- first convert two fixed point number to double type and do div operation
- second result calculated from first step should be converted to fixed point number(type conversion)
- e. fixed -> double
~~~
#define fx_to_double(a) (a/P2_2to32)
~~~
- to convert fixed point to double should divide fixed point number by 2^32(s31(32)=>decimal part bits)
- f. double -> fixed
~~~
#define double_to_fx(a) (long long)(a*P2_2to32)
~~~
- to convert double to fixed point should multiply double number and 2^32(s31(32)=>decimal part bits)
- h. sine
~~~
#define fx_sin(a) double_to_fx(sin(fx_to_double(a)))
~~~
- to convert fixed point number to sine value there is need to type conversion
- first convert fixed number to double
- second do sine operation with math library
- thrid conver result calculated by second step to double and return result
- i. power
~~~
#define fx_power(a, b) double_to_fx(pow(fx_to_double(a), fx_to_double(b)))
~~~
- to do power operation with fixed point number there is need to type conversion
- first convert fixed number to double
- second do sqrt operation with math library
- thrid conver result calculated by second step to double and return result
- j. sqrt
~~~
#define fx_sqrt(a) double_to_fx(sqrt(fx_to_double(a)))
~~~
- to do sqrt operation with fixed point number there is need to type conversion
- first convert fixed number to double
- second do sqrt operation with math library
- thrid conver result calculated by second step to double and return result
- 2.1.1.2 iteration 2
- a. mul
~~~
((fa * fb) >> FX32_QNUM )
~~~
- fuction that multiplies fa and fb and divides it by 2^32
- b. mul1
~~~
((fa>>16) * fb)>>16)
~~~
- Same as fx32_mul, the same fuction as fa*fb>>32, first multiply fa/2^16 and fb, and divide the remaining 2^16
- c. mul2
~~~
(((fa>>8)*(fb>>8))>>16)
~~~
- Same as above, the same fuction as fa*fb>>32, first multiply fa/2^8, fb/2^8, and divide the remaining 2^16
- d. div
~~~
((((fixed64)(fa) << FX32_QNUM) /(fb)))
~~~
- fuction that multiplies fa by 2^32 and divides fb.
- e. div1
~~~
((((fa)<<16)/(fb))<<16)
~~~
- Same as above, it has the same fuction as (fa<<32)/fb. First, fa is multiplied by 2^16 and divided by fb, and then the remaining 2^16 is multiplied
- f. div2
~~~
((((fa)<<24)/(fb))<<8)
~~~
- same as above, it has the same fuction as (fa<<32)/fb. First, fa is multiplied by 2^24, divided by fb, and then the remaining 2^8 is multiplied.
# Dynamic Test(fx_s3132)
## Code Coverage
- One of the indicators of how much testing is sufficient when discussing software testing.
## Project Coverage (60% -> 100%)
### Before
![testing_1](/uploads/ac075d788d0a21c645d79186b740ce50/testing_1.png)
### After
![testing_2](/uploads/8ab528e5a6d20abf870395b9ff0d73a2/testing_2.png)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment