Floating point processor for Programmable calculator

Download Report

Transcript Floating point processor for Programmable calculator

Floating point processor for
Programmable calculator
Vikas Kumar Sharma
Saurabh Gupta
Mentors: Veeramani V., Abhinav Agarwal
June 14, 2006
EE Summer Camp 2006
1
Outline


IEEE 754 standard
Floating Point Arithmetic




Processor Design






Addition & Subtraction
Multiplication & Division
Exceptions
Instruction Set Architecture (ISA)
Processor units
FPGA implementation
Conclusion
Future work
References
June 14, 2006
EE Summer Camp 2006
2
Introduction




Floating point Calculator design
Standard used: IEEE 754
Operations implemented: - Addition,
Subtraction, Multiplication, Division
User programs in hex using simple assembly
instructions
June 14, 2006
EE Summer Camp 2006
3
IEEE 754 standard


Single precision
Sign bit




0 – Positive
1 – Negative
Exponent: Biased by 127
Fraction: implicit ‘1’ excluded from mantissa
June 14, 2006
EE Summer Camp 2006
4
Zero & Infinity

Zero & Infinity are represented by a special
values



0_00000000_00000000000000000000000
represents 0 and not (1.0)*2^(-127)
0_11111111_00000000000000000000000
represents ∞ and not (1.0)*2^(128)
Arithmetic needs to be handled separately
June 14, 2006
EE Summer Camp 2006
5
Arithmetic Algorithms




Addition
Subtraction
Multiplication
Division
June 14, 2006
EE Summer Camp 2006
6
Addition & Subtraction
June 14, 2006
EE Summer Camp 2006
7
Multiplication & Division
June 14, 2006
EE Summer Camp 2006
8
Normalization to IEEE 754


0.0000101000000… * 2^(128)
Normalized as 1.010000… * 2^(123)


How?



We need implicit ‘1’ in the IEEE 754 format
Leading Zero Counter
Barrel Shifter
Both these modules are combinatorial
June 14, 2006
EE Summer Camp 2006
9
Leading Zeros Counter
June 14, 2006
EE Summer Camp 2006
10
Barrel Shifter
June 14, 2006
EE Summer Camp 2006
11
Exceptions Behavior

Exceptions Implemented



Out of Bound
Invalid operation
Operation suspended & FPGA LED blink
June 14, 2006
EE Summer Camp 2006
12
Processor Design – ISA

Register File



32-bit – IEEE 754 format
8 registers – sufficient for fairly complex operations
16-bit Instruction code




Opcode
Destination register address
Source Address 1
Source Address 2
June 14, 2006
EE Summer Camp 2006
13
Instructions

Arithmetic operations – 16 bit, 3 register
addresses






Add
Subtract
Multiply
Divide
Move – 48 bit, 1 register address
Termination instruction – 16 bit, all zeros
June 14, 2006
EE Summer Camp 2006
14
Processor Units
June 14, 2006
EE Summer Camp 2006
15
Processor Units…

Instruction Fetch Unit (IF)



Starts on reset with counter value zero
Fetches instruction to decoder or register file
depending on the instruction type
Instruction Decode Unit (ID)


Starts at the finish of IF
Passes proper ALU unit code to execution module
and register addresses to register file
June 14, 2006
EE Summer Camp 2006
16
Processor Units…

Execution Unit (EX)




Starts at the data read signal from register file
Operands passed to FPU with a activation signal to
the required arithmetic unit
Gives the result to Write Back Unit in IEEE 754 format
Write Back Unit (WB)


Starts at the finished execution signal from EX
Selects between the result and the input data
depending upon the instruction code
June 14, 2006
EE Summer Camp 2006
17
Simulation of FPU


Appropriate test benches were used for
simulation and design was verified
Exception behavior was checked
June 14, 2006
EE Summer Camp 2006
18
Simulation of Processor


Expression to calculate
(((1.75)/(1.5-1.75))*2.5)+((1.5-1.75)/2.5)=
-17.6
Corresponding instruction set:
Move r0, 1.5
Move r1, 1.75
Sub r2, r0, r1
Div r3, r1, r2
Move r4, 2.5
Mult r5, r3, r4
Div r6, r2, r4
Add r7, r5 , r6
000000000…00000
Result by Simulation = -17.60000229
June 14, 2006
EE Summer Camp 2006
19
June 14, 2006
EE Summer Camp 2006
20
FPGA implementation of FPU
AdditionSubtraction
Multiplication
Division
Complete
Processor
June 14, 2006
Logic elements
used
Memory bits
used
Clock cycles
used
6
0
4
1202
8896
33
685
0
54
5330
21568
--
EE Summer Camp 2006
21
FPGA Implementation of processor units
Processor Unit
Clock cycles used
(simulation result)
Instruction Fetch Unit
1
Instruction Decode Unit
2
Register File Read
1
Write Back Unit
2
Register File Write
1
June 14, 2006
EE Summer Camp 2006
22
Conclusion




FPU unit implemented on FPGA successfully
Complete Processor simulated and
synthesized successfully
Optimization required in some parts
Critical issues in synthesis were understood
June 14, 2006
EE Summer Camp 2006
23
Future work




Double precision
Jump and branch operations
Square Root calculation
Optimization
June 14, 2006
EE Summer Camp 2006
24
References
1.
2.
3.
4.
Institute of Electrical and Electronics Engineers, ”IEEE
Standard for Binary Floating-Point Arithmetic”,
ANSI/IEEE Standard 754-1985, August 1985
http://docs.sun.com/source/806-3568/ncg
goldberg.html
http://en.wikipedia.org/wiki/Booth’s multiplication
algorithm
http://www.cs.wisc.edu/
smoler/x86text/lect.notes/arith.flpt.html
June 14, 2006
EE Summer Camp 2006
25
Thank you
June 14, 2006
EE Summer Camp 2006
26