aboutsummaryrefslogtreecommitdiffstats
path: root/riscV/OpWeights.ml
blob: 143435c1b230a3eaa885a0377713e0ad75e97825 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
open Op;;

(* Attempt at modeling SweRV EH1
[| issues ; LSU ; multiplier |] *)
let resource_bounds = [| 2 ; 1; 1 |];;
let nr_non_pipelined_units = 1;; (* divider *)

let latency_of_op (op : operation) (nargs : int) =
  match op with
    | Omul  | Omulhs  | Omulhu
    | Omull | Omullhs | Omullhu -> 3
    | Odiv | Odivu | Odivl | Odivlu -> 16  
    | _ -> 1;;

let resources_of_op (op : operation) (nargs : int) = 
  match op with
    | Omul  | Omulhs  | Omulhu
    | Omull | Omullhs | Omullhu -> [| 1 ; 0 ; 1 |]
    | Odiv | Odivu | Odivl | Odivlu -> [| 0 ; 0; 0 |]                        
    | _ -> [| 1; 0; 0; 0 |];;
  
let non_pipelined_resources_of_op (op : operation) (nargs : int) =
  match op with
  | Odiv | Odivu -> [| 29 |]
  | Odivfs -> [| 20 |]
  | Odivl | Odivlu | Odivf -> [| 50 |]
  | _ -> [| -1 |];;

let resources_of_cond (cond : condition) (nargs : int) = [| 1; 0; 0 |];;

let latency_of_load trap chunk (addr : addressing) (nargs : int) = 3;;
let latency_of_call _ _ = 6;;

let resources_of_load trap chunk addressing nargs = [| 1; 1; 0 |];;

let resources_of_store chunk addressing nargs = [| 1; 1; 0 |];;

let resources_of_call _ _ = resource_bounds;;
let resources_of_builtin _ = resource_bounds;;