aboutsummaryrefslogtreecommitdiffstats
path: root/src/hls/FunctionalUnits.v
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2021-02-21 16:34:11 +0000
committerYann Herklotz <git@yannherklotz.com>2021-02-21 16:34:11 +0000
commit85650692c13e8a3c9e377f8259059eef8712d3d3 (patch)
tree0598c865f308e9fc39b7a7bec6ab8a46ce48fdf9 /src/hls/FunctionalUnits.v
parent171b326ade18ab77eb155a9d203f2f523708b29b (diff)
parent71fee63bcd943d33c761f228227b1bf8c60c1aac (diff)
downloadvericert-85650692c13e8a3c9e377f8259059eef8712d3d3.tar.gz
vericert-85650692c13e8a3c9e377f8259059eef8712d3d3.zip
Merge branch 'develop' into dev/divider
Diffstat (limited to 'src/hls/FunctionalUnits.v')
-rw-r--r--src/hls/FunctionalUnits.v41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/hls/FunctionalUnits.v b/src/hls/FunctionalUnits.v
new file mode 100644
index 0000000..019cf15
--- /dev/null
+++ b/src/hls/FunctionalUnits.v
@@ -0,0 +1,41 @@
+(*
+ * Vericert: Verified high-level synthesis.
+ * Copyright (C) 2021 Yann Herklotz <yann@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/>.
+ *)
+
+Require Import compcert.backend.Registers.
+Require Import compcert.lib.Maps.
+
+Require Import vericert.common.Vericertlib.
+
+Inductive funct_unit: Type :=
+| SignedDiv (size: positive) (numer denom quot rem: reg): funct_unit
+| UnsignedDiv (size: positive) (numer denom quot rem: reg): funct_unit.
+
+Record funct_units := mk_avail_funct_units {
+ avail_sdiv: option positive;
+ avail_udiv: option positive;
+ avail_units: PTree.t funct_unit;
+ }.
+
+Definition initial_funct_units :=
+ mk_avail_funct_units None None (PTree.empty funct_unit).
+
+Definition funct_unit_stages (f: funct_unit) : positive :=
+ match f with
+ | SignedDiv s _ _ _ _ => s
+ | UnsignedDiv s _ _ _ _ => s
+ end.