Lab 3 - Converting Fixed Point to Floating Point

Intro:


This lab can be completed in groups

This lab consists of 2 parts. In the first part you will develop a Verilog program to convert a Fixed Point binary number to a single precision Floating point number. In the second part you will extend your program to support the opposite, Floating Point to Fixed Point.

  • A Floating Point tutorial can be found here.
  • Your code MUST handle 0 input and negative input.

Part 1


For Part 1 you will receive two inputs representing the Fixed Point value. First value will be the location to the left of the binary point. The second value will be a 32-bit Fixed Point number (read as an integer). You can assume values given will not be out of range. Your program should output the Floating Point number. To do this you should make use of the Floating point registers.

Fixed Point as an Integer:

Assume we want to represent 8.25 as an integer with the binary point to the left of the 7's bit.

  • 8.25 in binary is 1000 . 01
  • Extending to 32-bits with the point left of the 7's bit: 00000000 00000000 00000100 0.0100000
  • to hex: 0x00000420
  • to an integer: 1056

Sample Input:

7, 1056

Sample Output:

8.25



Part 2


For Part 2 you will be adding extending your program from part 1. Your program should now support both Fixed to Float and Float to Fixed point conversion. Input to your module will be configured by the testbench.

Sample Input:

7, 8.25

Sample Output:

1056


Mandatory functionality:

  • User inputs will be specified in test bench
  • Floating point outputs must be formatted as Floating Point values
  • Fixed point outputs can be formated as Integer values

You can use the functions listed hereto help with displaying the value in the console using the $display() function

Turn-In:


Each group should turn in one tar file to iLearn. Containing:

  • A README file with the group members names, and any incomplete or incorrect functionality.
  • The .v file created for the lab