IEEE754 Rounding Modes - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

IEEE754 Rounding Modes

Description:

Mem/WB.RegisterRd = ID/EX.RegisterRs. Hazard on $2 between the sub and and instructions is: ... (Mem/WB.RegRd = ID/EX.RegRs) then. ForwardA = 01. If (Mem/WB. ... – PowerPoint PPT presentation

Number of Views:78
Avg rating:3.0/5.0
Slides: 19
Provided by: MurrayP2
Category:
Tags: ex | ieee754 | modes | my | rounding

less

Transcript and Presenter's Notes

Title: IEEE754 Rounding Modes


1
(No Transcript)
2
IEEE754 Rounding Modes
  • Four Rounding modes
  • Plus infinity
  • Minus inifinity
  • Truncate
  • Nearest even

3
Examples
4
Convert_float
my_float convert_my_float(float num) struct
my_float my_num new(my_float) if (my_num)
union converter c c.f num
my_num-gtsign c.i gtgt 31 my_num-gtexponent
((c.i gtgt 23) 0xff) my_num-gtmantissa
(((c.i 0x7FFFFF) 0x800000) ltlt 3)
return my_num
5
Print Binary function
void print_binary(int num) unsigned mask
0x80000000 int anded for (int i 0 i lt
32 i ) if ((i gt 0) (i 4) 0) cout
ltlt " " anded num mask if (anded)
cout ltlt "1" else cout
ltlt "0" mask mask gtgt 1
6
Add function
define DBG(a) a
struct my_float my_float_add(struct my_float
first, struct my_float second,\ int
rnd_mode) int first_mantissa
first-gtmantissa int second_mantissa
second-gtmantissa int exp_diff
first-gtexponent - second-gtexponent my_float
my_result new(my_float) DBG(cout ltlt
"Starting to add" ltlt endl) if (exp_diff gt 0)
7
Hazard notation
  • IN our previous example the twop pairs of hazrard
    condditions are
  • 1a. EX/Mem.RegisterRd ID/EX.RegisterRs
  • 1b. EX/Mem.RegisterRd ID/EX.RegisterRt
  • 2a. Mem/WB.RegisterRd ID/EX.RegisterRs
  • 2b. Mem/WB.RegisterRd ID/EX.RegisterRs
  • Hazard on 2 between the sub and and instructions
    is
  • EX/Mem.RegisterRd ID/EX.RegisterRs 2

8
Hazards
  • Above notation will do forwarding unecessarily as
    some instruction do not write registers
  • Soln can check WB control to check if register
    writes back
  • What about 0
  • Do not foraward as shpuld always be zero

9
(No Transcript)
10
No Forwarding
11
Forwarding
12
EX Hazard
  • If (EX/Mem.RegWrite) and (EX/Mem.RegRd ! 0)
    and (EM/Mem.RegRd ID/EX.RegRs) then
    ForwardA 10
  • If (EX/Mem.RegWrite) and (EX/Mem.RegRd ! 0)
    and (EM/Mem.RegRd ID/EX.RegRt) then
    ForwardB 10

13
Mem Hazard
  • If (Mem/WB.RegWrite) and (Mem/WB.RegRd ! 0)
    and (Mem/WB.RegRd ID/EX.RegRs) then
    ForwardA 01If (Mem/WB.RegWrite) and
    (Mem/WB.RegRd ! 0) and (Mem/WB.RegRd
    ID/EX.RegRt) then ForwardB 01

14
What about
Add 1, 1, 2 Add 1, 1, 3 Add 1, 1, 4
  • If (Mem/WB.RegWrite) and (Mem/WB.RegRd ! 0)
    and (EX/Mem.RegRd ! ID/EX.RegRs) and
    (Mem/WB.RegRd ID/EX.RegRs) then ForwardA
    01If (Mem/WB.RegWrite) and (Mem/WB.RegRd !
    0) and (EX/Mem.RegRd ! ID/EX.RegRt) and
    (Mem/WB.RegRd ID/EX.RegRt) then ForwardB
    01

15
Updated datapath to resolve data hazards
16
Data Hazards and Stalls
  • Forwarding will not work where an instruction
    tries to read a register following a load
    instruction that writes the same register

17
Stalls
  • Hazard detection unit required at the ID stage
  • If (ID/EX.MemRead) and (ID/EX.RegRt
    IF/ID.RegRs) or (ID/EX.RegRt IF/ID.RegRt
    then stall the pipeline

18
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com