Download presentation
Presentation is loading. Please wait.
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 cycles 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. This assignment needs to be simulated on the workstations to map to the shared library. 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 needs to be renormalized – Note the position of the binary point in the result. 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 (located in a 24-bit register) and repeat for each successive bit to the msb is reached 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 add 1 to the exponent giving 01.xxxxx as the mantissa 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 the 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 As this is a behavioral model it is probably easiest to do a binary to integer conversion right at the start for the exponent. Then Exp_res = Exp_a + Exp_b – 127 As both exponents are biased 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 de-normalized number or underflow. In this case you will have to right shift the result on a fixed binary point, adding one to the exponent each time until the exponent reaches 0. If any bits in the fractional part are a 1 it is a denomalized number. If all 0 now, you have an underflow. When in the 1 to 254 range do an integer to binary conversion for the exponent of the result to construct the final output. 1/8/ L25 Project Step 10 - Floating Point Adder Copyright Joanne DeGroat, ECE, OSU
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.