Lab3 Digital Design
Lab3 Digital Design
OBJECTIVES
➢ Getting to know how to describe a floating-point arithmetic, which could do add, subtract,
and multiply operations.
➢ Design and implement digital circuits using FSM.
➢ Download the circuit into the FPGA chip and test its functionality.
REFERENCE
Floating point numbers allow computers to perform operations on a wide range of numbers.
According to the IEEE standards, floating point numbers are of the form
(-1)^S * (1+F) *2^E
S is the sign bit, which determines whether the number is positive or negative.
F – fraction – holds the significant bits of the floating point number.
E is the exponent that (1+F) is raised to.
A 32 bit floating point number is standard, however fo simpification, we will be using an 8 bit
representation. We will have a sign bit, 3 bits for the exponent, and the remaining 4 bits will be
devoted to the fraction. This will allow us to represent a resolution as small as 1/128 and the
smallest number we can represent is 1/8. Eight-bit floating point numbers are not useful for
performing extremely accurate calculations, but it does demonstrate the operation of a floating
point adder.
Table 1: IO definition
Instruction:
Input A and B have 8 bits, in which the sign is represented by bit [7], the exponent value is
represented by bit [6:4], and the remaining is for Fraction value. Output Result also need to be
normalized as input signal.
The design have some sub-modules that perform floating point calculations:
- Identify which number is larger, which number is smaller.
- Indentify the amount to right shift the operand which has smaller exponent.
- Right shift fraction value of the smaller operand to align decimal points.
- Calculate the two's compliment of the shifted fraction, only needed in the case of
subtraction or equivalent case (i.e. adding a negative number to a positive number).
- Add the two fractions together.
- Normalize the fraction and exponent value so it's back in floating point representation.
- Determine sign of the final value.
- Detect zero: the result is zero if the signs of A and B are different and there is no difference in
the fraction and exponent.