aboutsummaryrefslogtreecommitdiffstats
path: root/riscV
diff options
context:
space:
mode:
authorLéo Gourdin <leo.gourdin@univ-grenoble-alpes.fr>2021-09-10 10:18:29 +0200
committerLéo Gourdin <leo.gourdin@univ-grenoble-alpes.fr>2021-09-10 10:18:29 +0200
commit1d843c1a93ea5037fc1a0bbf7e23f415081f493e (patch)
treec652ce36c406b34f8489578838cbbf5ce2c36920 /riscV
parent055d87ffb4f63d14bec7cba055e1c816b3715662 (diff)
downloadcompcert-kvx-1d843c1a93ea5037fc1a0bbf7e23f415081f493e.tar.gz
compcert-kvx-1d843c1a93ea5037fc1a0bbf7e23f415081f493e.zip
new weights for FU74
Diffstat (limited to 'riscV')
-rw-r--r--riscV/OpWeights.ml141
1 files changed, 140 insertions, 1 deletions
diff --git a/riscV/OpWeights.ml b/riscV/OpWeights.ml
index a5ece6d5..2ec663cf 100644
--- a/riscV/OpWeights.ml
+++ b/riscV/OpWeights.ml
@@ -1,6 +1,130 @@
open Op
open PrepassSchedulingOracleDeps
+module FU74 = struct
+ (* Attempt at modeling the FU74 (HiFive Unmatched board) core *)
+
+ let resource_bounds = [| 2; 1; 1; 1; 1 |]
+ (* issue ; LSU ; BU ; FPU ; IMUL/IDIV *)
+
+ let nr_non_pipelined_units = 1
+
+ (* divider *)
+
+ let latency_of_op (op : operation) (nargs : int) =
+ match op with
+ | OEmayundef _ -> 0
+ | Omove | Ointconst _ | Olongconst _
+ | Oaddrsymbol (_, _)
+ | Oaddrstack _ | Ocast8signed | Ocast16signed | Oadd | Oaddimm _ | Oneg
+ | Osub | Oand | Oandimm _ | Oor | Oorimm _ | Oxor | Oxorimm _ | Oshl
+ | Oshlimm _ | Oshr | Oshrimm _ | Oshru | Oshruimm _ | Oshrximm _ | Olowlong
+ | Ocast32signed | Ocast32unsigned | Oaddl | Oaddlimm _ | Onegl | Osubl
+ | Oandl | Oandlimm _ | Oorl | Oorlimm _ | Oxorl | Oxorlimm _ | Oshll
+ | Oshllimm _ | Oshrl | Oshrlimm _ | Oshrlu | Oshrluimm _ | Oshrxlimm _
+ | Oselectl | Obits_of_single | Obits_of_float | OEseqw _ | OEsnew _
+ | OEsequw _ | OEsneuw _ | OEsltw _ | OEsltuw _ | OEsltiw _ | OEsltiuw _
+ | OEaddiw (_, _)
+ | OEandiw _ | OEoriw _ | OExoriw _ | OEluiw _ | OEseql _ | OEsnel _
+ | OEsequl _ | OEsneul _ | OEsltl _ | OEsltul _ | OEsltil _ | OEsltiul _
+ | OEaddil (_, _)
+ | OEandil _ | OEoril _ | OExoril _ | OEluil _ | OEloadli _ ->
+ 1
+ | Osingleconst _ | Ofloatconst _ | Onegf | Oabsf | Onegfs | Oabsfs
+ | Osingleoffloat | Ofloatofsingle | Ofloatofint | Ofloatofintu
+ | Osingleofint | Osingleofintu | Osingle_of_bits ->
+ 2
+ | Omul | Omulhs | Omulhu | Omull | Omullhs | Omullhu -> 3
+ | Omulf -> 7
+ | Omulfs -> 5
+ | Ointoffloat | Ointuoffloat | Ointofsingle | Ointuofsingle | Olongoffloat
+ | Olonguoffloat | Olongofsingle | Olonguofsingle | Osingleoflong
+ | Osingleoflongu | OEfeqd | OEfltd | OEfled | OEfeqs | OEflts | OEfles ->
+ 4
+ | Ofloatoflong | Ofloatoflongu | Ofloat_of_bits -> 6
+ | Oaddf | Osubf | Oaddfs | Osubfs -> 7
+ | Ocmp cond -> (
+ match cond with
+ | Ccomp _ | Ccompu _ | Ccompimm _ | Ccompuimm _ | Ccompl _ | Ccomplu _
+ | Ccomplimm _ | Ccompluimm _ | CEbeqw _ | CEbnew _ | CEbequw _
+ | CEbneuw _ | CEbltw _ | CEbltuw _ | CEbgew _ | CEbgeuw _ | CEbeql _
+ | CEbnel _ | CEbequl _ | CEbneul _ | CEbltl _ | CEbltul _ | CEbgel _
+ | CEbgeul _ ->
+ 1
+ | Ccompf _ | Cnotcompf _ | Ccompfs _ | Cnotcompfs _ -> 4)
+ | Odiv | Odivu | Omod | Omodu | Odivl | Odivlu | Omodl | Omodlu | Odivf
+ | Odivfs ->
+ 68
+ | _ -> 1
+
+ let resources_of_op (op : operation) (nargs : int) =
+ match op with
+ | OEmayundef _ -> [| 0; 0; 0; 0; 0 |]
+ | Omove | Ointconst _ | Olongconst _
+ | Oaddrsymbol (_, _)
+ | Oaddrstack _ | Ocast8signed | Ocast16signed | Oadd | Oaddimm _ | Oneg
+ | Osub | Oand | Oandimm _ | Oor | Oorimm _ | Oxor | Oxorimm _ | Oshl
+ | Oshlimm _ | Oshr | Oshrimm _ | Oshru | Oshruimm _ | Oshrximm _ | Olowlong
+ | Ocast32signed | Ocast32unsigned | Oaddl | Oaddlimm _ | Onegl | Osubl
+ | Oandl | Oandlimm _ | Oorl | Oorlimm _ | Oxorl | Oxorlimm _ | Oshll
+ | Oshllimm _ | Oshrl | Oshrlimm _ | Oshrlu | Oshrluimm _ | Oshrxlimm _
+ | Oselectl | Obits_of_single | Obits_of_float | OEseqw _ | OEsnew _
+ | OEsequw _ | OEsneuw _ | OEsltw _ | OEsltuw _ | OEsltiw _ | OEsltiuw _
+ | OEaddiw (_, _)
+ | OEandiw _ | OEoriw _ | OExoriw _ | OEluiw _ | OEseql _ | OEsnel _
+ | OEsequl _ | OEsneul _ | OEsltl _ | OEsltul _ | OEsltil _ | OEsltiul _
+ | OEaddil (_, _)
+ | OEandil _ | OEoril _ | OExoril _ | OEluil _ | OEloadli _ ->
+ [| 1; 0; 0; 0; 0 |]
+ | Omul | Omulhs | Omulhu | Omull | Omullhs | Omullhu | Odiv | Odivu | Omod
+ | Omodu | Odivl | Odivlu | Omodl | Omodlu ->
+ [| 1; 0; 0; 0; 1 |]
+ | Omulf | Omulfs | Ointoffloat | Ointuoffloat | Ointofsingle | Ointuofsingle
+ | Olongoffloat | Olonguoffloat | Olongofsingle | Olonguofsingle
+ | Osingleoflong | Osingleoflongu | OEfeqd | OEfltd | OEfled | OEfeqs
+ | OEflts | OEfles | Ofloatoflong | Ofloatoflongu | Ofloat_of_bits | Oaddf
+ | Osubf | Oaddfs | Osubfs | Osingleconst _ | Ofloatconst _ | Onegf | Oabsf
+ | Onegfs | Oabsfs | Osingleoffloat | Ofloatofsingle | Ofloatofint
+ | Ofloatofintu | Osingleofint | Osingleofintu | Osingle_of_bits | Odivf
+ | Odivfs ->
+ [| 1; 0; 0; 1; 0 |]
+ | Ocmp cond -> (
+ match cond with
+ | Ccomp _ | Ccompu _ | Ccompimm _ | Ccompuimm _ | Ccompl _ | Ccomplu _
+ | Ccomplimm _ | Ccompluimm _ | CEbeqw _ | CEbnew _ | CEbequw _
+ | CEbneuw _ | CEbltw _ | CEbltuw _ | CEbgew _ | CEbgeuw _ | CEbeql _
+ | CEbnel _ | CEbequl _ | CEbneul _ | CEbltl _ | CEbltul _ | CEbgel _
+ | CEbgeul _ ->
+ [| 1; 0; 1; 0; 0 |]
+ | Ccompf _ | Cnotcompf _ | Ccompfs _ | Cnotcompfs _ ->
+ [| 1; 0; 1; 1; 0 |])
+ | _ -> [| 1; 0; 0; 0; 0 |]
+
+ let non_pipelined_resources_of_op (op : operation) (nargs : int) =
+ match op with
+ | Odiv | Odivu | Omod | Omodu | Odivl | Odivlu | Omodl | Omodlu | Odivf
+ | Odivfs ->
+ [| 68 |]
+ | _ -> [| -1 |]
+
+ let resources_of_cond (cond : condition) (nargs : int) =
+ match cond with
+ | Ccompf _ |Cnotcompf _|Ccompfs _|Cnotcompfs _ -> [| 1; 0; 1; 1; 0 |]
+ | _ -> [| 1; 0; 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; 0; 0 |]
+
+ let resources_of_store chunk addressing nargs = [| 1; 1; 0; 0; 0 |]
+
+ let resources_of_call _ _ = resource_bounds
+
+ let resources_of_builtin _ = resource_bounds
+end
+
module Rocket = struct
(* Attempt at modeling the Rocket core *)
@@ -136,7 +260,7 @@ end
let get_opweights () : opweights =
match !Clflags.option_mtune with
- | "rocket" | "" ->
+ | "rocket" ->
{
pipelined_resource_bounds = Rocket.resource_bounds;
nr_non_pipelined_units = Rocket.nr_non_pipelined_units;
@@ -166,4 +290,19 @@ let get_opweights () : opweights =
resources_of_call = SweRV_EH1.resources_of_call;
resources_of_builtin = SweRV_EH1.resources_of_builtin;
}
+ | "FU74" | "" ->
+ {
+ pipelined_resource_bounds = FU74.resource_bounds;
+ nr_non_pipelined_units = FU74.nr_non_pipelined_units;
+ latency_of_op = FU74.latency_of_op;
+ resources_of_op = FU74.resources_of_op;
+ non_pipelined_resources_of_op = FU74.non_pipelined_resources_of_op;
+ latency_of_load = FU74.latency_of_load;
+ resources_of_load = FU74.resources_of_load;
+ resources_of_store = FU74.resources_of_store;
+ resources_of_cond = FU74.resources_of_cond;
+ latency_of_call = FU74.latency_of_call;
+ resources_of_call = FU74.resources_of_call;
+ resources_of_builtin = FU74.resources_of_builtin;
+ }
| xxx -> failwith (Printf.sprintf "unknown -mtune: %s" xxx)