aboutsummaryrefslogtreecommitdiffstats
path: root/src/hls/IfConversionOracle.ml
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2023-05-04 22:23:20 +0100
committerYann Herklotz <git@yannherklotz.com>2023-05-04 22:23:20 +0100
commit2c74f5a4a9499d5f511089000421ca20fc2049d5 (patch)
treee429da657338bd885e96b8e4f3991a6d93df3be8 /src/hls/IfConversionOracle.ml
parentd628cd08d0f81515c9f121fa4c2b22a472f3474a (diff)
downloadvericert-2c74f5a4a9499d5f511089000421ca20fc2049d5.tar.gz
vericert-2c74f5a4a9499d5f511089000421ca20fc2049d5.zip
Add IfConversionOracle.ml
Diffstat (limited to 'src/hls/IfConversionOracle.ml')
-rw-r--r--src/hls/IfConversionOracle.ml43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/hls/IfConversionOracle.ml b/src/hls/IfConversionOracle.ml
new file mode 100644
index 0000000..e9a1563
--- /dev/null
+++ b/src/hls/IfConversionOracle.ml
@@ -0,0 +1,43 @@
+(*
+ * Vericert: Verified high-level synthesis.
+ * Copyright (C) 2023 Yann Herklotz <git@yannherklotz.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *)
+
+open Printf
+open Clflags
+open Camlcoq
+open Datatypes
+open Coqlib
+open Maps
+open AST
+
+type if_conv_t = (BinNums.positive * BinNums.positive) list PTree.t
+
+(** [function_oracle func_data func] should implement the inlining definitions
+ that are then provided to the verified algorithm. *)
+let function_oracle func_data func = func_data
+
+let fundefs_oracle current_data = function
+ | (id, Gfun f) ->
+ (match PTree.get id current_data with
+ | Some func_data ->
+ let result_data = function_oracle func_data f in
+ PTree.set id result_data current_data
+ | _ -> current_data)
+ | _ -> current_data
+
+let if_conversion_oracle prog : if_conv_t =
+ List.fold_left fundefs_oracle PTree.empty prog.prog_defs