From 2c74f5a4a9499d5f511089000421ca20fc2049d5 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Thu, 4 May 2023 22:23:20 +0100 Subject: Add IfConversionOracle.ml --- src/hls/IfConversionOracle.ml | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/hls/IfConversionOracle.ml 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 + * + * 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 . + *) + +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 -- cgit