Presentation is loading. Please wait.

Presentation is loading. Please wait.

A floating point multiplier behavior model.

Similar presentations


Presentation on theme: "A floating point multiplier behavior model."— Presentation transcript:

1 A floating point multiplier behavior model.
Project Step 10 A floating point multiplier behavior model. 1/8/ L25 Project Step 10 - Floating Point Adder Copyright Joanne DeGroat, ECE, OSU

2 Model of a floating point multiplier
This exercise will once again be a high level behavioral model. The code style will be algorithmic yet you will be working with the 32-bit data words. As it is high level it is not intended for synthesis, rather as a reference model for the design. It would be used to generate the reference output of the model that would be used for synthesis 1/8/ L25 Project Step 10 - Floating Point Adder Copyright Joanne DeGroat, ECE, OSU

3 Copyright 2006 - Joanne DeGroat, ECE, OSU
Where to start? THE INTERFACE!!! Very simple 2 Data inputs A and B bits each in IEEE single precision A latch signal to latch the inputs A drive signal to latch the outputs A results output C that is also IEEE single precision and 32-bits 1/8/ L25 Project Step 10 - Floating Point Adder Copyright Joanne DeGroat, ECE, OSU

4 Copyright 2006 - Joanne DeGroat, ECE, OSU
Interface timing Similar to other designs. However, now 2 distinct cycle The load cycle The drive cycle 1/8/ L25 Project Step 10 - Floating Point Adder Copyright Joanne DeGroat, ECE, OSU

5 Copyright 2006 - Joanne DeGroat, ECE, OSU
Recommended step 1 Get the interface working Once you can pass the input straight to the output start the algorithm This is a major step as you will be using a package that reads the test vectors from a file. 1/8/ L25 Project Step 10 - Floating Point Adder Copyright Joanne DeGroat, ECE, OSU

6 Copyright 2006 - Joanne DeGroat, ECE, OSU
Reading from the file The procedure is already compiled and in a package in LIBRARY ASSIGN that is located in directory ~degroat/ee762_assign The procedure is hardcoded to read the vectors from the file fpm_vectors in this directory. You can see the vector file and copy it, but it will use the vectors in my file. You will need to map to this library. You will not be able to see the code of concurrent procedure gen_vec which generates the test vectors and checks the result. 1/8/ L25 Project Step 10 - Floating Point Adder Copyright Joanne DeGroat, ECE, OSU

7 Copyright 2006 - Joanne DeGroat, ECE, OSU
Mapping to the library The library name will be ASSIGN The testbench has a clause USE ASSIGN.fpm_test_vect.all This procedure uses STD.TEXTIO.ALL for the file operations (info only) In Modeltech you need to map to this library /rcc4/homes/degroat/ee762_assign/assign Testbench also has a signal yourname 1/8/ L25 Project Step 10 - Floating Point Adder Copyright Joanne DeGroat, ECE, OSU

8 The rest of the algorithm
As this is behavioral it is easy to use if/else to handle all the special cases NaN by all the other class results in NaN IF (Ain=NaN or Bin=Nan) THEN out=NaN ELSE Only time you have to actually manipulate bits is for the Normalized x Normalized or Denormalized. 1/8/ L25 Project Step 10 - Floating Point Adder Copyright Joanne DeGroat, ECE, OSU

9 Copyright 2006 - Joanne DeGroat, ECE, OSU
Manipulate bits Need to do a multiplication of the mantissas x.xxxxx… x.xxxxx… where each is 24 bits xx.xxxxx… giving 48 bit result which will need to be renormalized Range of input is [0…2) i.e. from and including 0 to 2 but not including 2 Range of output is [0…4) which means you need to be aware of all the bits of the output 1/8/ L25 Project Step 10 - Floating Point Adder Copyright Joanne DeGroat, ECE, OSU

10 Note on doing multiplication
This is a behavioral model Several possible approaches to actually do the multiplication One method – shift and add Initialize a result vector (48-bits) to 0 Place the multiplicand into the least significant 24 bits of another 48-bit vector called prod_term. Start with the lsb of the multiplier and repeat for each successive bit to the msb If the bit of the multiplier is a 1 add the prod_term to the result. Shift the prod_term 1 to the left with a 0 input as the lsb, i.e., x 2 Repeat Output the result vector 1/8/ L25 Project Step 10 - Floating Point Adder Copyright Joanne DeGroat, ECE, OSU

11 Renormalization of result
If result is in form 1x.xxxx Shift right on fixed binary point and +1 to exponent giving 01.xxxxx If result is in form 01.xxxx your are OK as is If result is in form 00.00…1xxxx must shift left on fixed binary point until your leading 1 is to the left of the binary point, taking -1 from the exponent each time Then look at exponent 1/8/ L25 Project Step 10 - Floating Point Adder Copyright Joanne DeGroat, ECE, OSU

12 Copyright 2006 - Joanne DeGroat, ECE, OSU
Handling the exponent Probably easiest to do a binary to integer conversion at the start for the exponent. Then Exp_res = Exp_a + Exp_b – 127 After renormalization exponent must be between 0 and Adjust a necessary. If >255 you have overflow to infinity. If negative or 0 then you probably have a denormalized number or underflow When in the 1 to 254 range do an integer to binary conversion 1/8/ L25 Project Step 10 - Floating Point Adder Copyright Joanne DeGroat, ECE, OSU


Download ppt "A floating point multiplier behavior model."

Similar presentations


Ads by Google