[keymgr] Add block-level synthesis setups

Signed-off-by: Michael Schaffner <msf@google.com>
diff --git a/hw/ip/keymgr/keymgr.core b/hw/ip/keymgr/keymgr.core
index c771f81..c1a0a4f 100644
--- a/hw/ip/keymgr/keymgr.core
+++ b/hw/ip/keymgr/keymgr.core
@@ -73,3 +73,12 @@
         mode: lint-only
         verilator_options:
           - "-Wall"
+
+  syn:
+    <<: *default_target
+    # TODO: set default to DC once
+    # this option is available
+    # olofk/edalize#89
+    default_tool: icarus
+    parameters:
+      - SYNTHESIS=true
diff --git a/hw/ip/keymgr/syn/constraints.sdc b/hw/ip/keymgr/syn/constraints.sdc
new file mode 100644
index 0000000..a9e37ba
--- /dev/null
+++ b/hw/ip/keymgr/syn/constraints.sdc
@@ -0,0 +1,50 @@
+# Copyright lowRISC contributors.
+# Licensed under the Apache License, Version 2.0, see LICENSE for details.
+# SPDX-License-Identifier: Apache-2.0
+#
+# Generic constraints file for simple testsynthesis flow
+
+# note that we do not fix hold timing in this flow
+set SETUP_CLOCK_UNCERTAINTY 0.5
+
+#####################
+# main clock        #
+#####################
+set MAIN_CLK_PIN clk_i
+set MAIN_RST_PIN rst_ni
+# set main clock to 125 MHz
+set MAIN_TCK  8.0
+set_ideal_network ${MAIN_CLK_PIN}
+set_ideal_network ${MAIN_RST_PIN}
+set_clock_uncertainty ${SETUP_CLOCK_UNCERTAINTY} ${MAIN_CLK_PIN}
+
+# other timing constraint in ns
+set IN_DEL    1.0
+set OUT_DEL   1.0
+set DELAY     ${MAIN_TCK}
+
+create_clock ${MAIN_CLK_PIN} -period ${MAIN_TCK}
+
+# in to out
+set_max_delay ${DELAY} -from [all_inputs] -to [all_outputs]
+# in to reg / reg to out
+set_input_delay ${IN_DEL} [remove_from_collection [all_inputs] {${MAIN_CLK_PIN}}] -clock ${MAIN_CLK_PIN}
+set_output_delay ${OUT_DEL}  [all_outputs] -clock ${MAIN_CLK_PIN}
+
+#####################
+# I/O drive/load    #
+#####################
+
+# attach load and drivers to IOs to get a more realistic estimate
+set_driving_cell  -no_design_rule -lib_cell ${DRIVING_CELL} -pin ${DRIVING_CELL_PIN} [all_inputs]
+set_load [load_of ${LOAD_CELL_LIB}/${LOAD_CELL}/${LOAD_CELL_PIN}] [all_outputs]
+
+# set a nonzero critical range to be able to spot the violating paths better
+# in the report
+set_critical_range 0.5 ${DUT}
+
+#####################
+# Size Only Cells   #
+#####################
+
+set_size_only -all_instances [get_cells -h *u_size_only*] true
diff --git a/hw/ip/keymgr/syn/keymgr_gtech_syn_cfg.hjson b/hw/ip/keymgr/syn/keymgr_gtech_syn_cfg.hjson
new file mode 100644
index 0000000..0235432
--- /dev/null
+++ b/hw/ip/keymgr/syn/keymgr_gtech_syn_cfg.hjson
@@ -0,0 +1,20 @@
+// Copyright lowRISC contributors.
+// Licensed under the Apache License, Version 2.0, see LICENSE for details.
+// SPDX-License-Identifier: Apache-2.0
+{
+  // Top level dut name (sv module).
+  name: keymgr
+
+  // Fusesoc core file used for building the file list.
+  fusesoc_core: lowrisc:ip:{name}:0.1
+
+  import_cfgs: [// Project wide common GTECH synthesis config file
+                "{proj_root}/hw/syn/tools/dvsim/common_gtech_syn_cfg.hjson"]
+
+  overrides: [
+    { // Deletes black-boxed hierarchies before writing out the unmapped netlist
+      name: post_elab_script
+      value: "{proj_root}/hw/ip/{name}/syn/post_elab_gtech.tcl"
+    }
+  ]
+}
diff --git a/hw/ip/keymgr/syn/keymgr_syn_cfg.hjson b/hw/ip/keymgr/syn/keymgr_syn_cfg.hjson
new file mode 100644
index 0000000..7568124
--- /dev/null
+++ b/hw/ip/keymgr/syn/keymgr_syn_cfg.hjson
@@ -0,0 +1,19 @@
+// Copyright lowRISC contributors.
+// Licensed under the Apache License, Version 2.0, see LICENSE for details.
+// SPDX-License-Identifier: Apache-2.0
+{
+  // Top level dut name (sv module).
+  name: keymgr
+
+  // Fusesoc core file used for building the file list.
+  fusesoc_core: lowrisc:ip:{name}:0.1
+
+  import_cfgs: [// Project wide common synthesis config file
+                "{proj_root}/hw/syn/tools/dvsim/common_syn_cfg.hjson"]
+
+  // Timing constraints for this module
+  sdc_file: "{proj_root}/hw/ip/{name}/syn/constraints.sdc"
+
+  // This is not needed for this module
+  foundry_sdc_file: ""
+}
diff --git a/hw/ip/keymgr/syn/post_elab_gtech.tcl b/hw/ip/keymgr/syn/post_elab_gtech.tcl
new file mode 100644
index 0000000..5655bd3
--- /dev/null
+++ b/hw/ip/keymgr/syn/post_elab_gtech.tcl
@@ -0,0 +1,7 @@
+# Copyright lowRISC contributors.
+# Licensed under the Apache License, Version 2.0, see LICENSE for details.
+# SPDX-License-Identifier: Apache-2.0
+#
+# Post elab script, used in GTECH runs to modify the unmapped netlist before
+# writing it out.
+